DEFINITION MODULE TrapHandler;

EXPORT QUALIFIED 
    Trap, MaxTrapCode, 
    AllocateTrap, DeAllocateTrap, CaseTrap, IndexTrap, 
    AssignTrap, ReturnTrap, HaltTrap;

CONST
    AllocateTrap = 2;   (*  Allocate failure *)
    DeAllocateTrap = 3; (*  Bad DeAllocate *)
    CaseTrap = 4;       (*  case index out of range *)
    AssignTrap = 5;     (*  subrange assignment out of range *)
    IndexTrap = 6;      (*  array index out of range *)
    ReturnTrap = 9;     (*  missing return in function *)
    HaltTrap = 10;      (*  HALT *)
    MaxTrapCode = 10;

PROCEDURE Trap(n: CARDINAL);
(*  make a call to the trap handler, with code 'n'.
*)

END TrapHandler.
