[GRASS-dev] making grass modules less verbose
Brad Douglas
rez at touchofmadness.com
Thu Sep 21 14:25:06 EDT 2006
On Thu, 2006-09-21 at 17:58 +0100, Glynn Clements wrote:
> Brad Douglas wrote:
>
> > > > I fully agree with you. But how to do this the best way? Add new
> > > > parameter to the function?
> > > >
> > > > e.g.
> > > >
> > > > G_percent(row,nrows,2,module)
> > > >
> > > > so that
> > > >
> > > > G_percent could call G_percent2(n,d,s,stderr,module->verbose)
> > > >
> > > > Make G_percent(), G_debug() and G_message() read environment variable
> > > > GRASS_VERBOSE? I would say, this would be the best solution.
> > >
> > > Add a function to query the verbosity level, and change G_percent()
> > > etc to use it.
> > >
> > > If there's a GRASS_VERBOSE environment variable, you probably want
> > > both --verbose and --quiet (the latter would disable verbosity even
> > > when GRASS_VERBOSE is set).
> >
> > A smaller issue is that of '\n'. G_message("\n") doesn't work well and
> > the alternative has been to use:
> >
> > fprintf(stderr, "\n");
> >
> > Going quiet may yield an extraneous number of CRs depending on the
> > module...
>
> Can you clarify.
>
> G_message() ought to terminate anything it writes.
I was thinking of the many loops that output text. After the loop is
finished, there is usually a single CR after the loop:
fprintf(stderr, "\n");
For the loops that use fprintf() throughout, it won't be a major
inconvenience (it just won't shut up :-), but for loops that use
G_message(), you'll probably end up with a few extra CRs output to
stderr...
--
Brad Douglas <rez touchofmadness com> KB8UYR
Address: 37.493,-121.924 / WGS84 National Map Corps #TNMC-3785
More information about the grass-dev
mailing list