TypePropsImpl.Mesa
last edited by Spreitzer at December 12, 1983 8:09 pm
DIRECTORY List, SafeStorage, TypeProps;
TypePropsImpl: CEDAR MONITOR
IMPORTS List
EXPORTS TypeProps =
BEGIN
Type: TYPE = SafeStorage.Type;
AList: TYPE = List.AList;
Stuff: TYPE = LIST OF RECORD [type: Type, aList: AList];
stuff: Stuff ← NIL;
Put: PUBLIC PROC [type: Type, key: REF ANY, val: REF ANY] =
BEGIN
s: Stuff;
Find: ENTRY PROC =
BEGIN
FOR s ← stuff, s.rest WHILE s # NIL DO
IF s.first.type = type THEN EXIT;
ENDLOOP;
IF s = NIL THEN stuff ← s ← CONS[[type, NIL], stuff];
END;
Find[];
s.first.aList ← List.PutAssoc[key: key, val: val, aList: s.first.aList];
END;
Get: PUBLIC PROC [type: Type, key: REF ANY] RETURNS [val: REF ANY] =
BEGIN
FOR s: Stuff ← stuff, s.rest WHILE s # NIL DO
IF s.first.type = type THEN RETURN [List.Assoc[key: key, aList: s.first.aList]];
ENDLOOP;
val ← NIL;
END;
END.