ack/lang/m2/libm2/Traps.def
1988-04-29 14:38:36 +00:00

40 lines
1.1 KiB
Modula-2

DEFINITION MODULE Traps;
(*
Module: Facility for handling traps
Author: Ceriel J.H. Jacobs
Version: $Header$
*)
IMPORT EM;
CONST
ERRTOOLARGE = 64; (* stack size of process too large *)
ERRTOOMANY = 65; (* too many nested traps + handlers *)
ERRNORESULT = 66; (* no RETURN from function procedure *)
ERRCARDOVFL = 67; (* CARDINAL overflow *)
ERRFORLOOP = 68; (* value of FOR-loop control variable changed
in loop
*)
ERRCARDUVFL = 69; (* CARDINAL underflow *)
ERRINTERNAL = 70; (* Internal error; should not happen *)
ERRUNIXSIG = 71; (* received unix signal *)
TYPE TrapHandler = EM.TrapHandler;
PROCEDURE InstallTrapHandler(t: TrapHandler): TrapHandler;
(* Install a new trap handler, and return the previous one.
Parameter of trap handler is the trap number.
When a trap occurs, the default trap handler is re-installed before
calling the new handler.
*)
PROCEDURE Message(str: ARRAY OF CHAR);
(* Write message "str" on standard error, preceeded by filename and
linenumber if possible
*)
PROCEDURE Trap(n: INTEGER);
(* cause trap number "n" to occur *)
END Traps.