Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!clyde.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!usc!wuarchive!hsdndev!cmcl2!adm!news From: CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) Newsgroups: comp.lang.pascal Subject: Re:IMPLEMENT GOTO ACROSS MODULES IN TURBO PASCAL?? Message-ID: <25407@adm.brl.mil> Date: 7 Jan 91 11:08:01 GMT Sender: news@adm.brl.mil Lines: 66 In article <11656@j.cc.purdue.edu>, zhou@brazil.psych.purdue.edu (Albert Zhou) wrote: >In article <25404@adm.brl.mil> CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl > Brendel) writes: >>In article <11647@j.cc.purdue.edu>, zhou@brazil.psych.purdue.edu >> (Albert Zhou) wrote: >> >>Try reworking your repeat statement so that each statement 1..n has >>an associated value. Set that value in the subroutine(s). The loop >>would look something like: >> >>var >> flag_val : byte; >>... >> flag_val := 0; >> repeat >> if flag_val <= 1 then statement1; >> if flag_val <= 2 then statement2; >> ... >> if flag_val <= n then statementn; >> flag_val := 0; >> until whatever; >> >>(Note that appropriate manipulation of flag_val allows statementI to >>cause a skip of a range of following statements I+1..n.) > >However, this only works when the error arises at the second level of the >structure (suppose the repeat-until statement is at the first level). If [...remainder deleted...] Well, Albert, that isn't what your first posting asked about, although it apparently is what you _meant_ for it to ask about. Now you need a "long jump" capability, which you will find in a number of toolbox collections, including (of course) TurboPower's Turbo Professional and Object Professional. Your code would then look something like this: var ejr : JumpRecord; {global} flag_val : byte; {global} ... flag_val := 0; SetLongJump(ejr); repeat if flag_val <= 1 then statement1; if flag_val <= 2 then statement2; ... if flag_val <= n then statementn; flag_val := 0; until whatever; Then to return to the top of the loop, a routine would do LongJump(ejr);, setting flag_val as/if appropriate. (Note that ejr and flag_val need to be declared where they are visible to all appropriate units.) +--------------------------------------------------------------------+ | Karl Brendel Centers for Disease Control | | Internet: CDCKAB@EMUVM1.BITNET Epidemiology Program Office | | Bitnet: CDCKAB@EMUVM1 Atlanta, GA, USA | | Home of Epi Info 5.0 | +--------------------------------------------------------------------+