[GRASS5] More Mac OS X Tcltkgrass Tweaks

Jeshua Lacock jeshua at openosx.com
Mon Apr 28 02:55:55 EDT 2003


On Sunday, April 27, 2003, at 01:51 PM, Glynn Clements wrote:

>
> Jeshua Lacock wrote:
>
>> At this point, I propose that a new configure switch is added for
>> enabling the native Mac OS X version of the Tcl/Tk interface (some
>> folks on Mac OS X may want to use the traditional *nix version of the
>> interface and those using Darwin without the Aqua interface). Then the
>> set of Mac OS X patches could be applied at configure time and the
>> auxiliary Mac OS X support programs could be built. I would be happy 
>> to
>> do most of the work and be responsible for it's maintenance. Any
>> thoughts/comments?
>
> I would rather this was determined at run time.
>
> Most of the things that configure is used for are compile-time issues.
> However, Tcl/Tk is interpreted, so there isn't a "compile time".

Well there are some Carbon C programs that I have written, currently: 
"launchURL" and "wishToFront"; which do require compiling (and a couple 
shell scripts which do not need compiling). They could be pre-compiled, 
however that seems to defeat the purpose distributing source code. I 
guess the Mac OS X specific binaries could be built on any detected 
Darwin build, and the Tcltkgrass changes could be determined at runtime.

> IOW, tcltkgrass should be doing something like:
>
> 	if $use_aqua {
> 	      set html(netscape) "/usr/local/bin/launchURL"
> 		...
> 	} {
> 	      set html(netscape) "netscape"
> 		...
> 	}

Cool, that seems better to me, however it seems it would impart a small 
performance penalty for all the platforms. But, I would be happy to do 
whatever you recommend and It would be ideal to switch between the UNIX 
and aqua versions at runtime.

> Actually, the choice of browser should be more general; it should be
> possible to use something other than netscape on other platforms.

Sure, like I stated that is the case with the Mac OS X solution.

Can't the user can change the netscape option via 
"Config->Options->Configure"?

>> Also, I am trying to eliminate the Mac OS X "console1" bug. and the
>> following line in gui.tcl is the culprit:
>>
>>      set name "| $name 2>@ stdout"
>>
>> If I try to reproduce the problem in a new wish file, everything 
>> works.
>> Since I can't reproduce the problem outside of Grass, it seems to me
>> that something in the Tcl scripts must be breaking stdout (which very
>> well could be a wish bug). It is really odd because the problem only
>> occurs when the GUI is launched from Init.sh and not when tcltkgrass 
>> is
>> launched manually from the Grass terminal. Any ideas? I would be
>> willing to pay for some help. I was preparing a post for the MacTcl
>> mail list, but I stopped short of posting it when I was not able to
>> reproduce the error in a blank wish shell.
>
> The fact that it only occurs when tcltkgrass is launched from Init.sh
> suggests a Mac issue. Have you tried this with a test case? I.e.
> running a simple Tcl/Tk script which uses "open | ... 2>@ stdout" from
> a shell script. Does it matter whether the script is run in the
> background?

When I run the following wish script manually from a terminal window:

     #!/bin/wish
     puts stdout "fooMAR"

fooMAR appears in the terminal.

When I add the same line to gui.tcl, right where the "set name... >@ 
stdout" offending line:
     puts stdout "fooMAR"

fooMAR will not appear when launched from Init.sh and the console1 
error appears, but does functions normally and without error when I 
launch the GUI manually from the Terminal.

I also tried:
     open | d.rast map=spot.comp < /dev/null 2>@ stdout r

And, it seems as if the syntax is not quite right. To be honest, I am 
not entirely sure what the syntax should look like. It seems the pipe 
should not be there. Does that look right?

Also, I am able to successfully run in a test file:
    open ~/.tcltkgrass r

But, if in the same test file I instead try;
     open ~/.tcltkgrass < /dev/null 2>@ stdout r

I get there error:
     Error in startup script: wrong # args: should be "open fileName 
?access? ?permissions?"
         while executing
     "open ~/.tcltkgrass < /dev/null 2>@ stdout r"
         (file "wishTest.tcl" line 4)


Thanks,

Jeshua Lacock __________________________
Programmer/Owner            Phone:   760.935.4736
http://OpenOSX.com           Fax:        760.935.4845
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_




More information about the grass-dev mailing list