-- PGSupport.Mesa
-- written by Paxton. January 1981
-- last written by Paxton. 22-May-81 10:04:43
DIRECTORY
FileOps,
TextLooks,
TextNode,
Rope;
PGSupport: CEDAR DEFINITIONS =
BEGIN OPEN nodeI:TextNode, fOpsI:FileOps, looksI:TextLooks;
PGF: TYPE = REF PGFBody;
-- PGF is the file-level symbol table structure for put/get
PGFBody: TYPE = RECORD [
propNext: NAT ← 0, -- next available PropIndex
propTable: ARRAY fOpsI.PropIndex OF ATOM,
propHashKeys: ARRAY PropHashIndex OF PropHashKey,
propHashVals: ARRAY PropHashIndex OF PropHashVal,
typeNext: NAT ← 0, -- next available TypeIndex
typeTable: ARRAY fOpsI.TypeIndex OF nodeI.TypeName,
typeHashKeys: ARRAY TypeHashIndex OF TypeHashKey,
typeHashVals: ARRAY TypeHashIndex OF TypeHashVal,
looksNext: NAT ← 0, -- next available LooksIndex,
looksTable: ARRAY fOpsI.LooksIndex OF looksI.Looks,
looksHashKeys: ARRAY LooksHashIndex OF LooksHashKey,
looksHashVals: ARRAY LooksHashIndex OF LooksHashVal
];
TypeHashIndex: TYPE = [0 .. typeHashSize);
typeHashSize: PRIVATE NAT =
IF fOpsI.numTypes > 85 THEN 256 ELSE 128; -- Should be power of 2
TypeHashKey: PRIVATE TYPE = RECORD [typename: nodeI.TypeName ← nodeI.nullTypeName];
TypeHashVal: PRIVATE TYPE = RECORD [index: fOpsI.TypeIndex];
LooksHashIndex: TYPE = [0 .. looksHashSize);
looksHashSize: PRIVATE NAT =
IF fOpsI.numLooks > 85 THEN 256 ELSE 128; -- Should be power of 2
LooksHashKey: PRIVATE TYPE = RECORD [looks: looksI.Looks ← looksI.noLooks];
LooksHashVal: PRIVATE TYPE = RECORD [index: fOpsI.LooksIndex];
PropHashIndex: TYPE = [0 .. propHashSize);
propHashSize: PRIVATE NAT =
IF fOpsI.numProps > 85 THEN 256 ELSE 128; -- Should be power of 2
PropHashKey: PRIVATE TYPE = RECORD [propname: ATOMNIL];
PropHashVal: PRIVATE TYPE = RECORD [index: fOpsI.PropIndex];
CreatePGF: PROC RETURNS [PGF];
FreePGF: PROC [PGF]; -- don't return it more than once!
RetrieveTypeName: PROC [index: fOpsI.TypeIndex, pgf: PGF]
RETURNS [typename: nodeI.TypeName] = INLINE {
IF index >= pgf.typeNext THEN ERROR;
RETURN [pgf.typeTable[index]] };
EnterTypeName: PROC [typename: nodeI.TypeName, pgf: PGF]
RETURNS [ok: BOOLEAN, index: fOpsI.TypeIndex];
RetrieveLooks: PROC [index: fOpsI.LooksIndex, pgf: PGF]
RETURNS [looks: looksI.Looks] = INLINE {
IF index >= pgf.looksNext THEN ERROR;
RETURN [pgf.looksTable[index]] };
EnterLooks: PROC [looks: looksI.Looks, pgf: PGF]
RETURNS [ok: BOOLEAN, index: fOpsI.LooksIndex];
RetrieveProp: PROC [index: fOpsI.PropIndex, pgf: PGF]
RETURNS [propname: ATOM] = INLINE {
IF index >= pgf.propNext THEN ERROR;
RETURN [pgf.propTable[index]] };
EnterProp: PROC [propname: ATOM, pgf: PGF]
RETURNS [ok: BOOLEAN, index: fOpsI.PropIndex];
-- ***** Initialization
Start: PROC; -- for initialization only
END.