<> <> <> <> 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: REF_NIL; spec: REF ANY_NIL; 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_0; 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.