Download AMOS AlphaPascal
Transcript
Page 141S SYSTEMS FUNCTIONS AND PROCEDURES exception of a ControHC followed by a command to resume, Thus the ERRORTRAP procedures themseLves have aborted to AMOS in most circtsnstances, In addition STDERRORTRAP resets INFOP',XEOERR 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, AiphaPascal assumes it is executing an error handler whenever XEQERR is nonzero, If an error does occur within an error handier, 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 error handling is finished and further errors are again acceptable, Should you that decide not to call STDERRORTRAP at all, please keep in mind the following points: 1, The only errors from which you may safely resume execution are S (a ControHC) and 10 (I/O error), An attempt to resume execution by returning from ERRORTRAP with any other errors will probably crash the system, 2, It is acceptable to use EXIT to abort some function or procedure, or 7our 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, 3. Remember to set XEOERR otherwise your next back error to will zero before leaving ERRORTRAP, to AMOS without calling abort ER RO PT P A P 14,10,3 XERRORTRAP When STDERRORTRAP is called by entering a Control"C, it is possible to request a backtrace of suspended functions and procedures This backtrace begins with the caller of the caller of STDERRORTRAP, which is usually the caller of ERRORTRAP, and hence the routine which was suspended Thus, should STDERRORTRAP be called by a function or procedure local to your ERRORTRAP procedure, the backtrace will begin in the wrong place, he corrected by using XERRORTRAP, which takes a copy of the as its argument, It is used as follows: (changed 30 April 1981) system This can INFOPEC