DIRECTORY UndoEvent, TextNode; UndoEventImpl: CEDAR PROGRAM IMPORTS TextNode EXPORTS UndoEvent = BEGIN OPEN UndoEvent; Create: PUBLIC PROC RETURNS [Ref] = { RETURN [TextNode.pZone.NEW[EventBody]] }; Note: PUBLIC PROC [event: Ref, undoProc: UndoProc, undoRef: REF Change] = { IF event = NIL THEN RETURN; event.subevents _ TextNode.pZone.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] }; Start: PUBLIC PROC = { }; END. Ü-- UndoEventImpl.mesa -- written by Bill Paxton, June 1981 -- last edit by Bill Paxton, April 5, 1982 12:38 pm -- calls undoProc[undoRef] for each subevent -- in reverse order that subevents originally happened ʨ˜JšÏc™Jš$™$Jš4™4J˜JšÏk ˜ J˜ J˜ J˜šœž œ˜Jšžœ ˜Jšžœ ˜—Jšžœžœ ˜J˜Jš Ïnœžœžœžœ žœžœ˜OJ˜šŸœžœžœ+žœ ˜KJšžœ žœžœžœ˜šœ!žœ˜3J˜&J˜——šŸœžœžœ&žœ˜?Jš-™-Jš6™6J˜Jšžœ žœžœžœ˜Jšœ1žœ˜5Jšžœžœžœ9žœ˜SJ˜—JšŸœžœžœžœ žœžœžœ˜PJ˜JšŸœžœžœžœžœžœžœžœžœ˜bJ˜šŸœžœžœ˜J˜J˜—Jšžœ˜J˜J˜J˜—…—bæ