-- CDCount.mesa
-- by: Ch. Jacobi, February 20, 1985 10:24:24 am PST
-- last edited by: Ch. Jacobi, March 19, 1986 4:49:51 pm PST
DIRECTORY
CD,
Commander USING [CommandProc, Handle, Register],
IO USING [PutF, int],
SweepCollectableStorage USING [InfoProc, EnumerateCollectableStorage];
CDCount: CEDAR PROGRAM
IMPORTS Commander, IO, SweepCollectableStorage =
BEGIN
Count: Commander.CommandProc =
-- PROC [cmd: Commander.Handle] RETURNS [result: REF ANY←NIL, msg: ROPE←NIL]
BEGIN
EachObject: SweepCollectableStorage.InfoProc =
PROC [type: SafeStorage.Type, size: INT, object: ..] RETURNS [continue: BOOL]
BEGIN
IF type=CODE[CD.InstanceRep] THEN inst ← inst+1
ELSE IF type=CODE[CD.ObjectRep] THEN ob ← ob+1
ELSE IF type=CODE[CD.CellRep] THEN cell ← cell+1
ELSE IF type=CODE[CD.ObjectClass] THEN obProcs ← obProcs+1
ELSE IF type=CODE[CD.DesignRec] THEN design ← design+1
ELSE others ← others+1;
RETURN [TRUE];
END;
others: INT ← 0;
inst: INT ← 0;
ob: INT ← 0;
cell: INT ← 0;
obProcs: INT ← 0;
design: INT ← 0;
TRUSTED { SweepCollectableStorage.EnumerateCollectableStorage[EachObject] };
cmd.out.PutF["Instances = %g\n", IO.int[inst]];
cmd.out.PutF["Objects = %g\n", IO.int[ob]];
cmd.out.PutF["Cells = %g\n", IO.int[cell]];
cmd.out.PutF["Object classes = %g\n", IO.int[obProcs]];
cmd.out.PutF["designs = %g\n", IO.int[design]];
cmd.out.PutF["others = %g\n", IO.int[others]];
END;
Commander.Register[key: "///Commands/CDCount", proc: Count, doc: "Count features of ChipNDale"];
END.