RCMapOps.mesa
Copyright Ó 1985, 1986, 1987, 1988, 1991 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) July 25, 1988 9:38:08 pm PDT
Satterthwaite April 23, 1986 11:34:52 am PST
DIRECTORY
RCMap USING [Base, Index],
SymbolTable USING [Base],
Symbols USING[Type, MDIndex];
RCMapOps: DEFINITIONS = {
TYPEs
RCMapTable: TYPE;
RCMT: TYPE = LONG POINTER TO RCMapTable;
OuterProc: TYPE = PROC [
stb: SymbolTable.Base, mdi: Symbols.MDIndex, inner: PROC [base: SymbolTable.Base]];
MapMap: TYPE = LONG POINTER TO MapMapObj; -- built by Include
MapMapObj: TYPE = RECORD [SEQUENCE length: CARDINAL OF MapMapItem];
MapMapItem: TYPE = RECORD [old, new: RCMap.Index];
OPERATIONs
Create: PROC [zone: UNCOUNTED ZONE, outerProc: OuterProc ¬ NIL, expansionOK: BOOL ¬ FALSE] RETURNS [RCMT];
Create an RCMapTable object.
Note that access to this object is not monitored
Destroy: PROC [rcmt: RCMT] RETURNS [RCMT];
GetSpan: PROC [rcmt: RCMT] RETURNS [base: RCMap.Base, size: CARD];
Retrieve info about the RCMap.Base
Acquire: PROC [rcmt: RCMT, stb: SymbolTable.Base, type: Symbols.Type] RETURNS [RCMap.Index];
Returns the RCMap.Index of the RCMap for the specified type.
Makes an entry if necessary.
Include: PROC [rcmt: RCMT, rcmb: RCMap.Base, size: CARD, zone: UNCOUNTED ZONE¬NIL]
RETURNS [MapMap];
Merges the specified RCMap.Base into the table object.
If zone # NIL, allocates and returns a MapMap
FindMapMapEntry: PROC [mapMap: MapMap, oldIndex: RCMap.Index]
RETURNS [RCMap.Index];
Does a MapMap lookup: returns the index in the current RCMap.Base that corresponds to the specified index in the RCMap.Base that Include processed.
Enumerate: PROC [base: RCMap.Base, limit: CARD, proc: Visitor] RETURNS [stopped: BOOLEAN];
Visitor: TYPE = PROC [rcmx: RCMap.Index] RETURNS [stop: BOOL ¬ FALSE];
}.
BEWARE: If you allow expansion of the RCMap Base, you must be careful about concurrent access to the existing Base. In current Cedar, for performance reasons (all accesses to the Base would have to be protected by a monitor), the Cedar runtime does not allow expansion (ERROR if RCMap Base overflows).