PFSPrefixMapExtras.mesa
Copyright Ó 1990 by Xerox Corporation. All rights reserved.
Willie-s, July 26, 1990 1:12 pm PDT
DIRECTORY
PFSPrefixMap USING [EntryList, TranslationWithHints],
PFSNames USING [PATH],
Rope USING [ROPE];
PFSPrefixMapExtras: CEDAR DEFINITIONS
~ BEGIN
Copied Types
ROPE: TYPE = Rope.ROPE;
PATH: TYPE = PFSNames.PATH;
EntryList: TYPE = PFSPrefixMap.EntryList;
TranslationWithHints: TYPE = PFSPrefixMap.TranslationWithHints;
Types
PrefixTableList: TYPE ~ LIST OF PrefixTableEntry;
PrefixTableEntry: TYPE ~ RECORD [
prefix: PATH,
translation: PATH,
fsName: ROPE,
suppliedPrefixLen: CARDINAL ← 0
];
Procedures
These are like the procedures in PFSPrefixMap, except that they can be supplied with an alternate mapping list. If pTable is NIL, it defaults to the builtin mapping.
TranslateWithPTable: PROC [name: PATH, pTable: PrefixTableList ← NIL] RETURNS [PATH];
Returns name with the translation corresponding to the longest prefix of name appearing in the map substituted for that prefix.
TranslateAndGetHintsWithPTable: PROC [name: PATH, pTable: PrefixTableList ← NIL]
RETURNS [TranslationWithHints];
TranslationWithHints.translation = Translate[name]; Other fields could be computed by the client but are more easily computed in this impl (because they can be cached).
InsertIntoPTable: PROC [prefix: PATH, translation: PATH, pTable: PrefixTableList ← NIL]
RETURNS[newPTable: PrefixTableList];
Adds a translation to pTable for prefix. Replace any existing translation.
InsertIntoNewPTable: PROC [prefix: PATH, translation: PATH]
RETURNS[newPTable: PrefixTableList];
To start a new PrefixTableList.
DeleteFromPTable: PROC [name: PATH, pTable: PrefixTableList ← NIL]
RETURNS [existing: PATH, newPTable: PrefixTableList];
Removes any translation in the map for prefix. Returns the existing translation (or NIL if none).
LookupWithPTable: PROC [prefix: PATH, pTable: PrefixTableList ← NIL] RETURNS [PATH];
Returns the translation of prefix (exact match required); NIL if none;
GetMapFromPTable: PROC [pTable: PrefixTableList ← NIL] RETURNS [EntryList];
Returns the entire map from pTable.
SetMapFromPTable: PROC [pTable: PrefixTableList ← NIL];
Returns the entire map from pTable.
FromMapToPTable: PROC [map: EntryList ← NIL] RETURNS[PrefixTableList];
Sets the entire map.
END.