CDDebug.mesa (part of ChipNDale)
Copyright © 1983, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, June 29, 1983 4:44 pm
last edited Christian Jacobi, April 12, 1985 4:04:34 pm PST
DIRECTORY
CD,
CDVPrivate,
CDEvents,
CDOps,
CDPrivate,
CDSequencer,
IO,
TerminalIO,
PrintTV,
Process USING [Detach],
Rope;
CDDebug: CEDAR PROGRAM
IMPORTS CDOps, CDPrivate, CDSequencer, IO, TerminalIO, PrintTV, Process, CDEvents, Rope =
BEGIN
xdesign: CD.Design; -- some design
MyGraphicRef: TYPE = CDVPrivate.MyGraphicRef;
BreakProc: PROC [comm: CDSequencer.Command] =
BEGIN
me: MyGraphicRef = NARROW[comm.ref];
design: CD.Design = comm.design;
app: CD.ApplicationPtr = CDOps.SelectedApplication[design].first;
ob: CD.ObPtr←NIL;
type: REFNIL;
spec: REF ANYNIL;
IF app#NIL THEN {
ob ← app.ob;
IF ob#NIL THEN {
type ← ob.p.objectType;
spec ← ob.specificRef
}
};
xdesign ← design;
SIGNAL CDPrivate.DebugCall["debug"]
END;
Debug: PROC [comm: CDSequencer.Command] =
BEGIN
n: INT𡤀
n ← TerminalIO.RequestSelection[
label: "Debug options",
choice: LIST["detached debug", "monitored debug"]];
SELECT n FROM
1 => TRUSTED {Process.Detach[FORK BreakProc[comm]]};
2 => BreakProc[comm];
ENDCASE => TerminalIO.WriteRope["skipped\n"];
END;
NewDesign: CDEvents.EventProc =
BEGIN
xdesign ← design
END;
PrintDesign: PrintTV.RefPrintProc =
BEGIN
d: REF READONLY CD.DesignRec ← NARROW[ref];
stream.PutF["{Design: %g, technology: %g}",
IO.rope[IF Rope.Length[d.name]>0 THEN d.name ELSE "(no name)"],
IF d.technology=NIL THEN IO.rope["NIL"]
ELSE IF d.technology.name#NIL THEN IO.rope[d.technology.name]
ELSE IO.atom[d.technology.key]
];
END;
PrintTechnology: PrintTV.RefPrintProc =
BEGIN
t: REF READONLY CD.TechnologyRec = NARROW[ref];
stream.PutF["{Technology: %g}",
IF t=NIL THEN IO.rope["NIL"]
ELSE IF t.name#NIL THEN IO.rope[t.name]
ELSE IO.atom[t.key]
];
END;
Impl: PROC [] =
BEGIN
CDSequencer.ImplementCommand[$Debug, Debug];
CDEvents.RegisterEventProc[$CreateNewDesign, NewDesign];
PrintTV.RegisterRefPrintProc[referentType: CODE[CD.DesignRec], proc: PrintDesign];
PrintTV.RegisterRefPrintProc[referentType: CODE[CD.TechnologyRec], proc: PrintTechnology];
END;
Impl[];
END.