Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!uflorida!stat!fsu!loligo!schrader From: schrader@loligo (David F. Schrader) Newsgroups: comp.lang.pascal Subject: Re: exiting some calling ancestor in Turbo Pascal 5 Summary: Possible solution? Keywords: ExitProc TP5.0/TP5.5 Exit_Procedure(s) Chaining_Exits Message-ID: <412@fsu.scri.fsu.edu> Date: 19 Dec 89 14:08:06 GMT References: <122@crucible.UUCP> <8912141752.aa23459@ICS.UCI.EDU> <1989Dec18.132328.6049@murdoch.acc.Virginia.EDU> Sender: news@fsu.scri.fsu.edu Reply-To: schrader@loligo.UUCP (David F. Schrader) Organization: Florida State University Computing Center Lines: 53 In article <1989Dec18.132328.6049@murdoch.acc.Virginia.EDU> scl@sasha.acc.Virginia.EDU (Steve Losen) writes: > >In article <8912141752.aa23459@ICS.UCI.EDU> milne@ICS.UCI.EDU (Alastair >Milne) writes > > [description of need for multi-level "EXIT" deleted....] > >> Turbo Pascal gives only, as far as I know, EXIT (which exits the immediate >> block, but nothing further) and HALT (which kills the whole program). >> Does anybody know of a way in Turbo Pascal to obtain the effect of UCSD > > [followup note deleted...] I am not sure that I have followed the entire thread of this sequence but I believe that what you want to do is possible (at TP5.0/TP5.5 levels at least). I do not know whether this is supported before TP5.n . Check TP5.0 (and by extension TP5.5) Reference Guide Chapter 15, page 229, regarding _Exit Procedures_. TP5.0 supports an _ExitProc_ pointer which points to a procedure (w/o parameters) which is to be executed upon exit from a program (and program "unit"). By saving, replacing, and later restoring, the pointer it is possible to "chain" these _Exit Procedure_s. The _Exit Procedure_ must be compiled in _Far_ call model ({$F+}/{$F-}). The brief example that provide is: PROGRAM Testexit; VAR ExitSave : pointer; {$F+} PROCEDURE MyExit; BEGIN ExitProc := ExitSave; : END; {MyExit} {$F-) BEGIN {Main/Testexit} ExitSave := ExitProc; ExitProc := @MyExit; : END. {Main/Testexit} Note that the manuals is much more expansive in their coverage. Please read this(these) page(s) before committing yourself to this particular method as I cannot guarentee this is the solution you are seeking (particularly since I am coming in in the middle of the thread...). Hope that this helps. David F. Schrader Disclaimer : FSUCC - "No comment." ; ME - "I reserve the right to qualify what I said if necessary."