[GRASSLIST:4554] Re: Advice on changing source code for g.region command

Markus Neteler neteler at itc.it
Sun Sep 22 19:50:45 EDT 2002


On Fri, Sep 20, 2002 at 12:45:23PM +0100, Glynn Clements wrote:
> 
> Roy Sanderson wrote:
> 
> > The observant amongst you will spot that east and west have swapped round.
> > As my colleagues have the g.region command liberally embedded in various
> > scripts, and the output is read by their own C programs, this is causing
> > problems.  My suggestion to them that they should go through all their C
> > programs and edit the input lines was not well received!
> > 
> > As an alternative, I'm wondering whether to alter the Grass 5.0 code
> > myself, and recompile it.  I've not done this before, but assume the
> > offending lines are in
> > /src/grass5.0.0pre5/src/general/g.region/cmd/printwindow.c  Am I safe in
> > simply swapping the fprintf lines round for east and west so that they
> > match the Grass4.3 format, and re-compiling?
> 
> Probably.
> 
> IOW, it's unlikely that anything in GRASS relies upon the format;
> however, I'm not about to perform exhaustive analysis, and I doubt
> that anyone else is either.
> 
> To elaborate slightly:
> 
> It's safe to assume that nothing which is written in C will attempt to
> parse the output from "g.region -p", as it's vastly simpler to just
> use G_get_window() directly.
> 
> Some scripts may parse the output from "g.region -p", but the only one
> which I've found (3d.view.sh) looks for the strings "north", "south"
> etc rather than relying upon the order.

e.g. ps.map.barscale is using awk to get the coordinate values.
(find in the scripts/ directory within the GRASS binaries)

> One final point: while the change in question is probably accidental
> (and unnecessary),
The reason is that the current order matches the 'cycling' order in
the g.region interactive mode to set the current region (that is
N,S,W,E).

[...]

Markus Neteler



More information about the grass-user mailing list