CountReleaseSize.mesa
Russ Atkinson, December 20, 1983 3:58 pm
DIRECTORY
Commander,
FS,
IO,
MessageWindow USING [Append],
Rope,
VersionMap;
CountReleaseSize: CEDAR PROGRAM
IMPORTS Commander, FS, IO, MessageWindow, VersionMap
= BEGIN
Map: TYPE = VersionMap.Map;
ROPE: TYPE = Rope.ROPE;
CountCommand: Commander.CommandProc = {
files: INT ← 0;
pages: INT ← 0;
ifsPages: INT ← 0;
InnerCount: PROC [name: ROPE] = {
map: Map ← VersionMap.RestoreMapFromFile[name];
IO.PutF[cmd.out, " Processing: %g\n", [rope[name]]];
FOR i: INT IN [0..VersionMap.Length[map]) DO
eachName: ROPE ← VersionMap.FetchName[map, i];
bytes: INTFS.FileInfo[eachName
! FS.Error =>
IF error.group # bug THEN {
IO.PutF[cmd.out, "File not found: %g\n", [rope[eachName]]];
LOOP;
}].bytes;
pages ← pages + (bytes+511) / 512;
ifsPages ← ifsPages + (bytes+2047) / 2048;
files ← files + 1;
MessageWindow.Append[
msg ← IO.PutFR[
" files: %g, pages: %g, ifsPages: %g",
[integer[files]], [integer[pages]], [integer[ifsPages]]],
TRUE];
ENDLOOP;
};
InnerCount["CedarSource.VersionMap"];
InnerCount["CedarSymbols.VersionMap"];
};
Commander.Register["CountReleaseSize", CountCommand];
END.