[GRASS5] Re: [GRASSLIST:3781] minor update to tcltkgrass for GRASS 5.7

Hamish hamish_nospam at yahoo.com
Sun Aug 1 02:53:16 EDT 2004


> > d.barscale's GUI isn't rendering properly. When you open
> > it, the bcolor= and at= descriptors are missing, and the following 
> > error is displayed on the console:
> >
> > extra characters after close-quote
> > bad window path name ".pw.f0.frame.optwin.fra.frame.lab1"
> > invalid command name "0,0"
> > bad window path name ".pw.f0.frame.optwin.fra.frame.lab3"
> >
> > It is choking on the " character in bcolor=; if I change the module
> > to use ' instead, it works.. this will break d.text.freetype as
> > well.
> >
> > Similarly, at= breaks when it sees [], that happens in d.text too.
> >
> > It would be nice if the parser be a bit more robust to handle "[].


Ok, I think I fixed this one.


solution: in grass51/lib/gis/parser.c, replace

 ... -text \"$description\" ...
with
 ... -text {$description} ...


this text is in a sprintf() statement & the string goes into a command 
which is eventually fed through:

echo "$command" | wish &


for the archives:
To debug the tcl code, I had to add a line to parser.c just before
system(cmd);

sprintf(stdout, "%s\n", cmd);
  [perhaps this should be a if(DEBUG=3) command?]


then run

GRASS:~> d.text.freetype > dtf_tcl.txt

then edit 'dtf_tcl.txt'  to remove the "| wish &" from the end.

then '. dtf_tcl.txt > dtf.tcl' to get rid of the echo-proofing chars.

then 'wish < dtf.tcl'  to test it.


It was easiest to fiddle with dtf.tcl until it was right and then go 
back and fix parser.c to provide what was needed.



References:
"Is white space significant in Tcl"  http://wiki.tcl.tk/981
"Tcl quoting hell"  http://wiki.tcl.tk/1726
"1 minute intro to tcl"  http://www.pconline.com/~erc/tcl.htm





Next big bug is to get the Tcl menus to honour white spaces:

d.vect where="ident='foo' and location='bar'"

prints out to the stdout window with the double quotes when you click "Run",
but they get stripped before the command is run causing it to break.



Hamish




More information about the grass-dev mailing list