RProperties.mesa
Copyright Ó 1985, 1986, 1991 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, September 19, 1985 3:33:07 pm PDT 4:15 pm
Last edited by: Christian Jacobi, December 22, 1986 12:14:20 pm PST
RProperties: CEDAR DEFINITIONS =
BEGIN
Implements property list. Uses less memory than Atom's implementation. This module has no protection against concurrent calls of PutProp. Usage is either in sequential applications or with a higher level application monitor giving protection. Other modules must not modify any PropList; a modification of a PropList while Properties is inside its monitor lock can cause disaster.
This module re-orders property list on GetProp to move often used properties to the front. Usage of this module is not recomended when the higher level application has to enumerate properties. If enumeration is required, but speed is not of major concern CopyList might be used.
PropList: TYPE = LIST OF KeyVal;
KeyVal: TYPE = RECORD [key, val: REF];
GetProp: PROC [propList: PropList, prop: REF] RETURNS [REF];
Fetches a value from a property list; NIL if not found
Reorders list partially; next GetProp of the same prop may be faster
PutProp: PROC [propList: PropList, prop: REF, val: REF ¬ NIL] RETURNS [PropList];
Puts a property key value pair on a property list; The property list must be written back.
A nil val value removes the property
CopyList: PROC [propList: PropList] RETURNS [PropList];
Makes a copy of a PropList for enumeration purposes: the copy will not be reordered, iff
it can be ensured that GetProp or PutProp will not be called on it.
END.