[GRASS-dev] problem with r.colors on Mac
Michael Barton
michael.barton at asu.edu
Tue Apr 17 23:18:48 EDT 2007
It's the progress bar.
If I comment out the following lines in Gronsole::output_to_gronsole, it
stops crashing. It's something about one of the two lines that execute after
progress reaches 100%.
# } elseif { [regexp -- {^GRASS_INFO_PERCENT: (.+)$} $str match val
rest] } {
# Gronsole::progress $path $ci $val
# if { $val >= 100 } {
# Gronsole::progress $path $ci -1
# $outtext insert $mark "\n" $tags
# }
Michael
On 4/17/07 12:09 PM, "Glynn Clements" <glynn at gclements.plus.com> wrote:
>
> Michael Barton wrote:
>
>>>> # here I changed all the above code to use gets and read line by line
>>>> rather
>>>> than create line by line output with split
>>>>
>>>> while {[gets $fh line] >= 0} {
>>>
>>> This test will never be true; the preceding "read" will have consumed
>>> all available data, leaving none for the "gets".
>>
>> On 4/17/07 8:35 AM, "Glynn Clements" <glynn at gclements.plus.com> wrote:
>>
>>>> if {[string length $str] != 0} {
>>>> Gronsole::add_data_tag $path $ci out
>>>> }
>>
>> So do I just get rid of this if clause?
>
> 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