ProcessProps.mesa
Copyright Ó 1985, 1986, 1991 by Xerox Corporation. All rights reserved.
Russ Atkinson, February 1, 1985 3:53:28 pm PST
Doug Wyatt, February 27, 1985 9:26:51 am PST
The idea behind process properties is that some procedures need to know "the default stream" or "the current Commander handle" or some such information, yet this information has not been passed up through enough levels to allow access. ProcessProps provides a fast way to associate properties with processes.
DIRECTORY
List USING [AList];
ProcessProps: CEDAR DEFINITIONS
= BEGIN
AList: TYPE = List.AList;
AddPropList: PROC [propList: AList, inner: PROC];
... adds the given properties to the current process for the duration of the call of inner. The old property list for the process will not be altered, but will be found at the end of the propety list during the call to inner. The old property list will be restored after the call has completed. The new propList will be copied if an old property list exists.
PushPropList: PROC [propList: AList, inner: PROC];
... sets the property list for the current process for the duration of the call of inner. The old property list will be restored after the call has completed. The new propList will not be copied. Most applications should use AddPropList to properly inherit properties.
GetPropList: PROC RETURNS [propList: AList];
... returns the current property list for the current process. Although there is no prohibition from altering the returned list, users are encouraged to follow the style of adding new properties, rather than changing old associations.
GetProp: PROC [key: REF] RETURNS [prop: REF];
... returns the current property associated with the given key for the current process (NIL is returned if no such property exists). This procedure is preferred to GetPropList for most applications.
The following two operations are safe, but operations on PROCESS values are, in general, not safe, since processes are reused. These operations should be regarded as instantaneous samples, where the results are likely to change without notice. However, statistics-style applications may find these operations useful despite these caveats. It is also OK to ask whether a process still has some property if that property will not be reused.
GetSpecificPropList: PROC [process: PROCESS] RETURNS [propList: AList];
... returns the current property list for the specified process
GetNextPropList: PROC [process: PROCESS ¬ NIL] RETURNS [next: PROCESS, propList: AList];
... returns the next process with a non-NIL propList. Use GetNextPropList[NIL] to start the iteration. [NIL, NIL] will be returned if no more processes exist. The processes are produced in increasing order.
END.