(*======================================================================*)
(*              Oberon Compiler support routines -- Errors              *)
(*======================================================================*)
(*  Version:  1.00              Author:   Dennis Brueni                 *)
(*  Date:     04-29-91          Changes:  Original                      *)
(*======================================================================*)
(*  This module contains all the error messages which can be reported   *)
(*  due to problems discovered by the compiler while compiling source.  *)
(*======================================================================*)

DEFINITION MODULE Err;

(*----------------------------------------------------------------------*)
(*  An enumerated type for all error message names.                     *)
(*----------------------------------------------------------------------*)

TYPE Names = (  TokTooLong, StrNotEnded, ComNotEnded, IFail,
                MissStr, MissMacRP, MissMacArg, IDNotMacro,
                BadPPStmt, FlagReDefined, FlagUnDefined,
                DefXPctdID, UnDefXPctdID, UnBalParens, IllFactor,
                MissAtElse, MissAtEnd, MissThen, MissIfEnd,
                MacXPctdID, TooMany, ArgNotEnded, MacNotEnded
             );
               
CONST IOError    = 05;          (* fatal error return codes *)
      NoMemory   = 10;
      Errors     = 15;
      BadParams  = 20;

(*----------------------------------------------------------------------*)
(* MESSAGE      Handles the print and formatting of all those friendly  *)
(*              error messages we all so like getting.                  *)
(*----------------------------------------------------------------------*)

PROCEDURE Message(Err: Names);

(*----------------------------------------------------------------------*)
(* FATAL        Handles Fatal errors, which there is no return from.    *)
(*              Sets the CLI-Return code appropriately if possible.     *)
(*              There's no returning from this one.                     *)
(*----------------------------------------------------------------------*)

PROCEDURE Fatal(Err: INTEGER);

(*----------------------------------------------------------------------*)
(*  How many errors were there?                                         *)
(*----------------------------------------------------------------------*)

VAR ErrorCount: CARDINAL;
    LineNum:    CARDINAL;

(*----------------------------------------------------------------------*)
(* LASTMESSAGE  Reports how many errors there were reported.            *)
(*----------------------------------------------------------------------*)

PROCEDURE LastMessage;

END Err.