[alt.msdos.programmer] exiting some calling ancestor in Turbo Pascal 5

milne@ICS.UCI.EDU (Alastair Milne) (12/15/89)

   Our project is moving a number of its CAI programs from UCSD Pascal (under
   the p-System, of course) to Turbo Pascal 5.0.  Though it has gone much more
   smoothly overall than one might have expected, a few hard problems keep
   coming up.  A couple have already been addressed by some people on this
   group, so I have some hope for this one:

   UCSD Pascal defines the call "EXIT(procedure-name);", where procedure-name
   must be one of the procedures currently running -- that is, it must have a
   stack-frame currently allocated somewhere up the call stack.  EXIT exits
   the local procedure and every calling procedure until it reaches and exits
   "procedure-name".  Each procedure exited first has its "termination code" 
   executed, which usually is either empty or makes sure any local files are 
   properly closed.  This means that, in exceptional situations, major chunks
   of code can be exited at the option of local routines, without actually
   halting the whole program.

   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
   Pascal's EXIT?


   Alastair Milne,
   Programming Manager,
   Educational Techology Center

tris@alzabo.uucp (Tris Orendorff) (12/19/89)

milne@ICS.UCI.EDU (Alastair Milne) writes:



>   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
>   Pascal's EXIT?

	This Month's issue of PC Magazine (V8, Number 22) has an
implementation of setjmp() and longjmp () for Turbo Pascal on page 298. 
	This should do the trick.


-- 
				Sincerely Yours
				Tris Orendorff
				tris@alzabo.uucp
-----------------------------------------------------------------------