DIRECTORY Properties; PropertiesImpl: CEDAR MONITOR EXPORTS Properties = BEGIN PropList: TYPE = Properties.PropList; GetProp: PUBLIC ENTRY PROC [propList: PropList, prop: REF] RETURNS [REF ¬ NIL] = { ENABLE UNWIND => NULL; WHILE propList # NIL DO IF propList.first.key = prop THEN RETURN [propList.first.val]; propList ¬ propList.rest; ENDLOOP; }; PutProp: PUBLIC ENTRY PROC [propList: PropList, prop: REF, val: REF ¬ NIL] RETURNS [PropList] = { ENABLE UNWIND => NULL; IF val=NIL THEN RETURN [RemPropInternal[propList, prop]] ELSE RETURN [PutPropInternal[propList, prop, val]] }; RemPropInternal: INTERNAL PROC [propList: PropList, prop: REF] RETURNS [PropList] = INLINE { lst: PropList ¬ propList; lag: PropList ¬ NIL; UNTIL lst = NIL DO rest: PropList ¬ lst.rest; IF lst.first.key = prop THEN { IF lag = NIL THEN RETURN [rest]; lag.rest ¬ rest; RETURN [propList]; }; lag ¬ lst; lst ¬ rest; ENDLOOP; RETURN [propList]; }; PutPropInternal: INTERNAL PROC [propList: PropList, prop: REF, val: REF] RETURNS [PropList] = INLINE { lst: PropList ¬ propList; lag: PropList ¬ NIL; WHILE lst # NIL DO IF lst.first.key = prop THEN { lst.first.val ¬ val; RETURN [propList]; }; lag ¬ lst; lst ¬ lst.rest; ENDLOOP; lst ¬ LIST[[key: prop, val: val]]; IF lag = NIL THEN RETURN [lst]; lag.rest ¬ lst; RETURN [propList]; }; Enumerate: PUBLIC PROC [propList: PropList, proc: Properties.EachProp] RETURNS [quit: BOOL¬FALSE] = { FOR l: PropList ¬ propList, l.rest WHILE l#NIL AND ~quit DO quit ¬ proc[l.first.key, l.first.val]; ENDLOOP; }; CopyList: PUBLIC ENTRY PROC [propList: PropList] RETURNS [copy: PropList¬NIL] = { ENABLE UNWIND => NULL; IF propList#NIL THEN { lst: PropList; copy ¬ lst ¬ propList ¬ LIST[propList.first]; WHILE (propList¬propList.rest) # NIL DO lst.rest ¬ LIST[propList.first]; lst ¬ lst.rest; ENDLOOP }; }; END. . PropertiesImpl.mesa Copyright Σ 1985, 1991 by Xerox Corporation. All rights reserved. Created by Christian Jacobi, September 19, 1985 3:33:07 pm PDT 4:15 pm Christian Jacobi, March 12, 1986 8:13:23 pm PST Bertrand Serlet July 10, 1986 6:32:23 pm PDT Last edited by: Christian Jacobi, December 22, 1986 11:53:49 am PST --Update list element in place --prop not found on property list --yes, this needs no special monitoring... --but I don't want each user to have to prove again --that this module never creates a state where Enumerate would fail Κ»–(cedarcode) style•NewlineDelimiter ™codešœ™Kšœ Οeœ6™BKšœF™FKšœ/™/K™,K™CK˜—šΟk ˜ K˜ —K˜šΟnœžœžœ˜Kšžœ ˜—Kšž˜K™Kšœ žœ žœ ˜%K™šŸœžœžœžœžœžœžœžœ˜RKšžœžœžœ˜šžœ žœž˜Kšžœžœžœ˜>Kšœ˜Kšžœ˜—K˜—K˜šŸœžœžœžœžœžœžœžœ˜aKšžœžœžœ˜Kšžœžœžœžœ"˜8Kšžœžœ(˜3K˜—K˜š Ÿœžœžœžœžœžœ˜\Kšœ˜Kšœžœ˜šžœžœž˜Kšœ˜šžœžœ˜Kšžœžœžœžœ˜ Kšœ˜Kšžœ ˜K˜—K˜ K˜ Kšžœ˜—Kšžœ ˜Kšœ˜—K˜šŸœžœžœžœžœžœžœ˜gKšœ˜Kšœžœ˜šžœžœž˜šžœžœ˜Kšœ™K˜Kšžœ ˜Kšœ˜—K˜ K˜Kšžœ˜—KšΟc!™!Kšœžœ˜"Kšžœžœžœžœ˜Kšœ˜Kšžœ ˜Kšœ˜K˜—šŸ œž œ1žœž œ˜eK™+K™3KšœC™Cš žœ žœžœžœž˜;Kšœ&˜&Kšžœ˜—K˜—K˜šŸœžœžœžœ˜QKšžœžœžœ˜šžœ žœžœ˜Kšœ˜Kšœžœ˜.šžœžœž˜'Kšœ žœ˜ Kšœ˜Kšž˜—K˜—K˜—K˜Kšžœ˜K˜—…—*