PropertiesDoc.tioga
Copyright © 1986 by Xerox Corporation. All rights reserved.
Created by: Christian Jacobi, September 19, 1985 6:08:41 pm PDT
gbb May 17, 1986 5:25:11 pm PDT
Last edited by: Christian Jacobi, July 4, 1993 5:46 pm PDT
PROPERTIES
CEDAR 7.0 —
Properties, RProperties
Christian Jacobi
© Copyright 1985, 1986 Xerox Corporation. All rights reserved.
Abstract: Implements property lists similar to Atom, but uses less memory and is faster.
Created by: Christian Jacobi
Keywords: properties
These interfaces are no more recommended in cases where the PropList or UnsafePropList funtionality would be sufficient.
Two different packages which implement property lists.
Properties is a simple version keeping property order stable; this can be used for applications which require both, forked processes and enumerations.
RProperties is a property package which re-orders properties on usage; this might be faster for certain applications. But in the presence of forked processes, enumerations can not work because of changes of the order. However, making a copy allows a poor mans enumeration.
Properties
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.
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
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
EachProp: TYPE = PROC [key, val: REF] RETURNS [quit: BOOLFALSE];
Enumerate: PROC [propList: PropList, proc: EachProp] RETURNS [quit: BOOL];
Enumerates the list
Changes of the list while the enumeration is in progress may or may not be seen
CopyList: PROC [propList: PropList] RETURNS [PropList];
Makes a copy of a PropList.
RProperties
The package looks like Properties, except:
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.
It does not provide the procedure Enumerate