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