<> <> <> <> DIRECTORY CD, CDBasics, CDLayers, CDInstances, CDOps, CDPrivate, CDSequencer, CDSymbolicObjects, Rope, TerminalIO; CDSymbolicObjectsCommands: CEDAR PROGRAM IMPORTS CDBasics, CDLayers, CDInstances, CDOps, CDSequencer, CDSymbolicObjects, TerminalIO SHARES CDSymbolicObjects = BEGIN MakePinComm: PROC [comm: CDSequencer.Command] = BEGIN name: Rope.ROPE; r: CD.Rect = CDBasics.ToRect[comm.pos, comm.sPos]; inst: CD.Instance; layer: CD.Layer _ CDLayers.CurrentLayer[comm.design]; layer _ CDLayers.AbstractToPaint[layer]; TerminalIO.PutRopes["draw Pin (", CDOps.LayerRope[layer], ")\n"]; name _ TerminalIO.RequestRope[" type name of pin: "]; inst _ CDSymbolicObjects.CreateSymInst[denotes: r, layer: layer, name: name]; CDOps.IncludeInstance[comm.design, inst]; END; MakeSegmentComm: PROC [comm: CDSequencer.Command] = BEGIN name: Rope.ROPE; r: CD.Rect = CDBasics.ToRect[comm.pos, comm.sPos]; inst: CD.Instance; layer: CD.Layer _ CDLayers.CurrentLayer[comm.design]; TerminalIO.PutRopes["draw Segment (", CDOps.LayerRope[layer], ")\n"]; layer _ CDLayers.AbstractToPaint[layer]; name _ TerminalIO.RequestRope[" type name of segment: "]; inst _ CDSymbolicObjects.CreateSymInst[denotes: [x1: r.x1, x2: r.x2, y1: r.y1, y2: r.y1], layer: layer, name: name]; CDOps.IncludeInstance[comm.design, inst]; END; MakeMarkComm: PROC [comm: CDSequencer.Command] = BEGIN name: Rope.ROPE; inst: CD.Instance; r: CD.Rect = CDBasics.RectAt[comm.pos, [0, 0]]; TerminalIO.PutRope["draw mark object\n"]; name _ TerminalIO.RequestRope[" type name of mark: "]; inst _ CDSymbolicObjects.CreateSymInst[denotes: r, name: name]; CDOps.IncludeInstance[comm.design, inst]; END; DefaultIRComm: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["default the interest rect\n"]; IF comm.design.actual.rest=NIL THEN TerminalIO.PutRope[" not pushed in; not done\n"] ELSE { oldWir: CD.Rect _ comm.design^.actual.first.specific.ir; newWir: CD.Rect _ CDInstances.BoundingRectI[CDOps.InstList[comm.design]]; comm.design.actual.first.specific.ir _ newWir; comm.design.actual.first.specific.specifiedIr _ FALSE; CDOps.Redraw[comm.design, CDBasics.Surround[oldWir, newWir]]; }; }; SetIRComm: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["set the interest rect\n"]; IF comm.design.actual.rest=NIL THEN TerminalIO.PutRope[" not pushed in; not done\n"] ELSE { mightReplace: CD.Instance _ comm.design^.actual.first.mightReplace; oldWir: CD.Rect = comm.design^.actual.first.specific.ir; newWir: CD.Rect = CDBasics.ToRect[comm.pos, comm.sPos]; -- new interest rect comm.design.actual.first.specific.ir _ newWir; comm.design.actual.first.specific.specifiedIr _ TRUE; CDOps.Redraw[comm.design, CDBasics.Surround[oldWir, newWir]]; }; }; CDSequencer.ImplementCommand[$DrawMark, MakeMarkComm]; CDSequencer.ImplementCommand[$DrawPin, MakePinComm]; CDSequencer.ImplementCommand[$DrawSegment, MakeSegmentComm]; CDSequencer.ImplementCommand[$DefaultIR, DefaultIRComm]; CDSequencer.ImplementCommand[$SetIR, SetIRComm]; END.