PGSupport.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
written by Paxton. January 1981
last written by Paxton. 22-May-81 10:04:43
Michael Plass, March 29, 1985 2:06:39 pm PST
Rick Beach, March 27, 1985 1:12:35 pm PST
Doug Wyatt, September 22, 1986 1:22:53 pm PDT
DIRECTORY
TiogaFile USING [FileId, FormatIndex, LooksIndex, numFormats, numLooks, numProps, PropIndex],
TextLooks USING [Looks, noLooks];
PGSupport: CEDAR DEFINITIONS
= BEGIN
Looks: TYPE ~ TextLooks.Looks;
noLooks: Looks ~ TextLooks.noLooks;
PropIndex: TYPE ~ TiogaFile.PropIndex;
FormatIndex: TYPE ~ TiogaFile.FormatIndex;
LooksIndex: TYPE ~ TiogaFile.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 TiogaFile.numFormats > 85 THEN 256 ELSE 128; -- Should be power of 2
FormatHashKey: PRIVATE TYPE = RECORD [formatName: ATOM ← NIL];
FormatHashVal: PRIVATE TYPE = RECORD [index: FormatIndex];
LooksHashIndex: TYPE = [0 .. looksHashSize);
looksHashSize:
PRIVATE
NAT =
IF TiogaFile.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 TiogaFile.numProps > 85 THEN 256 ELSE 128; -- Should be power of 2
PropHashKey: PRIVATE TYPE = RECORD [propname: ATOM ← NIL];
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];
PutProc: TYPE ~ PROC [c: CHAR];
GetProc:
TYPE ~
PROC
RETURNS [c:
CHAR];
PutLength: PROC [put: PutProc, len: INT];
GetLength:
PROC [get: GetProc]
RETURNS [len:
INT];
PutFileId: PROC [put: PutProc, id: TiogaFile.FileId];
GetFileId:
PROC [get: GetProc]
RETURNS [id: TiogaFile.FileId];
PutTrailerLength: PROC [put: PutProc, len: INT];
GetTrailerLength:
PROC [get: GetProc]
RETURNS [len:
INT];
END.