PGSupport.Mesa
written by Paxton. January 1981
last written by Paxton. 22-May-81 10:04:43
DIRECTORY
T2FileOps,
NameSymbolTable,
TiogaLooks,
Rope;
PGSupport: CEDAR DEFINITIONS =
BEGIN
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 T2FileOps.PropIndex OF ATOM,
propHashKeys: ARRAY PropHashIndex OF PropHashKey,
propHashVals: ARRAY PropHashIndex OF PropHashVal,
typeNext: NAT ← 0, -- next available TypeIndex
typeTable: ARRAY T2FileOps.TypeIndex OF NameSymbolTable.Name,
typeHashKeys: ARRAY TypeHashIndex OF TypeHashKey,
typeHashVals: ARRAY TypeHashIndex OF TypeHashVal,
looksNext: NAT ← 0, -- next available LooksIndex,
looksTable: ARRAY T2FileOps.LooksIndex OF TiogaLooks.Looks,
looksHashKeys: ARRAY LooksHashIndex OF LooksHashKey,
looksHashVals: ARRAY LooksHashIndex OF LooksHashVal
];
TypeHashIndex: TYPE = [0 .. typeHashSize);
typeHashSize: PRIVATE NAT =
IF T2FileOps.numTypes > 85 THEN 256 ELSE 128; -- Should be power of 2
TypeHashKey: PRIVATE TYPE = RECORD [typename: NameSymbolTable.Name ← NameSymbolTable.nullName];
TypeHashVal: PRIVATE TYPE = RECORD [index: T2FileOps.TypeIndex];
LooksHashIndex: TYPE = [0 .. looksHashSize);
looksHashSize: PRIVATE NAT =
IF T2FileOps.numLooks > 85 THEN 256 ELSE 128; -- Should be power of 2
LooksHashKey: PRIVATE TYPE = RECORD [looks: TiogaLooks.Looks ← TiogaLooks.noLooks];
LooksHashVal: PRIVATE TYPE = RECORD [index: T2FileOps.LooksIndex];
PropHashIndex: TYPE = [0 .. propHashSize);
propHashSize: PRIVATE NAT =
IF T2FileOps.numProps > 85 THEN 256 ELSE 128; -- Should be power of 2
PropHashKey: PRIVATE TYPE = RECORD [propname: ATOMNIL];
PropHashVal: PRIVATE TYPE = RECORD [index: T2FileOps.PropIndex];
CreatePGF: PROC RETURNS [PGF];
FreePGF: PROC [PGF]; -- don't return it more than once!
RetrieveTypeName: PROC [index: T2FileOps.TypeIndex, pgf: PGF]
RETURNS [typename: NameSymbolTable.Name] = INLINE {
IF index >= pgf.typeNext THEN ERROR;
RETURN [pgf.typeTable[index]] };
EnterTypeName: PROC [typename: NameSymbolTable.Name, pgf: PGF]
RETURNS [ok: BOOLEAN, index: T2FileOps.TypeIndex];
RetrieveLooks: PROC [index: T2FileOps.LooksIndex, pgf: PGF]
RETURNS [looks: TiogaLooks.Looks] = INLINE {
IF index >= pgf.looksNext THEN ERROR;
RETURN [pgf.looksTable[index]] };
EnterLooks: PROC [looks: TiogaLooks.Looks, pgf: PGF]
RETURNS [ok: BOOLEAN, index: T2FileOps.LooksIndex];
RetrieveProp: PROC [index: T2FileOps.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: T2FileOps.PropIndex];
-- ***** Initialization
Start: PROC; -- for initialization only
END.