[GRASS-dev] displaying (slightly) broken raster maps in gis.m

Michael Barton michael.barton at asu.edu
Sat Jul 15 20:40:59 EDT 2006


OK. Then I think I've got it done. I'll commit it next week.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton



> From: Glynn Clements <glynn at gclements.plus.com>
> Date: Sun, 16 Jul 2006 01:20:40 +0100
> To: Michael Barton <michael.barton at asu.edu>
> Cc: Hamish <hamish_nospam at yahoo.com>, grass5 <grass-dev at grass.itc.it>
> Subject: Re: [GRASS-dev] displaying (slightly) broken raster maps in gis.m
> 
> 
> Michael Barton wrote:
> 
>> I've removed all extraneous 'eval exec' syntax from gism I think, with the
>> exception of the procedures in runandoutput.tcl (attached here for
>> convenience because it's small). If I try to clean up the run and runcmd
>> procedures here, d.mon bombs in the gism startup. I don't know whether it is
>> due to writing to /dev/null or because of d.mon. Could you take a look and
>> offer any suggestions? Thanks.
> 
> proc run {cmd args} {
> # This and runcmd are being used to run command in the background
> # These used to go to stdout and stderr
> # but we don't want to pollute that console.
> # eval exec -- $cmd $args >@ stdout 2>@ stderr
> eval exec -- $cmd $args >& /dev/null
> }
> 
> proc runcmd {cmd args} {
> global gronsole
> 
> set ci [$gronsole annotate $cmd [list gism running]]
> 
> eval run $cmd $args
> 
> $gronsole remove_tag $ci running 
> }
> 
> Cases like this, where the arguments are passed as single list, have
> to use eval, as exec expects each command-line argument to be a
> separate argument. If you removed the eval, it would pass the entire
> argument list as a single argument, which won't work.
> 
> This isn't a problem, as the "args" syntax (where a procedure's last
> parameter is named "args") is guaranteed to construct the list
> correctly.
> 
> The main point is to apply the same principles to run/runcmd as to
> exec, i.e. either pass individual arguments or, if you need to use
> e.g. "eval runcmd $cmd $args", ensure that the argument list is
> constructed using list operations rather than string concatenation.
> 
> -- 
> Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list