Text preview for : Directory.mesa_Oct77.pdf part of xerox Directory.mesa Oct77 xerox mesa 3.0_1977 listing Directory.mesa_Oct77.pdf



Back to : Directory.mesa_Oct77.pdf | Home

directory.mESA 24-0CT-77 10:38:25 Page 1


-- Directory.Mesa Edited by Sandman on August 23, 1977 9:40 PM
DIRECTORY
AltoDefs: FROM "altodefs",
BFSDefs: FROM "bfsdefs",
DirectoryDefs: FROM "directorydefs",
SegmentDefs: FROM "segmentdefs",
StringDefs: FROM "stringdefs",
StreamDefs: FROM "streamdefs",
AltoFileDefs: FROM "altofiledefs";
DEFINITIONS FROM Segmentoefs, StringDefs, AltoFileoefs, StreamDefs;
Directory: PROGRAM
IMPORTS BFSDefs, Segmentoefs, Streamoefs, StringDeFs EXPORTS DirectoryDeFs BEGIN
FPptr: TYPE POINTER:O FP;
DVptr: TYP.E = POINTER TO DV;
HDptr: TYPE = POINTER TO Ho;
BadFilename: PUBLIC SIGNAL [name:STRING] = CODE;
BadDirectory: PUBLIC SIGNAL [name:STRING] = CODE;
EnumerateDirectory: PUBLIC PROCEDURE (
proc:PROCEDURE [POINTER TO FP, STRING] RETURNS [BOOLEAN]]
BEGIN
PassItOn: PROCEDURE [i:StreamIndex, dv:DVptr, s:STRING] RETURNS [BOOLEAN]
BEGIN fp: FP;
IF dv.type = DEFile THEN
BEGIN
BFSDefs.MakeFP[@fp,@dv.fp];
RETURN[proc[@fp,s]]
END;
RETURN[FALSE]
END;
dir: StreamHandle ~ CreateWordStream[SysDir,Read];
[J ~ EnumerateEntries[dir,PassItOn];
dir.destroy[dir];
RETURN
END:
DirectoryLookup: PUBLIC PROCEDURE [fp:FPptr, name:STRING, create:BOOLEAN]
RETURNS [old:BOOLEAN] =
BEGIN
dir: Streamllandle; access: AccessOptions; hd: HD;
fn: STRING ~ [FilenameChars]; ExpandFilename[name,Fn];
access ~ IF -create THEN Read ELSE Read+Write+Append;
dir ~ CreateWordStream[SysDir,access];
old ~ FindName[dir,fp,fn,@hd].found;
IF -old AND create THEN
BEGIN
-- should be @dir.file.fp
BFSDefs.CreateFile[fn,fp,@SysDirFP];
MakeEntry[dir,fp,fn,@hd];
END:
dir.destroy[dir]:
RETURN
END;
DirectorylookupFP: PUBLIC PROCEDURE [fp:FPptr, name:STRING]
R[TURNS [old:BOOI.[AN]