DIRECTORY PGSupport, FileOps, T2FileOps, NameSymbolTable, NodeProps, TiogaLooks, TiogaLooksOps, Inline, Rope; PGSupportImpl: CEDAR MONITOR IMPORTS Inline, NodeProps EXPORTS PGSupport SHARES PGSupport = BEGIN OPEN PGSupport; prefixAtom: ATOM = NodeProps.PrefixAtom[]; postfixAtom: ATOM = NodeProps.PostfixAtom[]; CreatePGF: PUBLIC PROC RETURNS [pgf: PGF] = { pgf _ AllocPGF[]; pgf.looksTable[0] _ TiogaLooks.noLooks; pgf.looksNext _ 1; -- reserve 0 for noLooks FOR i:LooksHashIndex IN LooksHashIndex DO pgf.looksHashKeys[i].looks _ TiogaLooks.noLooks; ENDLOOP; pgf.typeTable[0] _ NameSymbolTable.nullName; FOR i:TypeHashIndex IN TypeHashIndex DO pgf.typeHashKeys[i].typename _ NameSymbolTable.nullName; ENDLOOP; pgf.typeNext _ 1; -- reserve 0 for null typename pgf.propNext _ 1; --reserve 0 for NIL FOR i:PropHashIndex IN PropHashIndex DO pgf.propHashKeys[i].propname _ NIL; ENDLOOP; [] _ EnterProp[prefixAtom, pgf]; -- preload system atoms [] _ EnterProp[postfixAtom, pgf]; }; pgf1, pgf2, pgf3: PGF _ NIL; AllocPGF: ENTRY PROC RETURNS [pgf: PGF] = { ENABLE UNWIND => NULL; IF pgf3 # NIL THEN { pgf _ pgf3; pgf3 _ NIL } ELSE IF pgf2 # NIL THEN { pgf _ pgf2; pgf2 _ NIL } ELSE IF pgf1 # NIL THEN { pgf _ pgf1; pgf1 _ NIL } ELSE pgf _ NEW[PGFBody] }; FreePGF: PUBLIC ENTRY PROC [pgf: PGF] = { ENABLE UNWIND => NULL; IF pgf3 = pgf OR pgf2 = pgf OR pgf1 = pgf THEN ERROR; IF pgf3 = NIL THEN pgf3 _ pgf ELSE IF pgf2 = NIL THEN pgf2 _ pgf ELSE IF pgf1 = NIL THEN pgf1 _ pgf }; EnterTypeName: PUBLIC PROC [typename: NameSymbolTable.Name, pgf: PGF] RETURNS [ok: BOOLEAN, index: FileOps.TypeIndex] = { next: NAT _ pgf.typeNext; initloc, loc: NAT; IF typename = NameSymbolTable.nullName THEN RETURN [TRUE, 0]; -- reserved loc _ initloc _ LOOPHOLE[typename,NAT] MOD typeHashSize; DO SELECT pgf.typeHashKeys[loc].typename FROM typename => RETURN [TRUE, pgf.typeHashVals[loc].index]; NameSymbolTable.nullName => EXIT; -- this is an unused entry ENDCASE; SELECT (loc _ loc+1) FROM typeHashSize => IF (loc _ 0)=initloc THEN ERROR; initloc => ERROR; -- should never have full table ENDCASE; ENDLOOP; IF next < FileOps.numTypes THEN -- room left in table BEGIN pgf.typeTable[next] _ typename; pgf.typeNext _ next+1; pgf.typeHashKeys[loc].typename _ typename; pgf.typeHashVals[loc].index _ LOOPHOLE[next]; END; RETURN [FALSE, 0] }; -- index irrelevant in this case EnterLooks: PUBLIC PROC [looks: TiogaLooks.Looks, pgf: PGF] RETURNS [ok: BOOLEAN, index: T2FileOps.LooksIndex] = { next: NAT _ pgf.looksNext; initloc, loc: NAT; IF looks = TiogaLooks.noLooks THEN RETURN [TRUE, 0]; -- reserved loc _ initloc _ LOOPHOLE[ Inline.BITXOR[ LOOPHOLE[looks, TiogaLooksOps.LooksBytes].byte0, Inline.BITXOR[LOOPHOLE[looks, TiogaLooksOps.LooksBytes].byte1, LOOPHOLE[looks, TiogaLooksOps.LooksBytes].byte2]],NAT] MOD looksHashSize; DO SELECT pgf.looksHashKeys[loc].looks FROM looks => RETURN [TRUE, pgf.looksHashVals[loc].index]; TiogaLooks.noLooks => EXIT; -- this is an unused entry ENDCASE; SELECT (loc _ loc+1) FROM looksHashSize => IF (loc _ 0)=initloc THEN ERROR; initloc => ERROR; -- should never have full table ENDCASE; ENDLOOP; IF next < FileOps.numLooks THEN -- room left in table BEGIN pgf.looksTable[next] _ looks; pgf.looksNext _ next+1; pgf.looksHashKeys[loc].looks _ looks; pgf.looksHashVals[loc].index _ LOOPHOLE[next]; END; RETURN [FALSE, 0] }; -- index irrelevant in this case EnterProp: PUBLIC PROC [propname: ATOM, pgf: PGF] RETURNS [ok: BOOLEAN, index: FileOps.PropIndex] = { next: NAT _ pgf.propNext; initloc, loc: NAT; IF propname = NIL THEN RETURN [TRUE, 0]; -- reserved loc _ initloc _ (LOOPHOLE[Inline.LowHalf[propname],NAT] / 16) MOD propHashSize; DO SELECT pgf.propHashKeys[loc].propname FROM propname => RETURN [TRUE, pgf.propHashVals[loc].index]; NIL => EXIT; -- this is an unused entry ENDCASE; SELECT (loc _ loc+1) FROM propHashSize => IF (loc _ 0)=initloc THEN ERROR; initloc => ERROR; -- should never have full table ENDCASE; ENDLOOP; IF next < FileOps.numProps THEN -- room left in table BEGIN pgf.propTable[next] _ propname; pgf.propNext _ next+1; pgf.propHashKeys[loc].propname _ propname; pgf.propHashVals[loc].index _ LOOPHOLE[next]; END; RETURN [FALSE, 0] }; -- index irrelevant in this case Start: PUBLIC PROC = { }; END. èPGSupportImpl.Mesa Written by Bill Paxton, January 1981 last written by Paxton. June 10, 1983 2:18 pm Last Edited by: Lamming, February 14, 1983 4:45 pm -- PGF is the file-level structure for put/get -- ***** Initialization Ê9˜JšÏc™Jš$™$Jš.™.J™2J˜šÏk ˜ J˜ J˜J˜ J˜J˜ J˜ J˜J˜J˜—J˜šœž ˜Jšžœ˜Jšžœ ˜Jšžœ ˜—Jšž˜Jšžœ ˜J˜Jš.™.J˜Jšœ žœ˜*Jšœ žœ˜,J˜š Ïn œžœžœžœžœ˜-Jšœ˜J˜'Jšœ˜+šžœžœž˜)Jšœ1žœ˜9—J˜,šžœžœž˜'Jšœ9žœ˜A—Jšœ˜0Jšœ˜%šžœžœž˜'Jšœžœžœ˜,—Jšœ!˜8J˜!J˜J˜—Jšœžœžœ˜J˜šŸœž œžœžœ˜+Jšžœžœžœ˜Jšžœžœžœžœ˜-Jš žœžœžœžœžœ˜2Jš žœžœžœžœžœ˜2Jšžœžœ ˜J˜—š Ÿœžœžœžœžœ˜)Jšžœžœžœ˜Jš žœ žœ žœ žœžœ˜5Jšžœžœžœ ˜Jšžœžœžœžœ ˜"Jšžœžœžœžœ˜%J˜—šŸ œžœž˜Jšœ&žœ˜*Jšžœžœ˜3Jšœžœ˜Jšœžœ˜Jš žœ%žœžœžœ ˜IJšœžœ žœžœ˜8šžœžœ ž˜-Jšœ žœžœ˜7Jšœžœ˜Jšžœ*žœ˜6———Jšžœ˜—šžœžœž˜+Jšœ žœžœ ˜5Jšœžœ˜6Jšžœ˜šžœž˜Jšœžœžœžœ˜1Jšœ žœ˜1Jšžœ˜—Jšžœ˜—šžœžœ˜5Jšž˜J˜J˜J˜%Jšœžœ˜.Jšžœ˜—Jšžœžœ ˜5J˜—š Ÿ œžœžœ žœžœ˜1Jšžœžœ˜3Jšœžœ˜Jšœžœ˜Jš žœ žœžœžœžœ ˜4Jšœžœžœžœ˜Ošžœžœ ž˜-Jšœ žœžœ˜7Jšžœžœ˜'Jšžœ˜šžœž˜Jšœžœžœžœ˜0Jšœ žœ˜1Jšžœ˜—Jšžœ˜—šžœžœ˜5Jšž˜J˜J˜J˜*Jšœžœ˜-Jšžœ˜—Jšžœžœ ˜5J˜—Jš™J˜šŸœžœžœ˜J˜J˜—Jšžœ˜J˜—…—˜¹