CDPExt.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Created by Jacobi, December 12, 1985 2:19:57 pm PST
Last edited by: Christian Jacobi, August 25, 1986 12:27:37 pm PDT
DIRECTORY
CD,
CDBottomUp,
CDCommandOps,
CDCommandOpsExtras2,
CDOps,
CDTextExtraction,
CDSequencer,
IO,
Rope,
TerminalIO;
CDPExt: CEDAR PROGRAM
IMPORTS CDBottomUp, CDCommandOps, CDCommandOpsExtras2, CDOps, CDTextExtraction, CDSequencer, IO, TerminalIO =
BEGIN
propertyExtractor: CDBottomUp.Class = CDBottomUp.Register[DoExt, ReUseExt];
Message: PROC [handle: CDBottomUp.Handle, ob: CD.Object, errNo: INT, prefix: Rope.ROPE] =
BEGIN
TerminalIO.WriteF[" %g %g; found %g errors\n", IO.rope[prefix], IO.rope[CDOps.ObjectInfo[ob]], IO.int[errNo]];
IF errNo>0 THEN {
handle.cnt ← handle.cnt+1;
handle.r ← IO.PutFR["%g %g errors in %g\n", IO.rope[handle.r], IO.int[errNo], IO.rope[CDOps.ObjectInfo[ob]]]
};
CDSequencer.CheckAborted[handle.design];
END;
DoExt: CDBottomUp.DoProc =
BEGIN
errNo: INT ~ CDTextExtraction.ExtractProperties[handle.design, ob].errors;
Message[handle, ob, errNo, "extracting properties: "];
val ← NEW[INT𡤎rrNo];
END;
ReUseExt: CDBottomUp.ReUseProc =
BEGIN
WITH previousVal SELECT FROM
ri: REF INT => Message[handle, ob, ri^, "previously extracted properties: "];
ENDCASE => NULL;
END;
HierarchicalPropertyExtractionComm: PROC [comm: CDSequencer.Command] =
BEGIN
HierarchicalPropertyExtraction: PROC [design: CD.Design, ob: CD.Object] =
BEGIN
h: CDBottomUp.Handle ← CDBottomUp.StartRecurse[propertyExtractor, design, ob].handle;
IF h.cnt=0 THEN TerminalIO.WriteRope["no errors found\n"]
ELSE TerminalIO.WriteF1["error(s) found in %g object(s)\n", [integer[h.cnt]]]
END;
inst: CD.Instance ← CDCommandOps.TheInstance[comm, "Hierarchical Property extraction"];
IF inst#NIL THEN HierarchicalPropertyExtraction[comm.design, inst.ob];
END;
CDCommandOpsExtras2.RegisterWithMenu[menu: $ProgramMenu, entry: "Hierarchical Property extraction", proc: HierarchicalPropertyExtractionComm, key: $HPExt];
END.