Re: source question
From: Bob Techentin (techentin.robert_at_mayo.edu)
Date: 01/05/05
- Next message: KRF: "Re: source question"
- Previous message: Bob Techentin: "Re: Choosing a mega-widget set..."
- In reply to: Vespasian: "Re: source question"
- Next in thread: KRF: "Re: source question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 5 Jan 2005 07:34:14 -0600
"Vespasian" <julie.spicer@verizon.net> wrote
> How about without using the return? I can get the script name that
is
> currently executing using the 'info script' command. Once I have
that,
> I want to be able to kill the script that is currently executing at
> any point during the execution of that script.
>
> >> If you source in file (i.e. source filename), is there a way to
cancel
> >> out of the currently executing sourced file?
I think you might mean something like this:
main.tcl
--------
... some main commands
source filea.tcl
... more main commands
filea.tcl
--------
... some filea commands
source fileb.tcl
... more filea commands
And while you are executing fileb.tcl, some condition should stop
executing commands in fileb.tcl, and stop executing commands in
filea.tcl, so that "more filea commands" does not execute. But you
might want to continue the main program execution with "more main
commands."
If that is what you want to do, then of course you can do it. Just
call [error] in fileb.tcl, and it will unwind the program stack all
the way to the top. If you want to catch an error, then use "catch
{source filea.tcl}" in main.tcl, and you can continue with your main
program.
But that is a rather strange thing to do. A better style is to use
[source filename] mostly just to define procedures. Just put proc
definitions in your source files. Then leave the conditional
execution up to regular coding. Returning from or generating errors
while sourcing just isn't a Good Thing (tm).
Bob
-- Bob Techentin techentin.robert@NOSPAMmayo.edu Mayo Foundation (507) 538-5495 200 First St. SW FAX (507) 284-9171 Rochester MN, 55901 USA http://www.mayo.edu/sppdg/
- Next message: KRF: "Re: source question"
- Previous message: Bob Techentin: "Re: Choosing a mega-widget set..."
- In reply to: Vespasian: "Re: source question"
- Next in thread: KRF: "Re: source question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|