PFSPrefixMap.mesa
Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved.
Carl Hauser, June 8, 1989 5:38:45 pm PDT
Willie-s, August 21, 1991 11:12 am PDT
Types
Entry:
TYPE ~
RECORD [
prefix: PATH,
translation: PATH
];
EntryList: TYPE ~ LIST OF Entry;
PrefixTableEntry:
TYPE ~
RECORD [
prefix: PATH,
translation: PATH, -- the complete translation.
fsName: Rope.ROPE, -- the rope part of the first component of the complete translation
nameOnFS: PATH, -- translation with empty server part
replacedPrefix: PATH, -- components in source name replaced ...
suppliedPrefixLen: CARDINAL ¬ 0 -- number of components in translation (and nameOnFS) which replaced them
];
PrefixTableList:
TYPE ~
LIST
OF PrefixTableEntry;
Procedures
these take an optional pTable argument; if not supplied, the default pTable is used
Translate:
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.
TranslateAndGetHints:
PROC [name:
PATH, pTable: PrefixTableList ¬
NIL]
RETURNS [PrefixTableEntry];
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).
Insert:
PROC [prefix:
PATH, translation:
PATH, pTable: PrefixTableList ¬
NIL]
RETURNS [PrefixTableList];
Adds a translation to the map for prefix. Replace any existing translation.
InsertIntoNewPTable:
PROC [prefix:
PATH, translation:
PATH]
RETURNS[newPTable: PrefixTableList];
To start a new PrefixTableList.
Delete:
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).
Lookup:
PROC [prefix:
PATH, pTable: PrefixTableList ¬
NIL]
RETURNS [
PATH];
Returns the translation of prefix (exact match required); NIL if none;
GetMap:
PROC [pTable: PrefixTableList ¬
NIL]
RETURNS [EntryList];
Returns the entire map.
SetMap:
PROC [map: EntryList];
SetMapFromPTable:
PROC [pTable: PrefixTableList ¬
NIL];
Returns the entire map from pTable.
FromMapToPTable:
PROC [map: EntryList ¬
NIL]
RETURNS[PrefixTableList];
alternate forms