PFSPrefixMap.mesa
Copyright Ó 1989 by Xerox Corporation. All rights reserved.
Carl Hauser, June 8, 1989 5:38:45 pm PDT
DIRECTORY
PFSNames USING [PATH],
Rope USING [ROPE];
PFSPrefixMap: CEDAR DEFINITIONS
~ BEGIN
Copied Types
PATH: TYPE = PFSNames.PATH;
Types
Entry: TYPE ~ RECORD [
prefix: PATH,
translation: PATH
];
EntryList: TYPE ~ LIST OF Entry;
TranslationWithHints: TYPE ~ RECORD [
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 -- number of components in translation (and nameOnFS) which replaced them
];
Procedures
Translate: PROC [name: PATH] 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] 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).
Insert: PROC [prefix: PATH, translation: PATH];
Adds a translation to the map for prefix. Replace any existing translation.
Delete: PROC [name: PATH] RETURNS [PATH];
Removes any translation in the map for prefix. Returns the existing translation (or NIL if none).
Lookup: PROC [prefix: PATH] RETURNS [PATH];
Returns the translation of prefix (exact match required); NIL if none;
GetMap: PROC [] RETURNS [EntryList];
Returns the entire map.
SetMap: PROC [map: EntryList];
Sets the entire map.
END.