(* Library module defined by the International Standard Information technology - programming languages BS ISO/IEC 10514-1:1996E Part 1: Modula-2, Base Language. Copyright ISO/IEC (International Organization for Standardization and International Electrotechnical Commission) 1996-2021. It may be freely copied for the purpose of implementation (see page 707 of the Information technology - Programming languages Part 1: Modula-2, Base Language. BS ISO/IEC 10514-1:1996). *) DEFINITION MODULE EXCEPTIONS; (* Provides facilities for raising user exceptions and for making enquiries concerning the current execution state. *) TYPE ExceptionSource; (* values of this type are used within library modules to identify the source of raised exceptions *) ExceptionNumber = CARDINAL; PROCEDURE AllocateSource(VAR newSource: ExceptionSource); (* Allocates a unique value of type ExceptionSource *) PROCEDURE RAISE (source: ExceptionSource; number: ExceptionNumber; message: ARRAY OF CHAR) <* noreturn *> ; (* Associates the given values of source, number and message with the current context and raises an exception. *) PROCEDURE CurrentNumber (source: ExceptionSource): ExceptionNumber; (* If the current coroutine is in the exceptional execution state because of the raising of an exception from source, returns the corresponding number, and otherwise raises an exception. *) PROCEDURE GetMessage (VAR text: ARRAY OF CHAR); (* If the current coroutine is in the exceptional execution state, returns the possibly truncated string associated with the current context. Otherwise, in normal execution state, returns the empty string. *) PROCEDURE IsCurrentSource (source: ExceptionSource): BOOLEAN; (* If the current coroutine is in the exceptional execution state because of the raising of an exception from source, returns TRUE, and otherwise returns FALSE. *) PROCEDURE IsExceptionalExecution (): BOOLEAN; (* If the current coroutine is in the exceptional execution state because of the raising of an exception, returns TRUE, and otherwise returns FALSE. *) END EXCEPTIONS.