[GRASS-dev] problem with r.colors on Mac

Michael Barton michael.barton at asu.edu
Tue Apr 17 23:11:48 EDT 2007


Glynn,

I tried the code below. I still get crashing with both versions if I run
r.colors -e. If I run r.colors without -e, it runs fine. I tracked $lines
after the following clause...

 while {[gets $fh line] >= 0} {
    lappend lines $line
 }

... and got the results below.

RESULTS

GRASS 6.3.cvs (spearfish60_test):~ > lines={} {GRASS_INFO_MESSAGE(5017,1):
Reading elevation_delete ...} GRASS_INFO_END(5017,1) {} {GRASS_INFO_PERCENT:
0} {GRASS_INFO_PERCENT: 3}
lines={GRASS_INFO_PERCENT: 6} {GRASS_INFO_PERCENT: 9}
lines={GRASS_INFO_PERCENT: 12} {GRASS_INFO_PERCENT: 15} {GRASS_INFO_PERCENT:
18} {GRASS_INFO_PERCENT: 21} {GRASS_INFO_PERCENT: 24} {GRASS_INFO_PERCENT:
27} {GRASS_INFO_PERCENT: 30} {GRASS_INFO_PERCENT: 33} {GRASS_INFO_PERCENT:
36} {GRASS_INFO_PERCENT: 39} {GRASS_INFO_PERCENT: 42} {GRASS_INFO_PERCENT:
45} {GRASS_INFO_PERCENT: 48} {GRASS_INFO_PERCENT: 51} {GRASS_INFO_PERCENT:
54} {GRASS_INFO_PERCENT: 57} {GRASS_INFO_PERCENT: 60} {GRASS_INFO_PERCENT:
63}
lines={GRASS_INFO_PERCENT: 66}
lines={GRASS_INFO_PERCENT: 69}
lines={GRASS_INFO_PERCENT: 72}
lines={GRASS_INFO_PERCENT: 75}
lines={GRASS_INFO_PERCENT: 78}
lines={GRASS_INFO_PERCENT: 81}
lines={GRASS_INFO_PERCENT: 84} {GRASS_INFO_PERCENT: 87}
lines={GRASS_INFO_PERCENT: 90}
lines={GRASS_INFO_PERCENT: 93}
lines={GRASS_INFO_PERCENT: 96}
lines={GRASS_INFO_PERCENT: 99}
lines={GRASS_INFO_PERCENT: 100}
lines={} {GRASS_INFO_MESSAGE(5017,2): Color table for [elevation_delete] set
to elevation} GRASS_INFO_END(5017,2)

Nothing seems wrong here. If I run r.colors without -e, I simply get the
last line returned. Maybe the problem is in the progress bar routine itself.

Michael



On 4/17/07 12:09 PM, "Glynn Clements" <glynn at gclements.plus.com> wrote:

> 
> No, get rid of the "read" call. E.g. (untested):
> 
> proc Gronsole::readout {path ci mark fh} {
> 
> set lines {}
> 
> while {[gets $fh line] >= 0} {
> lappend lines $line
> }
> 
> if {[length $lines] != 0} {
> Gronsole::add_data_tag $path $ci out
> }
> 
> foreach line [lrange $lines 0 [expr [llength $lines] - 2]] {
> Gronsole::output_to_gronsole $path $mark $ci [list cmd$ci cmd$ci-out]
> "$line\n"
> }
> set last [lindex $lines end]
> if {$last != {}} {
> Gronsole::output_to_gronsole $path $mark $ci [list cmd$ci cmd$ci-out] $last
> }
> $path.text see $mark
> }
> 
> Although, I'm not entirely sure why it's necessary to omit the newline
> from the last entry; maybe that was due to the use of "read". Try:
> 
> proc Gronsole::readout {path ci mark fh} {
> 
> set lines {}
> 
> while {[gets $fh line] >= 0} {
> lappend lines $line
> }
> 
> if {[length $lines] != 0} {
> Gronsole::add_data_tag $path $ci out
> }
> 
> foreach line $lines {
> Gronsole::output_to_gronsole $path $mark $ci [list cmd$ci cmd$ci-out]
> "$line\n"
> }
> 
> $path.text see $mark
> }

__________________________________________
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





More information about the grass-dev mailing list