<> <> <> <> DIRECTORY CD; CDEvents: CEDAR DEFINITIONS = BEGIN <> <<>> <<--Client level>> EventProc: TYPE = PROC [event: REF, design: CD.Design, x: REF] RETURNS [dont: BOOL _ FALSE]; <<--The type for an event proc>> <<--dont: will abort (some) events and (sometimes) the remaining EventProcs>> <<--event is the event which caused the call>> <<--design: onto which event happened; can be NIL>> <<--x: parameter passed through from ProcessEvent, event-specific>> <<--Eventprocs must not be fast; ChipNDale calls events on time critical places>> RegisterEventProc: PROC [event: REF, proc: EventProc, filter: CD.Technology _ NIL]; <<--Registers a procedure which is called each time a specific event occurs.>> <<--The procedure might stop certain events with the dont result.>> <<--If filter#NIL, proc is only called if event occurs on design of technology=filter.>> <<--event must have been previously registered with RegisterEventType>> <<--Implementor level>> EventRegistration: TYPE = REF EventRegistrationRep; EventRegistrationRep: TYPE; RegisterEventType: PROC [event: REF, reverse: BOOL_FALSE, continueOnAbort: BOOL_TRUE] RETURNS [EventRegistration]; <<--Registration of an event where event procs are called.>> <<--even: Identity of event; if atoms are used, the atom should be entered>> <<-- manually in the appropriate documentation file. >> <<--reverse: ProcessEvent calls events in reversed order of registration.>> <<--continueOnAbort: Protection of critical places from flaky clients. >> <<--The returned EventRegistration is the key to call ProcessEvent>> <<--May raise CD.Error[doubleRegistration] and others.>> ProcessEvent: PROC [eventRegistration: EventRegistration, design: CD.Design, x: REF _ NIL, listenToDont: BOOL _ FALSE] RETURNS [dont: BOOL]; <<--Calls all registered events>> <<--eventRegistration: EventRegistration as returned from RegisterEventType >> <<--design, x: passed through to event handlers >> <<--listenToDont: stops calling further event handlers if any one returs dont=TRUE>> <<--dont: if any one handler returns dont=TRUE>> END.