1987-06-26 15:59:52 +00:00
|
|
|
DEFINITION MODULE Traps;
|
1988-02-19 15:54:01 +00:00
|
|
|
(*
|
|
|
|
Module: Facility for handling traps
|
|
|
|
Author: Ceriel J.H. Jacobs
|
|
|
|
Version: $Header$
|
|
|
|
*)
|
1987-06-26 15:59:52 +00:00
|
|
|
|
|
|
|
IMPORT EM;
|
|
|
|
|
1987-10-30 18:32:14 +00:00
|
|
|
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 *)
|
1987-11-09 11:36:45 +00:00
|
|
|
ERRFORLOOP = 68; (* value of FOR-loop control variable changed
|
|
|
|
in loop
|
|
|
|
*)
|
1988-03-16 09:20:36 +00:00
|
|
|
ERRCARDUVFL = 69; (* CARDINAL underflow *)
|
1988-03-18 14:23:04 +00:00
|
|
|
ERRINTERNAL = 70; (* Internal error; should not happen *)
|
1988-04-29 14:38:36 +00:00
|
|
|
ERRUNIXSIG = 71; (* received unix signal *)
|
1987-10-30 18:32:14 +00:00
|
|
|
|
1987-06-26 15:59:52 +00:00
|
|
|
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.
|
1988-04-27 18:11:33 +00:00
|
|
|
When a trap occurs, the default trap handler is re-installed before
|
|
|
|
calling the new handler.
|
1987-06-26 15:59:52 +00:00
|
|
|
*)
|
|
|
|
|
|
|
|
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.
|