Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker!ira.uka.de!smurf!urlichs From: urlichs@smurf.sub.org (Matthias Urlichs) Newsgroups: comp.sys.mac.programmer Subject: Re: Breaking out of a series of routines Message-ID: <5[-ge2.-n@smurf.sub.org> Date: 10 Jul 90 17:32:21 GMT References: <25526@cs.yale.edu> <5252@plains.UUCP> Organization: University of Karlsruhe, FRG Lines: 24 In comp.sys.mac.programmer, article <5252@plains.UUCP>, puklich@plains.UUCP (Blayne Puklich) writes: < tarr-michael@CS.Yale.EDU (michael tarr) wrote in article Breaking out of a < series of routines: < >On an error condition I wish to immediately stop processing a large file < >and break out of about 10 routines that have been calling each other and < >return to my main event loop. Is there any way to do this without < >passing and error flag to each of the calling routines? < < You can use the setjmp() and longjmp() pair of functions to do this, assuming < you're using C. I'm not very familiar with these, but with a bit of < experimentation and manual reading, you should be able to figure out how < to use these functions. < Using the Signal mechanism (as in MacApp / TechNote 88 / SampleCode XX (I don't remember right now) works for both C and Pascal, and you can intercept it in one of the 8 intermediate routines if you have to do some postprocessing if an error occurs (closing/deleting files, deallocating memory, whatever). I use it in all my programs -- works great. -- Matthias Urlichs -- urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de Humboldtstrasse 7 - 7500 Karlsruhe 1 - FRG -- +49+721+621127(Voice)/621227(PEP)