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

Glynn Clements glynn.clements at virgin.net
Wed Aug 4 03:58:24 EDT 2004


Glynn Clements wrote:

> If you're planning on doing more work on this, you could probably save
> yourself (and anyone else who works on it) some work by:
> 
> 1. Eliminating the use of the shell and "echo", by using popen()
> instead of system(). Then, whatever you write to the FILE* is sent
> directly to wish's stdin, without any processing. Apart from avoiding
> the processing, it also means that you can send it a bit at a time
> with fprintf/fputs; you don't need to buffer the whole thing in
> memory.
> 
> 2. Moving all of the boilerplate into a prologue which defines
> procedures. Then, G_gui() just needs to send e.g.
> "source $env(GISBASE)/etc/prolog.tcl" at the start, and you only need
> to generate the bits which will actually change between calls. Also,
> the bulk text which is moved into the prologue wouldn't need to be
> encoded as C string literals.

FWIW, I've just done this. Well, I've only partially done #2; the
totally-boilerplate stuff has been moved into the prologue
(lib/gis/gui.tcl), but some of the mostly-boilerplate stuff is still
in G_gui().

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




More information about the grass-dev mailing list