home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!agate!sprite.Berkeley.EDU!ouster
- From: ouster@sprite.Berkeley.EDU (John Ousterhout)
- Newsgroups: comp.lang.tcl
- Subject: Re: Aborting command interpreting
- Date: 20 Nov 1992 16:45:06 GMT
- Organization: U.C. Berkeley Sprite Project
- Lines: 24
- Distribution: world
- Message-ID: <1ej4miINN35a@agate.berkeley.edu>
- References: <1992Nov19.173618.20335@novell.com>
- NNTP-Posting-Host: tyranny.berkeley.edu
-
- In article <1992Nov19.173618.20335@novell.com>, Duane Murphy <damurphy@wc.novell.com> writes:
- |> I am looking for a clean way of being able to abort the Tcl interpreter
- |> while it is interpreting a script. I have looked at CreateTrace, but
- |> there does not seem to be a way of telling the interpreter to stop
- |> interpreting. I have been able to do this by hacking Tcl_Eval, but I
- |> would like a clean way of doing this.
- |>
- |> I have thought of some cheating ways that involve using the internal
- |> structure of the interpreter and not the publish public structure.
- |>
- |> The idea is to have a clean way of aborting exceptionally long scripts or
- |> (heaven forbid) a script that has an (non-recursive) endless loop. The
- |> idea would be to force the execution of a particular command to return an
- |> error. This (usually) causes the script to stop.
- |>
- |> Any ideas, comments, suggestions?
- |>
- |> ...Duane
-
- The simplest way is to invoke "error" or write a new Tcl command in C that
- returns a code other than TCL_OK. Of course, it's possible that there could
- be "catch" commands that prevent the unwinding, but you could modify these
- to continue unwinding in the special case where you really want to unwind
- all the way.
-