PFSPrefixMapInit.mesa
Copyright Ó 1989, 1990, 1991, 1992, 1993 by Xerox Corporation. All rights reserved.
Carl Hauser, January 18, 1990 1:19:22 pm PST
Michael Plass, February 22, 1992 0:48:07 am PST
Willie-sue & Michael Plass, December 17, 1991 2:33 pm PST
Willie-sue, June 25, 1993 10:39 am PDT
Chauser, March 20, 1992 11:11 am PST
Christian Jacobi, March 31, 1993 3:27 pm PST
DIRECTORY EnvironmentVariables, IO, PFS, PFSPrefixMap, Rope;
PFSPrefixMapInit: CEDAR PROGRAM
IMPORTS EnvironmentVariables, IO, PFS, PFSPrefixMap, Rope
~ BEGIN
Item: PROC [prefix, translation: Rope.ROPE] ~ {
IF Rope.IsEmpty[translation] THEN [] ¬ PFSPrefixMap.Delete[PFS.PathFromRope[prefix]]
ELSE [] ¬ PFSPrefixMap.Insert[
prefix: PFS.PathFromRope[prefix],
translation: PFS.PathFromRope[translation]
];
};
CheckDir: PROC[where: Rope.ROPE] RETURNS[ok: BOOL ¬ TRUE] ~ {
[] ¬ PFS.FileInfo[PFS.PathFromRope[where] ! PFS.Error => { ok ¬ FALSE; CONTINUE} ];
};
allows one to redefine the default prefixmap mapping early in the world
the format for the file is to be (quotes are necessary):
"/foo" "-vux:/a/b/c"
"/fie/bar" "-ux:/z/y/x"
CheckForEnvironmentVar: PROC ~ {
fileName: Rope.ROPE ~ EnvironmentVariables.Get["CEDAR←PREFIXMAP←INIT"];
stream: IO.STREAM;
IF fileName = NIL THEN RETURN;
stream ¬ PFS.StreamOpen[PFS.PathFromRope[fileName] ! PFS.Error, IO.Error => CONTINUE];
IF stream = NIL THEN RETURN;
BEGIN ENABLE IO.Error, IO.EndOfStream => { IO.Close[stream]; GOTO quit};
UNTIL IO.EndOf[stream] DO
entry: Rope.ROPE ~ IO.GetRopeLiteral[stream];
translation: Rope.ROPE ~ IO.GetRopeLiteral[stream];
Item[entry, translation];
ENDLOOP;
IO.Close[stream];
EXITS quit => NULL;
END;
};
Item["/cedar7.0",  "-vux:/pseudo/cedar7.0"];
Item["/cedarchest7.0", "-vux:/pseudo/cedarchest7.0"];
Item["/cedarcommon2.0", "-vux:/pseudo/cedarcommon2.0"];
Item["/imagerfonts", "-ux:/import/imagerfonts"];
IF CheckDir["/project/imagerfonts/"] THEN
Item["/imagerfonts", "-ux:/project/imagerfonts"]
ELSE
Item["/imagerfonts", "-ux:/project/pcedar2.0/imagerfonts"];
Item["/pcedar2.0", "-vux:/pseudo/pcedar2.0"];
Item["/release", "-vux:/project/cedar10.1/release"];
Item["/cedar10.1", "-vux:/project/cedar10.1/release"];
Item["/cedar", "-vux:/project/cedar10.1/release"];
Item["/ux/",  "-ux:/"];
Item["/vux/", "-vux:/"];
Item["/xrhome", "-ux:/pseudo/xrhome"];
Item["/SchemeXerox", "-vux:/project/schemexerox"];
CheckForEnvironmentVar[];
END.