DIRECTORY BasicTime, CD, CDBasics, CDInstances, CDLayers, CDSimpleOps, CDOps, CDRects, CDSequencer, TerminalIO; CDBasicCommands: CEDAR PROGRAM IMPORTS BasicTime, CDInstances, CDLayers, CDSimpleOps, CDOps, CDSequencer, TerminalIO, CDRects, CDBasics = BEGIN AddARect: PROC [design: CD.Design, r: CD.Rect, l: CD.Layer] = { IF CDBasics.NonEmpty[r] THEN { ob: CD.Object; sz: CD.Position _ CDBasics.SizeOfRect[r]; orient: CD.Orientation _ original; IF sz.y=start.x-wireWidth AND (stop.ystart.y+wireWidth) THEN { --crazy vertical wire IF ABS[start.y-stop.y]=start.y AND stop.y<=start.y+wireWidth THEN { --horizontal wire stop.y _ start.y+wireWidth; AddARect[comm.design, CDBasics.ToRect[start, stop], comm.l] } ELSE { --L shaped (firsthorizontal) IF start.x<=stop.x THEN {stop.x _ stop.x+wireWidth} ELSE {t: CD.Number=stop.x; stop.x _ start.x; start.x _ t}; stop.y _ start.y+wireWidth; AddARect[comm.design, CDBasics.ToRect[start, stop], comm.l]; IF firstOnly THEN RETURN; start.x _ comm.pos.x; stop.y _ comm.pos.y; stop.x _ start.x+wireWidth; AddARect[comm.design, CDBasics.ToRect[start, stop], comm.l]; } } ELSE { -- NOT firstHorizontalVC -- IF stop.y<=start.y AND stop.y>=start.y-wireWidth AND (stop.xstart.x+wireWidth) THEN { --crazy horizontal wire IF ABS[stop.x-start.x]=start.x AND stop.x<=start.x+wireWidth THEN { --vertical wire stop.x _ start.x+wireWidth; AddARect[comm.design, CDBasics.ToRect[start, stop], comm.l] } ELSE { --L shaped (firstVertical) IF start.y<=stop.y THEN {stop.y _ stop.y+wireWidth} ELSE {t: CD.Number = stop.y; stop.y _ start.y; start.y _ t}; stop.x _ start.x+wireWidth; AddARect[comm.design, CDBasics.ToRect[start, stop], comm.l]; IF firstOnly THEN RETURN; start.y _ comm.pos.y; stop.y _ start.y+wireWidth; stop.x _ comm.pos.x; AddARect[comm.design, CDBasics.ToRect[start, stop], comm.l]; } } }; DeleteSelected: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["delete selected "]; CDSimpleOps.DeleteSelected[comm.design]; TerminalIO.PutRope["\n"]; }; Undelete: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["un-delete\n"]; CDSimpleOps.Undelete[comm.design] }; AbortCommand: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["try to abort current command\n"]; CDSequencer.AbortDesignsCommand[comm.design] }; SelectExclusive: PROC [comm: CDSequencer.Command] = { TerminalIO.PutRope["select pointed "]; CDSimpleOps.DeselectAll[comm.design]; CDSimpleOps.Select[comm.design, comm.pos]; TerminalIO.PutRope["\n"]; }; MatchLayer: PROC [template, found: CD.Layer] RETURNS [BOOL] = INLINE { IF template#CD.undefLayer THEN IF CDLayers.AbstractToPaint[template]#CDLayers.AbstractToPaint[found] THEN RETURN [FALSE]; RETURN [TRUE] }; ReSelectExclusive: PROC [design: CD.Design, pos: CD.Position, verbose: BOOL_TRUE, layer: CD.Layer_CD.undefLayer] RETURNS [done: BOOL_TRUE] = { Deselect: PROC [i: CD.Instance] = INLINE { IF i.selected THEN { i.selected _ FALSE; CDOps.RedrawInstance[design, i] } }; DeselectList: PROC [list: CD.InstanceList] = { FOR w: CD.InstanceList _ list, w.rest WHILE w#NIL DO Deselect[w.first] ENDLOOP }; ValidForSelection: PROC [inst: CD.Instance] RETURNS [BOOL] = INLINE { RETURN [ CDInstances.PointToI[pos, inst] AND MatchLayer[layer, inst.ob.layer] ]; }; inst: CD.Instance _ NIL; --any instance where pos points to FOR w: CD.InstanceList _ CDOps.InstList[design], w.rest WHILE w#NIL DO IF ValidForSelection[w.first] THEN { IF w.first.selected THEN { DeselectList[w.rest]; CDOps.ReOrderInstance[design, w.first]; IF verbose THEN TerminalIO.PutRope[CDOps.InstRope[w.first]]; RETURN } ELSE IF inst=NIL THEN inst _ w.first } ELSE Deselect[w.first] ENDLOOP; IF inst#NIL THEN { inst.selected _ TRUE; CDOps.ReOrderInstance[design, inst]; CDOps.RedrawInstance[design, inst, FALSE]; IF verbose THEN TerminalIO.PutRope[CDOps.InstRope[inst]] } ELSE { done _ FALSE; IF verbose THEN TerminalIO.PutRope[" (no object)"]; } }; RectDist: PROC [pos: CD.Position, r: CD.Rect] RETURNS [CD.Number] = { RETURN [MAX[ (IF pos.xr.x2 THEN (pos.x-r.x2) ELSE 0), (IF pos.yr.y2 THEN (pos.y-r.y2) ELSE 0) ]] }; CloseReSelectExclusive: PROC [design: CD.Design, pos: CD.Position, verbose: BOOL_TRUE, dist: CD.Number_100, layer: CD.Layer_CD.undefLayer] = { IF ~ReSelectExclusive[design, pos, verbose, layer] THEN { inst: CD.Instance _ NIL; FOR w: CD.InstanceList _ CDOps.InstList[design], w.rest WHILE w#NIL DO d: CD.Number = RectDist[pos, CDInstances.InstRectI[w.first]]; IF dšžœ˜Kšœ/˜/KšœI˜IK˜—Kšœ˜—K˜šŸœžœ ˜;Kšœ3˜3KšœJžœ˜OKšœ˜—K˜šŸœžœ ˜4Kšœ%˜%Kšœ%˜%KšœI˜IKšœ˜—K˜šŸ œžœ ˜/Kšœ™Kšœ"˜"Kšžœžœ,˜FKšžœM˜QKšœ˜Kšœ˜—K˜šŸ œžœ ˜2Kšœ(˜(KšœK˜KKšœ˜—K˜šŸœžœ ˜:Kšœ,˜,KšœLžœ˜QKšœ˜—K˜K˜KšœF˜FK˜1Kšœ1˜1K˜:K˜7K˜/KšœF˜FKšœN˜NKšœ`˜`KšœO˜OKšœB˜BK˜KšœJ˜JKšœE˜EKšœ@˜@Kšœ>˜>KšœH˜HKšœN˜NK˜KšœF˜FKšœV˜VKšœH˜HKšœN˜NK˜KšœD˜DKšœT˜TKšœ>˜>Kšžœ˜—…—1 CΖ