PGSupport.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
written by Paxton. January 1981
last written by Paxton. 22-May-81 10:04:43
Doug Wyatt, March 2, 1985 4:00:03 pm PST
Michael Plass, March 29, 1985 2:06:39 pm PST
Rick Beach, March 27, 1985 1:12:35 pm PST
DIRECTORY
FileOps USING [LooksIndex, PropIndex, FormatIndex, numLooks, numProps, numFormats],
TextLooks USING [Looks, noLooks];
PGSupport: CEDAR DEFINITIONS
= BEGIN
Looks: TYPE ~ TextLooks.Looks;
noLooks: Looks ~ TextLooks.noLooks;
PropIndex: TYPE ~ FileOps.PropIndex;
FormatIndex: TYPE ~ FileOps.FormatIndex;
LooksIndex: TYPE ~ FileOps.LooksIndex;
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 PropIndex OF ATOM,
propHashKeys: ARRAY PropHashIndex OF PropHashKey,
propHashVals: ARRAY PropHashIndex OF PropHashVal,
formatNext: NAT ← 0, -- next available FormatIndex
formatTable: ARRAY FormatIndex OF ATOM,
formatHashKeys: ARRAY FormatHashIndex OF FormatHashKey,
formatHashVals: ARRAY FormatHashIndex OF FormatHashVal,
looksNext: NAT ← 0, -- next available LooksIndex,
looksTable: ARRAY LooksIndex OF Looks,
looksHashKeys: ARRAY LooksHashIndex OF LooksHashKey,
looksHashVals: ARRAY LooksHashIndex OF LooksHashVal
];
FormatHashIndex: TYPE = [0 .. formatHashSize);
formatHashSize: PRIVATE NAT =
IF FileOps.numFormats > 85 THEN 256 ELSE 128; -- Should be power of 2
FormatHashKey: PRIVATE TYPE = RECORD [formatName: ATOMNIL];
FormatHashVal: PRIVATE TYPE = RECORD [index: FormatIndex];
LooksHashIndex: TYPE = [0 .. looksHashSize);
looksHashSize: PRIVATE NAT =
IF FileOps.numLooks > 85 THEN 256 ELSE 128; -- Should be power of 2
LooksHashKey: PRIVATE TYPE = RECORD [looks: Looks ← noLooks];
LooksHashVal: PRIVATE TYPE = RECORD [index: LooksIndex];
PropHashIndex: TYPE = [0 .. propHashSize);
propHashSize: PRIVATE NAT =
IF FileOps.numProps > 85 THEN 256 ELSE 128; -- Should be power of 2
PropHashKey: PRIVATE TYPE = RECORD [propname: ATOMNIL];
PropHashVal: PRIVATE TYPE = RECORD [index: PropIndex];
CreatePGF: PROC RETURNS [PGF];
FreePGF: PROC [PGF]; -- don't return it more than once!
BadIndex: ERROR;
May be raised by the retrieve procs below
RetrieveFormatName: PROC [index: FormatIndex, pgf: PGF] RETURNS [formatName: ATOM];
EnterFormatName: PROC [formatName: ATOM, pgf: PGF]
RETURNS [ok: BOOL, index: FormatIndex];
RetrieveLooks: PROC [index: LooksIndex, pgf: PGF] RETURNS [looks: Looks];
EnterLooks: PROC [looks: Looks, pgf: PGF] RETURNS [ok: BOOL, index: LooksIndex];
RetrieveProp: PROC [index: PropIndex, pgf: PGF] RETURNS [propname: ATOM];
EnterProp: PROC [propname: ATOM, pgf: PGF] RETURNS [ok: BOOL, index: PropIndex];
END.