RCMap.mesa
Copyright Ó 1985, 1986, 1988, 1991 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) March 1, 1988 6:19:17 pm PST
Satterthwaite June 16, 1986 12:09:17 pm PDT
DIRECTORY SmallCards;
RCMap: DEFINITIONS = {
OPEN SmallCards;
TYPES
Base: TYPE = LONG BASE POINTER;
Object: TYPE = MACHINE DEPENDENT RECORD [
map: SELECT type: ObjectKind FROM
Note: the null, ref, controlLink, oneRef, and simple variants must be 1 word long
null => [pad1: Card12 ¬ 0, pad2: Card16 ¬ 0],
ref => [pad1: Card12 ¬ 0, pad2: Card16 ¬ 0],
controlLink => [pad1: Card12 ¬ 0, pad2: Card16 ¬ 0],
oneRef => [pad1: Card12 ¬ 0, offset: Card16 ¬ 0],
simple => [
length: Card12 ¬ 0,
refs: PACKED ARRAY [0..simpleLength) OF BOOL ¬ ALL[FALSE]],
linked => [pad1: Card12 ¬ 0, pad2: Card16 ¬ 0,
first: INT, -- offset (in AUs) of first simple REF
rest: Index], -- map for the rest of the REFs (starts at offset + SIZE[REF])
nonVariant => [
pad: Card11 ¬ 0,
complete: BOOL ¬ FALSE,
components: SEQUENCE nComponents: Card16 OF RCField],
variant => [
NOTE the specified RCMap for each variant includes all common parts
complete: BOOL ¬ FALSE,
pad1: Card11 ¬ 0,
pad2: Card16 ¬ 0,
fdTag: FieldDescriptor ¬ [],
pad3: Card16 ¬ 0,
variants: SEQUENCE nVariants: Card16 OF Index -- indexed by tag value
],
array => [
pad1: Card12 ¬ 0, offset: Card16 ¬ 0,
unitsPerElement: INT ¬ 0,
nElements: INT ¬ 0,
rcmi: Index ¬ nullIndex
],
sequence => [
pad1: Card12 ¬ 0, offset: Card16 ¬ 0,
unitsPerElement: INT ¬ 0,
fdLength: FieldDescriptor ¬ [], -- actual number of elements is stored here
commonPart: Index ¬ nullIndex,
dataOffset: INT ¬ 0, -- actual data begins here
rcmi: Index ¬ nullIndex
],
ENDCASE];
ObjectKind: TYPE = MACHINE DEPENDENT {
null (0), ref, controlLink, oneRef, simple, linked, nonVariant, variant, array, sequence
};
RCField: TYPE = MACHINE DEPENDENT RECORD [
describes an RC field in a record
unitOffset: INT ¬ 0,
rcmi: Index ¬ nullIndex
];
FieldDescriptor: TYPE = MACHINE DEPENDENT RECORD [
bitOffset: INT ¬ 0, -- bit offset of the field
bitCount: INT ¬ 0 -- bits in the field
];
Index: TYPE = Base RELATIVE LONG POINTER TO Object;
VIndex: TYPE = Base RELATIVE LONG POINTER TO Object.variant;
NVIndex: TYPE = Base RELATIVE LONG POINTER TO Object.nonVariant;
AIndex: TYPE = Base RELATIVE LONG POINTER TO Object.array;
SeqIndex: TYPE = Base RELATIVE LONG POINTER TO Object.sequence;
SimpIndex: TYPE = Base RELATIVE LONG POINTER TO Object.simple;
OneRefIndex: TYPE = Base RELATIVE LONG POINTER TO Object.oneRef;
LinkedIndex: TYPE = Base RELATIVE LONG POINTER TO Object.linked;
NullIndex: TYPE = Base RELATIVE LONG POINTER TO Object.null;
RefIndex: TYPE = Base RELATIVE LONG POINTER TO Object.ref;
ControlLinkIndex: TYPE = Base RELATIVE LONG POINTER TO Object.controlLink;
CONSTANTS
componentMaxIndex: CARDINAL = Card16.LAST-1;
leave room for Object.type in length word
componentLength: CARDINAL = componentMaxIndex+1;
simpleMaxIndex: CARDINAL = 15; -- 4 bits for Object.type, 12 for length, 16 BOOLEANs
simpleLength: CARDINAL = simpleMaxIndex+1;
invalidIndex: Index = Index.LAST; -- guaranteed to be an invalid Index
nullIndex: NullIndex = LOOPHOLE[Index.FIRST]; -- always at index 0 in the Base
refIndex: RefIndex = LOOPHOLE[nullIndex+Object.null.SIZE];
controlLinkIndex: ControlLinkIndex = LOOPHOLE[refIndex+Object.ref.SIZE];
}.