[GRASSLIST:4464] Re: fixes for recent problems in tcltkgrass for GRASS 5.3
Glynn Clements
glynn.clements at virgin.net
Mon Oct 4 16:56:45 EDT 2004
Glynn Clements wrote:
> > Due to changes in the GRASS input parsing system, a few tcltkgrass commands
> > no longer worked correctly. I *think* (and hope) that I found all the few
> > instances and have fixed them. I just committed these fixes to the CVS.
>
> The problems relate to changes in tcltkgrass, not libgis.
More precisely, I suspect that it's due to this change to gui.tcl:
revision 1.21
date: 2004/08/04 00:55:26; author: hamish; state: Exp; lines: +3 -3
fix text entries with whitespaces in Tcl menus
Specifically, this part:
@@ -727,7 +727,7 @@
switch [$path cget -text] {
Run {
if {$button == 1} {
- set name [eval concat $cmd]
+ set name [concat $cmd]
set see [expr {[lindex $cmd 0] == "g.manual"} ? 0 : -1]
} elseif {$button == 2} {
set name "g.manual [lindex $root 0]"
Using "eval concat $cmd" would split list items into multiple words,
while "concat $cmd" will preserve boundaries.
% set cmd "foo bar {baz baz}"
% foreach word $cmd {puts $word}
foo
bar
baz baz
% set name [eval concat $cmd]
% foreach word $name {puts $word}
foo
bar
baz
baz
% set name [concat $cmd]
% foreach word $name {puts $word}
foo
bar
baz baz
Actually, the existing version is equivalent to just "set name $cmd".
% set name $cmd
% foreach word $name {puts $word}
foo
bar
baz baz
The change causes it to correctly interpret arguments which contain
spaces but, as a side-effect, it doesn't handle commands which contain
spaces.
It should probably be:
set prog [lindex $cmd 0]
set args [lrange $cmd 1 end]
set name [eval concat $prog [list $args]]
This will split the command but not the arguments.
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-user
mailing list