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

Ulm's Oberon Library:


Messages - management of messages for attachable handlers


TYPE Object = Disciplines.Object;
TYPE Message = POINTER TO MessageRec;
TYPE MessageRec =
      processed: BOOLEAN;
      done: BOOLEAN;
      errors: RelatedEvents.Object;
TYPE Handler = PROCEDURE (object: Object; VAR message: Message);

PROCEDURE InstallHandler(object: Object; handler: Handler); PROCEDURE Send(object: Object; VAR message: Message); PROCEDURE Init(message: Message); (* doesn't call NEW *)


Messages allows to attach arbitrary message handlers to objects which are an extension of Disciplines.Object. An object may have any number of message handlers attached which will be able to process every message sent to the object.

Messages itself does not support the persistency of message handlers if objects are an extension of PersistentDisciplines.Object. Nevertheless, the persistency of the handlers may be achieved if they are all associated with the object or one of its persistent disciplines. In this case, InstallHandler has to be called by the create interface procedures of the object or its disciplines for PersistentObjects.

Modules which implement abstractions which are based on messages have to

All newly created messages must be initialized by Init (which itself doesn't call NEW). Init sets processed and done to FALSE and initializes errors to an object with an empty error queue (see RelatedEvents for details). Afterwards, additional components which represent the parameters of the operation may be set. Send allows then to send the message to the given object.

Messages supports Forwarders by installing a forwarding handler for dependent objects. Note that the installation of handlers is not affected by Forwarders.Forward, i.e. InstallHandler installs always handler for object independently from any dependency relations. Local handlers take always precedence over the handlers of the object which is depended on.


Errors lead to events which are related to the given stream in case of input and output operations or to the object. As described above, errors raised by message handlers are conventionally related to the errors component of the message.


general forwarding operation
input and output of persistent objects
input and output of attached data structures of persistent objects
input and output of events
error handling

Edited by: borchert, last change: 1999/04/15, revision: 1.9, converted to HTML: 1999/04/15

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