PFSTest.mesa
Copyright Ó 1991 by Xerox Corporation. All rights reserved.
Carl Hauser, June 8, 1989 4:08:57 pm PDT
Willie-s, February 12, 1991 6:17 pm PST
DIRECTORY
BasicTime,
FS,
PFS,
PFSNames,
Rope,
PFSCanonicalNames;
PFSTest: CEDAR PROGRAM
IMPORTS BasicTime, PFS, FS, PFSCanonicalNames
~ BEGIN
PFSEnum: PROC [ path: Rope.ROPE, lbound: Rope.ROPE ¬ NIL, hbound: Rope.ROPE ¬ NIL ] RETURNS [files: CARD ¬ 0, secs: CARD] ~ {
eachName: PFS.NameProc ~ { files ¬ files+1; };
start: BasicTime.GMT ¬ BasicTime.Now[];
PFS.EnumerateForNames[ PFSCanonicalNames.ParseName[path], eachName, PFSCanonicalNames.ParseName[lbound], PFSCanonicalNames.ParseName[hbound] ];
secs ¬ BasicTime.Period[start, BasicTime.Now[]];
};
FSEnum: PROC [ path: Rope.ROPE ] RETURNS [files: CARD ¬ 0, secs: CARD] ~ {
eachName: FS.NameProc ~ { files ¬ files+1; RETURN[TRUE] };
start: BasicTime.GMT ¬ BasicTime.Now[];
FS.EnumerateForNames[ path, eachName ];
secs ¬ BasicTime.Period[start, BasicTime.Now[]];
};
PFSInfoEnum: PROC [ path: Rope.ROPE, lbound: Rope.ROPE ¬ NIL, hbound: Rope.ROPE ¬ NIL ] RETURNS [files: CARD ¬ 0, secs: CARD, totalBytes: CARD ¬ 0] ~ {
eachName: PFS.InfoProc ~ { files ¬ files+1; totalBytes ¬ totalBytes + bytes };
start: BasicTime.GMT ¬ BasicTime.Now[];
PFS.EnumerateForInfo[ PFSCanonicalNames.ParseName[path], eachName, PFSCanonicalNames.ParseName[lbound], PFSCanonicalNames.ParseName[hbound] ];
secs ¬ BasicTime.Period[start, BasicTime.Now[]];
};
FSInfoEnum: PROC [ path: Rope.ROPE ] RETURNS [files: CARD ¬ 0, secs: CARD, totalBytes: CARD ¬ 0] ~ {
eachName: FS.InfoProc ~ { files ¬ files+1; totalBytes ¬ totalBytes + bytes; RETURN[TRUE] };
start: BasicTime.GMT ¬ BasicTime.Now[];
FS.EnumerateForInfo[ path, eachName ];
secs ¬ BasicTime.Period[start, BasicTime.Now[]];
};
END.