comments in r.mapcalc

Steffen Meyer steffen at longs.lance.colostate.edu
Wed Jun 22 13:54:22 EDT 1994


Thanks to David Houlder and Jill R. Schuler who suggested using C style 
comments of the form /* comment */.  
  david at dart.anu.edu.au (David Houlder)
  jschuler at ncg.scs.ag.gov
I tried a few things, and thought I would share the results, 
which are not promising. 

Refer to the illustration below performed using the tcsh in GRASS 4.1.
Notice that there are three errors, but only the first comment 
produces the a message.  If the two procedures are reversed in order, 
no message whatsoever is reported from r.mapcalc.

Using the C-style comment approach produces an error message, 
  "you have confused me"
which probably does not hurt anything, but results in some strange
behavior.

This is unattractive since real errors are now not uniquely reported,
which makes debugging a little more challenging and confuses the user 
as well as r.mapcalc use of the parser. 

Conclusion: I think we cannot use /* */ WITHOUT modification to the 
            code to support comments.

Thanks for your comments.  Any more ideas ?   Onward and upward ...

steffen at longs.lance.colostate.edu
Steffen Meyer
IDS Group, Colorado State University

----- Begin Example 1 of C style /* comment */ for GRASS r.mapcalc -----
GRASS 4.1 > more test.mapcalc
/*  comment */
foo = Elevation

/* a planned error */
foo2 = if

Mapset <steffen> in Location <sjbap>
GRASS 4.1 > !r.m
r.mapcalc < test.mapcalc
you have confused me

EXECUTING foo = ...  100%
CREATING SUPPORT FILES FOR foo
minimum value 0, maximum value 79

Mapset <steffen> in Location <sjbap>
GRASS 4.1 > 
----- End Example 1 of C style /* comment */ for GRASS r.mapcalc -----


----- Begin Example 2 of C style /* comment */ for GRASS r.mapcalc -----
GRASS 4.1 > !m
more test.mapcalc

/* a planned error */
foo2 = if()

/*  comment */
foo = Elevation

Mapset <steffen> in Location <sjbap>
GRASS 4.1 > !r
r.mapcalc < test.mapcalc

Mapset <steffen> in Location <sjbap>
GRASS 4.1 > 

----- End Example 2 of C style /* comment */ for GRASS r.mapcalc -----



More information about the grass-user mailing list