[GRASS-dev] debugging nviz with TclTk 8.5 aqua
Glynn Clements
glynn at gclements.plus.com
Sun Jul 27 09:49:10 EDT 2008
Michael Barton wrote:
> There are tcl and tk directories in in %GISBASE/lib, along with
> libtcl8.4.dylib and libtk8.4.dylib. There are also some tcltk *.h
> files in $GISBASE/include. AFAICT, these are complete unused at least
> on my Mac. I can throw them away with no effect, regardless of whether
> I switch to wish 8.5 aqua or 8.4 x11. Are these used by any other
> system? While my aqua version of TclTk 8.5 is visible to my system,
> 8.4 for x11 is hidden away in /usr/local/tcltk and not in my path--in
> GRASS or outside of it. So I don't see how GRASS can find any files in
> that directory.
The Tcl/Tk lib directories are normally hard-coded into the libraries.
However, this can be overriden by the TCL_LIBRARY and TK_LIBRARY
environment variables.
Anything which uses the libraries needs those directories, but there's
a good chance that a bundled wish will actually use the system's
directories rather than the bundled directories (unless the startup is
explictly setting TCL_LIBRARY and TK_LIBRARY).
> In sum, the GRASS TclTk GUI seems to ONLY need wish of one flavor or
> another to run. So all that is needed is to include all 3 wish
> versions, default to one and have a Mac script that will let the user
> change to another one if desired. This is easy for all of GRASS except
> NVIZ.
v.digit and the form library used by e.g. d.what.vect have the same
issues as NVIZ.
> NVIZ seems to use its own version of wish that must be coded into a C
> module somewhere. I certainly can't find it. But must be finding wish
> somewhere. If that path could be redirected to whatever GRASS_WISH is,
> then both GRASS and NVIZ could be in sync. The only fly in this
> ointment would be if Togl must have the same version of wish available
> (somewhere) that it was compiled against AND needs other TclTk files
> in addition to wish.
NVIZ (etc) don't need (and can't use) wish. wish is just a trivial
wrapper around the Tcl/Tk libraries; you should find it's source code
as tkAppInit.c in the tk lib directory. All of the Tcl/Tk
functionality is in the libraries.
You will see similar code in visualization/nviz/src/nvizAppInit.c;
similarly, in lib/form/form.c and vector/v.digit/main.c.
A hybrid Tcl/Tk+C application is essentially a custom version of wish,
which adds some new commands during the startup phase. So, the "wish"
that NVIZ uses is $GISBASE/etc/nviz2.2/nviz. It can't use a standard
wish, as that won't have any of the NVIZ-specific commands which NVIZ'
Tcl/Tk scripts use.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list