Library std

DEFINITION stdTrap;
(*Customization of trap handler

The trap handler is called if any of the following exceptions occur:

	1 = destination array too short for assignment
	2 = array index out of bounds
	3 = nil pointer dereference
	4 = nil procedure variable call
	5 = source in assignment is not an extension of target
	6 = type guard failure
	7 = unmatched expression in case statement
	8 = assertion failure
*)

	TYPE
		Handler = PROCEDURE (exception: INTEGER; file: ARRAY OF CHAR; line: INTEGER);
(*trap handler signature, where `exception' is the exception code, and `file' and `line' is the location in the source where the exception occurred*)

	VAR
		handle: Handler; (*current trap handler*)

	PROCEDURE SetHandler(h: Handler);
(*sets the trap handler to h, which must not be NIL.*)

END stdTrap.