(**********************************************************************

    :Program.    ErrorReq.def
    :Contents.   Requesters or Messages to handle Errors, Warnings...
    :Author.     Nicolas Benezan [bne]
    :Address.    Postwiesenstr. 2, D7000 Stuttgart 60
    :Phone.      711/333679
    :Copyright.  Public Domain
    :Language.   Modula-2
    :Translator. M2Amiga AMSoft 3.2d
    :History.    V1.0 [bne] 12.Jan.1989 (extracted from MemSystem1.1)
    :History.    V1.1 [bne] 27.Jan.1989 (YesNoReq. modified, m2cV3.2)
    :History.    V1.2 [bne] 5.Feb.1989 (+ Assert)

**********************************************************************)

DEFINITION MODULE ErrorReq;

FROM SYSTEM     IMPORT ADDRESS;

CONST   CANCEL="Cancel";
        RETRY="Retry";
        ABORT="Abort";
        IGNORE="Ignore";
        CONTINUE="Continue";

TYPE    Message=ARRAY [0..32] OF CHAR;
VAR     ErrHeader:Message; (* Default: "Modula-2 Error Handler" *)
        AssertMessage:Message;      (* "Break (Assert): " *)

PROCEDURE YesNoRequest(BodyText,PositiveText,NegativeText:ADDRESS):BOOLEAN;
(*:Input.       ReqBody: Pointer to the text of the requester
  :Input.       PositiveText: Pointer to the text of the Ok-gadget
  :Input.       NegativeText: Pointer to the text of the Cancel-gadget
  :Result.      TRUE: Ok-gadget FALSE: Cancel or error
  :Semantic.    simplified Intuition.AutoRequest()
  :Note.        the new V3.2-compiler supplies Arts.Requester()
*)

PROCEDURE RecoverableExit(ReqBody,PosText,NegText:ADDRESS);
(*:Input.       ReqBody: Pointer to the Headline of the requester
  :Input.       PosText: Pointer to the text of the Ok-gadget
  :Input.       NegText: Pointer to the text of the Cancel-gadget
  :Semantic.    Displays a requester, Cancel terminates the
  :Semantic.    programm, Ok lets it continue
*)

PROCEDURE DeadEndExit(ReqBody:ADDRESS);
(*:Input.       ReqBody: Pointer to a String
  :Semantic.    Displays a Requester with ErrHeader as Headline and ReqBody
  :Semantic.    as second line. The Cancel-gadget terminates the program.
*)

PROCEDURE Assert(Condition:BOOLEAN;Text:ADDRESS);
(*:Input.       Condition to be asserted for the programm to continue
  :Input.       Text: pointer to a null terminated string
  :Semantic.    Terminates the programm if Condition is NOT TRUE.
  :Semantic.    If wbStarted, it will display a requester like Arts.Assert()
  :Semantic.    If CLI-started, it will print Text and Exit immediately
*)

PROCEDURE ExitQuiet;
(*:Semantic.    simply terminates the program (TermProcedures work
  :Semantic.    normally)  *)

END ErrorReq.

