Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!wuarchive!cs.utexas.edu!inebriae!crucible!al From: al@crucible.UUCP (Al Evans) Newsgroups: comp.lang.pascal Subject: Re: exiting some calling ancestor in Turbo Pascal 5 Summary: You gotta do it manually Message-ID: <122@crucible.UUCP> Date: 15 Dec 89 14:51:38 GMT References: <8912141752.aa23459@ICS.UCI.EDU> Reply-To: al@crucible.UUCP (Al Evans) Followup-To: comp.lang.pascal Organization: PowerTools, Austin, TX Lines: 49 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 > Pascal's EXIT? I wish there were. Actually, in UCSD, I think you can even exit procedures that HAVEN'T been called -- this gives interesting results. I do things as shown below, in about 60K lines of Pascal that exists under both Turbo and UCSD (don't ask:-). PROCEDURE BigBlock VAR exitFlag: BOOLEAN; PROCEDURE SubProcA; BEGIN ... {Condition requiring exit from main block found} exitFlag:= TRUE; EXIT; ... END; PROCEDURE SubProcB; BEGIN ... SubProcA; IF exitFlag THEN EXIT; ... END; BEGIN {BigBlock} exitFlag:= FALSE; ... SubProcB; IF exitFlag THEN EXIT; ... END; It ain't pretty, but it's the only way I've found to accomplish a multilevel exit under Turbo Pascal. --Al Evans-- -- Al Evans "You'd grep to know what ...uunet!execu!sequoia!crucible!al you really sed." --Referent Blob