Oberon || Library || Module Index || Search Engine || Definition || Module
CONST textlen = 512; CONST ncodes = 152; (* number of error codes *)
TYPE Name = ARRAY 20 OF CHAR; TYPE Event = POINTER TO EventRec; TYPE EventRec = RECORD (Events.EventRec) errno: INTEGER; syscall: INTEGER; (* number of system call *) text: ARRAY textlen OF CHAR; END;
VAR message: ARRAY ncodes OF Events.Message; VAR name: ARRAY ncodes OF Name; VAR syserrors: Events.EventType; VAR syserror: ARRAY ncodes OF Events.EventType;
PROCEDURE Raise(errors: RelatedEvents.Object; errno, syscall: INTEGER; text: ARRAY OF CHAR);
#define ENOENT 2 /* No such file or directory */is converted to
CONST noent = 2;and name[noent] equals "ENOENT" and message[noent] contains "No such file or directory".
Raise raises the system event syserror[errno] and syserrors. The first event allows error-specific handling, the second event is for general system error handling. errno must not exceed ncodes-1. Further, the syserrors event is passed to RelatedEvents if errors does not equal NIL. All system error events are ignored by default.
There should be system-call specific events, e.g. an event for failed open system calls.
Oberon || Library || Module Index || Search Engine || Definition || Module