[GRASS5] d.legend and d.out.png

Glynn Clements glynn.clements at virgin.net
Thu Aug 19 22:37:37 EDT 2004


Hamish wrote:

> > Also, I'll use this space to note that tcltkgrass should use a
> > terminal (or, at least, an output window) when runninng d.legend with
> > the -m switch, so that the instructions can be seen.
> 
> Works for me, both 5.3 and 5.7.
> 
> Output to stderr should show up in the tcl window as you go, stdout once
> the command is finished.

The data from stdout will show up as the buffer is flushed, which will
occur if the buffer becomes full, if the application calls
fflush(stdout), or when it exits.

> (aside: possible way to test for finished process??)

Yes; if the command is run with "open {| ...} r" rather than exec,
termination will result in EOF on the returned descriptor. However, if
you wanted the data to go to the terminal, you would need to
explicitly copy it; moreover, the application's stdout stream will
then be fully-buffered rather than line-buffered, which isn't much use
for interactive applications.

Hmm; maybe we should consider using "expect" for Tcl/Tk code ("expect"
is essentially tclsh with added pty support). OTOH, that would be yet
another dependency which most users probably don't already have; I
suppose that it would be better to ensure that programs which generate
interactive output (e.g. prompts) always send it to stderr.

Some other points:

1. The "output" window should use a monospaced font (e.g. courier); a
lot of stuff doesn't work quite right with a proportional font.

2. We should probably make some attempt at processing backspace
characters (i.e. deleting the previous character). Better still would
be to recognise the G_percent() sequences and display a progress bar.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list