Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
Conclusions


NAME

Conclusions - convert errors and events into conclusions

SYNOPSIS

VAR handlerSet: Errors.HandlerSet;
VAR errors: INTEGER; (* number of errors *)
VAR fatalcode: INTEGER; (* exit code on fatal events *)


PROCEDURE CatchEvent(type: Events.EventType; kind: Errors.Kind); PROCEDURE Conclude(object: RelatedEvents.Object; kind: Errors.Kind; text: ARRAY OF CHAR); PROCEDURE ConcludeS(s: Streams.Stream; object: RelatedEvents.Object; kind: Errors.Kind; text: ARRAY OF CHAR);

DESCRIPTION

Conclusions provides a handler set (see Errors) for error events and printing routines for object related event queues. Further, Conclusions installs an abort handler for Events which prints out the message text and calls Process.Abort.

Beside message printing following actions are being taken in dependence of the event classification:

error
Causes errors to be incremented.
fatal
Causes program termination with an exit code of fatalcode.
bug
Causes the program to be aborted.

CatchEvent installs the appropiate error handler of Conclusions for type in dependence of kind. This is equivalent to Errors.CatchEvent(handlerSet, kind, type).

ConcludeS prints the queue of events which are related to object to s in LIFO-order. ConcludeS adds the basename of the command (see UnixArguments), the classification (except for message) and text (if non-empty) to the first message. Further messages are printed in subsequent lines. "*no messages found*" is printed for empty queues. Conclude calls ConcludeS with s = Streams.stderr.

EXAMPLE

Following example demonstrates Conclude for usual situations like failed Open operation:
VAR errors: RelatedEvents.Object; s: Streams.Stream;
(* ... *)
NEW(errors); RelatedEvents.QueueEvents(errors);
IF ~UnixFiles.Open(s, filename, "r", Streams.onebuf, errors) THEN
   (* print message and terminate *)
   Conclusions.Conclude(errors, Errors.fatal, filename);
END;

SEE ALSO

Errors
general error handler interface
Process
process termination and abortion
RelatedEvents
object related events

Edited by: borchert, last change: 1996/09/16, revision: 1.5, converted to HTML: 1997/04/28

Oberon || Library || Module Index || Search Engine || Definition || Module