home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / tcl / 1906 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  1.6 KB

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