DIRECTORY UndoEvent; UndoEventImpl: CEDAR PROGRAM EXPORTS UndoEvent = BEGIN OPEN UndoEvent; Create: PUBLIC PROC RETURNS [Event] = { RETURN [NEW[EventRep ¬ [NIL]]] }; Note: PUBLIC PROC [event: Event, undoProc: UndoProc, undoRef: REF Change] = { IF event = NIL THEN RETURN; event.subevents ¬ NEW[SubEventBody ¬ [event.subevents,undoProc,undoRef]] }; Undo: PUBLIC PROC [undoEvent: Event, currentEvent: Event ¬ 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: Event] = { IF event # NIL THEN event.subevents ¬ NIL }; Empty: PUBLIC PROC [event: Event] RETURNS [BOOL] = { RETURN [event=NIL OR event.subevents=NIL] }; END. F UndoEventImpl.mesa Copyright Σ 1985, 1986, 1991, 1992 by Xerox Corporation. All rights reserved. written by Bill Paxton, June 1981 last edit by Bill Paxton, April 5, 1982 12:38 pm Doug Wyatt, January 30, 1992 5:49 pm PST calls undoProc[undoRef] for each subevent in reverse order that subevents originally happened ΚΑ•NewlineDelimiter –(cedarcode) style™codešœ™Kšœ ΟeœC™NKšœ!™!Kšœ1™1K™(—K˜šΟk ˜ K˜ —K˜KšΟn œžœžœ˜Kšžœ ˜Kšžœžœ ˜K˜KšŸœžœžœžœ žœžœ žœ˜IK˜šŸœžœžœ-žœ ˜MKšžœ žœžœžœ˜šœžœ˜$K˜&K˜——šŸœžœžœ*žœ˜CKšœ*™*Kšœ3™3K˜Kšžœ žœžœžœ˜Kšœ1žœ˜5Kšžœžœžœ9žœ˜SK˜—KšŸœžœžœžœ žœžœžœ˜RK˜KšŸœžœžœžœžœžœžœžœžœ˜aK˜Kšžœ˜—…—!