I have a file named named implementedProcedures.tcl which contain 3
procedures. The 3 procs are init, add, sub which return an error if
something is wrong.
In another tcl file called tests.tcl , I use this 3 procs many times
one after another. So basically it looks like
source implementedProcedures.tcl
init ABC
add 4 5
sub 7 9
sub 10 4
add 3 9
add 15 7
.
.
.
.
.
.
.
.
.
. Now I want to stop the excution of the script and return to the tcl
shell if any of the proc was not successful. Is there are tcl command
which can do this. I want to stop execution in a way that I cannot
even use catch to recover from the error. This mean on tcl shell when
i do
%source tests.tcl
it should stop the execution when it hits and error. and return to the
shell. Currently I used error function, but I belive one can use
catch to handle it. Any pointers would be very helpful
Thanks a lot.
Koolrans
To the best of my knowledge this is not possible and still have the catch
command available.
Of course you could just rename catch to {}.
--
+--------------------------------+---------------------------------------+
| Gerald W. Lester | "The man who fights for his ideals is |
| Gerald...@cox.net | the man who is alive." -- Cervantes |
+--------------------------------+---------------------------------------+
Which shell are you referring in the last paragraph? If you mean the
commandline from which you invoked TCL, just use `exit 1' instead of
`error' in your procs. Not a nice approach if your procs are meant to
go into a library of some kind. If you mean the TCL shell, I don't
know any other means than `error'.
| Currently I used error function, but I belive one can use catch to
| handle it.
Yes, you can catch `error'. What is the problem with that?
Remember: any function in TCL (even `exit') can be renamed and do
something completely different, so your original goal is not possible
with a always-succeed guaranty.
R'
catch is defined to always catch. So you would need to create your
own catch if you don't want it intervening.
Perhaps something like:
proc catch {args} {
eval $args
}
would work?
--
<URL: http://wiki.tcl.tk/ > MP3 ID tag repair < http://www.fixtunes.com/?C=17038 >
Even if explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
<URL: mailto:lvi...@gmail.com > <URL: http://www.purl.org/NET/lvirden/ >