Download AMOS AlphaPascal
Transcript
SYSTEMS FUNCTtONS AND PROCEDURES Page 14—15 exception of a Control—C followed by a command to resume, Thus the ERRORTRAP procedures themselves have aborted to AMOS In most circumstances. In addition1 STDERRORTRAP resets INFOP .XEQERR to zero before returning if execution is to be resumed. This is because, errors MUST NOT occur in the error handler itself for obvious reasons. AtphaPascal assumes it is executing an error handler whenever XEQERR is nonzero. If an occur does occur within an error handler, the message ?Attempt to call ERRORTRAP while in ERRORTRAP is displayed, a direct abort to AMOS is made without closing any open files. Thus, by reseting XEQERR to zero, STDERRORTRAP signals to AlphaPascal that error handling is finished and further errors are again acceptable. Should you decide not to call STDERRORTRAP at all, please keep in mind the following points: 1. 2. The only errors from which you may safely resume execution are B (a Control—C) and 10 (I/O error). An attempt to resume execution by returning from ERRORTRAP with any other errors will probably crash the system. It is acceptable to use EXIT to abort some function or procedure, your program, when any error occurs. Of course you can only EXIT to leave a function or procedure which is currently active, so you will probably want to have around some BOOLEAN variables to keep track of whether or not you are currently within routines which you might wish to EXIT from ERRORTRAP. or 3. 14.10.3 Remember to set XEQERR back otherwise your next error ERRORTRAP. to zero before leaving ERRORTRAP, AMOS without calling abort to wilt XERRORTRAP possible to When STDERRORTRAP is called by entering a Control—C, it is request a backtrace of suspended functions and procedures. This backtrace begins with the caller of the caller of STDERRORTRAP, which is usually the Thus, caller of ERRORTRAP, and hence the routine which was suspended. should STDERRORTRAP be called by a function or procedure local to your This can ERRORTRAP procedure, the backtrace wilt begin in the wrong place. INFOREC system be corrected by using XERRORTRAP, which takes a copy of the as its argument. It is used as follows: