DIRECTORY UndoEvent; UndoEventImpl: CEDAR PROGRAM EXPORTS UndoEvent = BEGIN OPEN UndoEvent; Create: PUBLIC PROC RETURNS [Ref] = { RETURN [NEW[EventBody]] }; Note: PUBLIC PROC [event: Ref, undoProc: UndoProc, undoRef: REF Change] = { IF event = NIL THEN RETURN; event.subevents _ NEW[SubEventBody _ [event.subevents,undoProc,undoRef]] }; Undo: PUBLIC PROC [undoEvent: Ref, currentEvent: Ref _ NIL] = { sub: SubEvent; IF undoEvent=NIL THEN RETURN; sub _ undoEvent.subevents; undoEvent.subevents _ NIL; UNTIL sub=NIL DO sub.undoProc[sub.undoRef,currentEvent]; sub _ sub.next; ENDLOOP }; Reset: PUBLIC PROC [event: Ref] = { IF event # NIL THEN event.subevents _ NIL }; Empty: PUBLIC PROC [event: Ref] RETURNS [BOOLEAN] = { RETURN [event=NIL OR event.subevents=NIL] }; END. öUndoEventImpl.mesa; written by Bill Paxton, June 1981 edited by McGregor, February 8, 1983 11:31 am edited by Bill Paxton, June 1, 1983 2:19 pm calls undoProc[undoRef] for each subevent in reverse order that subevents originally happened Ê€˜Jšœ5™5Jšœ-™-Jšœ+™+JšÏk ˜ J˜ J˜šœ œ˜Jšœ ˜—Jšœœ ˜J˜Jš Ïnœœœœ œœ˜@J˜šžœœœ+œ ˜KJšœ œœœ˜šœœ˜$J˜&J˜——šžœœœ&œ˜?Jšœ*™*Jšœ3™3J˜Jšœ œœœ˜Jšœ1œ˜5Jšœœœ9œ˜SJ˜—Jšžœœœœ œœœ˜PJ˜Jšžœœœœœœœœœ˜bJ˜Jšœ˜J˜J˜J˜—…—„