Is there another way? What do you do in this situation?
Glad for any hints or ideas.
Helmut
Agreed.
> Is there another way? What do you do in this situation?
You could always create a new procedure to set the global variable(s)
and source the file e.g.
#--------------
# file: argv.tcl
set script [file join [pwd] [info script]]
puts "source '$script'"
puts "argv0='$::argv0'"
puts "argv ='$::argv'"
puts "argc ='[llength $::argv]'"
#--------------
#--------------
# file: src.tcl
proc src {file args} {
set argv $::argv
set ::argv $args
uplevel #0 source $file
set ::argv $argv
}
puts "argv0='$argv0'"
puts "argv ='$argv'"
puts "argc ='[llength $argv]'"
src argv.tcl abc def ghi jkl
puts "argv0='$argv0'"
puts "argv ='$argv'"
puts "argc ='[llength $argv]'"
#--------------
Then run:
> tclsh src.tcl qwe rty
argv0='src.tcl'
argv ='qwe rty'
argc ='2'
source '/local/home/msaye/dev/tmp/argv.tcl'
argv0='src.tcl'
argv ='abc def ghi jkl'
argc ='4'
argv0='src.tcl'
argv ='qwe rty'
argc ='2'
Don't know if this helps any ... ;-}
Mark /
--
Mark G. Saye
mark...@yahoo.com
>You could always create a new procedure to set the global variable(s)
>and source the file e.g.
>
Hi Mark,
that's a nice idea, I like it. Thanks for sharing it.
Helmut
PS: After looking at it for a while, I liked it even more. Only a
couple of lines to add missing functionality - just the Tcl way.
Now if I could only come up with this kind of thing myself ...
a simple way to change things quickly (RAD: rapid application
development) is to paste commands, procs or even classes using either
the X selection (Un*x) or Edit-Paste (in Tcl's Windows console).
We're using a special debug-loglevel in our apps to open a console
window for investigations and maintenance. IMHO, one of Tcl's charming
features is changing functionality/implementation details during the
runtime of an application.
Regards,
Christian.
--
CSK Software AG
Christian Brunner | Tel: +49 69 50952-234
Holzhausenstrasse 44 | Fax: +49 69 50952-299
D-60322 Frankfurt/Main | cbru...@csksoftware.com
The thing I always worry about in situations like this is that someone
will make a change to the running code and forget/neglect/intentionally not
make the same change to the source code. As soon as the power cycles,
a cpu board has to be replaced, whatever you no longer are running the
same image...
--
"I know of vanishingly few people ... who choose to use ksh." "I'm a minority!"
<URL: mailto:lvi...@cas.org> <URL: http://www.purl.org/NET/lvirden/>
Even if explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.