DIRECTORY CD, CDBasics, CDCallSpecific, CDCommandOps, CDExtras, CDInstances, CDLayers, CDMenus, CDOps, CDPanel, CDProperties, CDRects, CDSequencer, CDSimpleOps, CDValue, CDViewer, CDVPrivate, CDVScale, IO, Rope, TerminalIO, ViewerClasses USING [Viewer]; CDExtraCommands: CEDAR PROGRAM IMPORTS CD, CDBasics, CDCallSpecific, CDCommandOps, CDExtras, CDInstances, CDLayers, CDMenus, CDOps, CDPanel, CDProperties, CDRects, CDSequencer, CDSimpleOps, CDValue, CDViewer, CDVScale, IO, Rope, TerminalIO = BEGIN verbosity: INT _ 1; CoordinatesCommand: PROC [comm: CDSequencer.Command] = BEGIN WriteInLambda: PROC [n: CD.Number] = { TerminalIO.WriteRope[CDExtras.ToLambda[n, lambda]] }; lambda: INT _ comm.design.technology.lambda; TerminalIO.WriteRope["Coordinates [\024]"]; -- \024 prints as greek lambda TerminalIO.WriteRope[" down: ("]; WriteInLambda[comm.sPos.x]; TerminalIO.WriteRope[","]; WriteInLambda[comm.sPos.y]; TerminalIO.WriteRope[") up: ("]; WriteInLambda[comm.pos.x]; TerminalIO.WriteRope[","]; WriteInLambda[comm.pos.y]; TerminalIO.WriteRope[") dist: ("]; WriteInLambda[comm.pos.x-comm.sPos.x]; TerminalIO.WriteRope[","]; WriteInLambda[comm.pos.y-comm.sPos.y]; TerminalIO.WriteRope[")\n"]; END; SetArrow: PROC [comm: CDSequencer.Command] = BEGIN WriteInLambda: PROC [n: CD.Number] = { TerminalIO.WriteRope[CDExtras.ToLambda[n, lambda]] }; lambda: INT _ comm.design.technology.lambda; TerminalIO.WriteRope["set arrow at ("]; WriteInLambda[comm.pos.x]; TerminalIO.WriteRope[","]; WriteInLambda[comm.pos.y]; TerminalIO.WriteRope[")\024\n"]; CDViewer.ShowArrow[comm.design, comm.pos]; END; RemoveArrow: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["remove arrow\n"]; CDViewer.RemoveArrow[comm.design]; END; ArrowInformation: PROC [comm: CDSequencer.Command] = BEGIN WriteInLambda: PROC [n: CD.Number] = { TerminalIO.WriteRope[CDExtras.ToLambda[n, lambda]] }; lambda: INT _ comm.design.technology.lambda; WITH CDValue.Fetch[comm.design, $arrow, design] SELECT FROM class: REF CD.Position => { TerminalIO.WriteRope[" arrow at: ("]; WriteInLambda[class.x]; TerminalIO.WriteRope[","]; WriteInLambda[class.y]; TerminalIO.WriteRope[") up: ("]; WriteInLambda[comm.pos.x]; TerminalIO.WriteRope[","]; WriteInLambda[comm.pos.y]; TerminalIO.WriteRope[") dist: ("]; WriteInLambda[class.x-comm.pos.x]; TerminalIO.WriteRope[","]; WriteInLambda[class.y-comm.pos.y]; TerminalIO.WriteRope[")\n"]; } ENDCASE => NULL; END; StatisticCommand: PROC [comm: CDSequencer.Command] = BEGIN WriteInLambda: PROC [n: CD.Number] = { TerminalIO.WriteRope[CDExtras.ToLambda[n, lambda]] }; lambda: INT _ comm.design.technology.lambda; countTot: INT _ 0; countSel: INT _ 0; countInvis: INT _ 0; isDesign: BOOL _ FALSE; rect: CD.Rect _ CDBasics.universe; v: ViewerClasses.Viewer _ CDViewer.GetViewer[comm]; inst: CD.Instance; TerminalIO.WriteRope["statistic "]; IF v#NIL THEN rect _ CDViewer.VisibleRect[v]; IF ~CDBasics.NonEmpty[rect] THEN rect _ CDBasics.universe; FOR l: CD.InstanceList _ CDOps.InstList[comm.design], l.rest WHILE l#NIL DO countTot _ countTot+1; IF l.first.selected THEN { IF ~CDBasics.Intersect[rect, CDInstances.InstRectI[l.first]] THEN countInvis _ countInvis+1; countSel _ countSel+1; inst _ l.first } ENDLOOP; TerminalIO.WriteF["%g objects; %g selected\n", IO.int[countTot], IO.int[countSel]]; IF countSel=1 THEN { CDCommandOps.WriteInfo[inst, verbosity]; IF verbosity>0 THEN { ir: CD.Position _ CD.InterestSize[inst.ob]; TerminalIO.WriteRope[" at: ("]; WriteInLambda[inst.location.x]; TerminalIO.WriteRope[","]; WriteInLambda[inst.location.y]; TerminalIO.WriteRope[")\024 i-size: ("]; --\024 prints as greek lambda WriteInLambda[ir.x]; TerminalIO.WriteRope[","]; WriteInLambda[ir.y]; TerminalIO.WriteRope[")\024 orientation-code:"]; --\024 prints as greek lambda TerminalIO.WriteInt[inst.orientation]; }; TerminalIO.WriteLn[]; }; ArrowInformation[comm]; IF countInvis#0 THEN TerminalIO.WriteF1[" **** %g invisible selected object(s)\n", IO.int[countInvis]]; END; SelectIfLayer: CDCallSpecific.CallProc = BEGIN IF inst.ob.layer#NARROW[x, REF CD.Layer]^ THEN {done_FALSE; RETURN}; IF inst.selected THEN RETURN; inst.selected _ TRUE; repaintMe _ TRUE END; AddSelectLayer: PROC [comm: CDSequencer.Command] = BEGIN reflev: REF CD.Layer _ NEW[CD.Layer _ CDLayers.CurrentLayer[comm.design]]; n: INT _ CDCallSpecific.CallForAll[design: comm.design, whatElse: SelectIfLayer, x: reflev]; TerminalIO.WriteF["select all %g objects: (%g)\n", IO.rope[CDOps.LayerName[reflev^]], IO.int[n]]; END; SetLayerCommand: PROC [comm: CDSequencer.Command] = BEGIN inst: CD.Instance = CDCommandOps.TheInstance[comm, "Set default layer"]; IF inst#NIL THEN { layer: CD.Layer = inst.ob.layer; IF inst.ob.class.wireTyped AND CDProperties.GetPropFromLayer[layer, $DontUse]=NIL THEN { TerminalIO.WriteRope[Rope.Cat[" ", CDOps.LayerName[layer], "\n"]]; CDLayers.SetCurrentLayer[comm.design, layer]; } ELSE TerminalIO.WriteRope[" NOT DONE\n"]; CDOps.ReOrderInstance[comm.design, inst] } END; EnforcePanel: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["enforce a control panel\n"]; [] _ CDPanel.CreatePanel[comm.design] END; GetScaleRec: PROC [x: REF] RETURNS [CDVScale.ScaleRec] = BEGIN WITH x SELECT FROM my: CDVPrivate.VRef => RETURN [my.scale] ENDCASE => ERROR END; GridComm: PROC [comm: CDSequencer.Command] = BEGIN GetScaleRec: PROC [x: REF] RETURNS [CDVScale.ScaleRec] = BEGIN WITH x SELECT FROM my: CDVPrivate.VRef => RETURN [my.scale] ENDCASE => { TerminalIO.WriteRope["no viewer\n"]; ERROR ABORTED } END; scale: CDVScale.ScaleRec; TerminalIO.WriteRope["move to grid positions\n"]; scale _ GetScaleRec[comm.ref]; FOR l: CD.InstanceList _ CDOps.InstList[comm.design], l.rest WHILE l#NIL DO IF l.first.selected THEN { pos: CD.Position _ CDBasics.BaseOfRect[CDInstances.InstRectI[l.first]]; vPos: CD.Position _ CDVScale.DesignToViewerPosition[scale, pos]; gridded: CD.Position _ CDVScale.ViewerToDesignPosition[scale, vPos]; CDCommandOps.RedrawInstance[comm.design, l.first]; l.first.location _ CDBasics.AddPoints[l.first.location, CDBasics.SubPoints[gridded, pos]]; CDCommandOps.RedrawInstance[comm.design, l.first, FALSE]; }; ENDLOOP; END; IncreaseByWidthComm: PROC [comm: CDSequencer.Command] = BEGIN cnt: INT _ 0; TerminalIO.WriteRope["increase wire length by width: "]; FOR l: CD.InstanceList _ CDOps.InstList[comm.design], l.rest WHILE l#NIL DO IF l.first.selected AND l.first.ob.class.wireTyped AND ~l.first.ob.class.symbolic THEN { oldSize: CD.Position _ l.first.ob.size; newSize: CD.Position _ [x: oldSize.x, y: oldSize.x+oldSize.y]; newOb: CD.Object _ CDRects.CreateRect[newSize, l.first.ob.layer]; IF newOb#NIL THEN {l.first.ob _ newOb; cnt _ cnt+1}; CDCommandOps.RedrawInstance[comm.design, l.first, TRUE]; }; ENDLOOP; TerminalIO.WriteF1[" %g objects\n", IO.int[cnt]]; END; ShowErrorComm: PROCEDURE [comm: CDSequencer.Command] = BEGIN applList: CD.InstanceList = CDOps.InstList[comm.design]; foundSome: BOOL _ FALSE; TerminalIO.WriteRope[ "Show error "]; FOR a: CD.InstanceList _ applList, a.rest WHILE a#NIL DO IF a.first.ob.layer=CD.highLightError THEN { inst: CD.Instance = a.first; foundSome _ TRUE; IF ~inst.selected THEN { eRect: CD.Rect = CDInstances.InstRectI[inst]; inst.selected _ TRUE; CDOps.DelayedRedraw[comm.design, eRect, FALSE]; CDCommandOps.WriteInfo[inst]; TerminalIO.WriteLn[]; FOR vl: CDViewer.ViewerList _ CDViewer.ViewersOf[comm], vl.rest WHILE vl#NIL DO CDViewer.ShowAndScale[viewer: vl.first, rect: CDBasics.Extend[eRect, 30*comm.design.technology.lambda] ]; ENDLOOP; CDOps.ReOrderInstance[comm.design, inst]; EXIT } }; REPEAT FINISHED => IF foundSome THEN TerminalIO.WriteRope["All errors in this cell are already selected\n"] ELSE TerminalIO.WriteRope[ "No errors in this cell\n"] ENDLOOP; END; SelectAllErrorsComm: PROC [comm: CDSequencer.Command] = BEGIN cnt: INT _ 0; CDSimpleOps.DeselectAll[comm.design]; FOR l: CD.InstanceList _ CDOps.InstList[comm.design], l.rest WHILE l#NIL DO IF l.first.ob.layer=CD.highLightError THEN { cnt _ cnt+1; l.first.selected _ TRUE; CDCommandOps.RedrawInstance[comm.design, l.first, FALSE] } ENDLOOP; TerminalIO.WriteF["%g error(s) selected\n", IO.int[cnt]]; END; lambda: CD.Number = 1; CDSequencer.ImplementCommand[$SetLayerP, SetLayerCommand,, doQueue]; CDSequencer.ImplementCommand[$AddSelectLayer, AddSelectLayer,, doQueue]; CDSequencer.ImplementCommand[$Coordinates, CoordinatesCommand,, doQueue]; CDSequencer.ImplementCommand[$Statistic, StatisticCommand,, doQueue]; CDSequencer.ImplementCommand[$SetArrow, SetArrow,, doQueue]; CDSequencer.ImplementCommand[$RemoveArrow, RemoveArrow,, doQueue]; CDSequencer.ImplementCommand[$EnforcePanel, EnforcePanel,, doQueue]; CDSequencer.ImplementCommand[$MoveToGrid, GridComm,, doQueue]; CDSequencer.ImplementCommand[$IncreaseByWidth, IncreaseByWidthComm]; CDCommandOps.ImplementSpecificCommand[specificAtom: $Lengthen, tipBase: "Widen", useFor: "SFXA", x: NEW[CD.Position_[lambda, 0]]]; CDCommandOps.ImplementSpecificCommand[specificAtom: $Lengthen, tipBase: "Narrow", useFor: "SFXA", x: NEW[CD.Position_[-lambda, 0]]]; CDCommandOps.ImplementSpecificCommand[specificAtom: $Lengthen, tipBase: "Shorten", useFor: "SFXA", x: NEW[CD.Position_[0, -lambda]]]; CDCommandOps.ImplementSpecificCommand[specificAtom: $Lengthen, tipBase: "Lengthen", useFor: "SFXA", x: NEW[CD.Position_[0, lambda]]]; CDCommandOps.ImplementSpecificCommand[specificAtom: $Default, useFor: "SFXA"]; CDCommandOps.ImplementSpecificCommand[specificAtom: $IncCount, text: "Inc count", useFor: "SFXA"]; CDCommandOps.ImplementSpecificCommand[specificAtom: $DecCount, text: "Dec count", useFor: "SFXA"]; CDSequencer.ImplementCommand[$ShowErrors, ShowErrorComm,, doQueue]; CDMenus.CreateEntry[menu: $SpecialMenu, entry: "select next error", key: $ShowErrors]; CDSequencer.ImplementCommand[a: $SelectAllErrors, p: SelectAllErrorsComm, queue: doQueue]; CDMenus.CreateEntry[menu: $SpecialMenu, entry: "select all error msg's", key: $SelectAllErrors]; END. ήCDExtraCommands.mesa (part of ChipNDale) Copyright c 1983, 1985 by Xerox Corporation. All rights reserved. by Christian Jacobi, July 11, 1983 3:42 pm last edited Christian Jacobi, January 2, 1986 11:57:15 am PST Κ Θ˜codešœ*™*Kšœ Οmœ7™BKšœ+™+Kšœ=™=K˜—šΟk ˜ Kšžœ˜Kšœ ˜ K˜Kšœ ˜ Kšœ ˜ Kšœ ˜ Kšœ ˜ Kšœ˜Kšœ˜Kšœ ˜ Kšœ ˜ Kšœ˜K˜ Kšœ ˜ Kšœ˜Kšœ ˜ Kšœ ˜ Kšœ ˜ Kšžœ˜Kšœ˜K˜ Kšœžœ ˜—K˜šΠlnœžœž˜Kšžœ΅žœ˜Σ—Kšž˜K˜Kšœ žœ˜K˜šΟnœžœ˜6Kšž˜š  œžœžœ ˜&Kšœ2˜2Kšžœ˜—Kšœžœ!˜,Kšœ,Οc˜JK˜#Kšœ˜K˜Kšœ˜K˜"Kšœ˜K˜Kšœ˜K˜$Kšœ&˜&K˜Kšœ&˜&K˜Kšžœ˜K˜—š œžœ˜,Kšž˜š  œžœžœ ˜&Kšœ2˜2Kšžœ˜—Kšœžœ!˜,Kšœ(˜(Kšœ˜K˜Kšœ˜K˜ Kšœ*˜*Kšžœ˜—K˜š  œžœ˜/Kšž˜Kšœ'˜'Kšœ"˜"Kšžœ˜—K˜š œžœ˜4Kšž˜š  œžœžœ ˜&Kšœ2˜2Kšžœ˜—Kšœžœ!˜,šžœ,žœž˜;šœžœžœ˜K˜&Kšœ˜K˜Kšœ˜K˜"Kšœ˜K˜Kšœ˜K˜$Kšœ"˜"K˜Kšœ"˜"K˜Kšœ˜—Kšžœžœ˜—Kšžœ˜—K˜š œžœ˜4Kšž˜š  œžœžœ ˜&Kšœ2˜2Kšžœ˜—Kšœžœ!˜,Kšœ žœ˜Kšœ žœ˜Kšœ žœ˜Kšœ žœžœ˜Kšœžœ˜"Kšœ3˜3Kšœžœ ˜Kšœ#˜#Kšžœžœžœ ˜-Kšžœžœ˜:š žœžœ4žœžœž˜KKšœ˜šžœžœ˜Kšžœ;žœ˜\Kšœ˜Kšœ˜Kšœ˜—Kšžœ˜—Kšœ0žœžœ˜Tšžœ žœ˜Kšœ(˜(šžœ žœ˜Kšœ+˜+Kšœ ˜ Kšœ˜K˜Kšœ˜Kšœ*‘˜GKšœ˜K˜Kšœ˜Kšœ2‘˜OKšœ&˜&K˜—Kšœ˜Kšœ˜—Kšœ˜šžœžœ˜Kšœ?žœ˜S—Kšžœ˜K˜—š  œ˜(Kšž˜Kšžœžœžœžœ žœžœžœ˜DKšžœžœžœ˜Kšœžœ˜Kšœ ž˜Kšžœ˜K˜—š œžœ˜2Kšž˜Kš œžœžœ žœžœ-˜JKšœžœV˜\Kšœ3žœžœ ˜aKšžœ˜—K˜š œžœ˜3Kšž˜Kšœžœ@˜Hšžœžœžœ˜Kšœžœ˜ šžœžœ0žœžœ˜XKšœC˜CKšœ-˜-K˜—Kšžœ&˜*Kšœ(˜(Kšœ˜—Kšžœ˜—K˜š  œžœ˜0Kšž˜Kšœ2˜2Kšœ%˜%Kšžœ˜—K˜š  œžœ žœ˜8Kšž˜šžœžœž˜Kšœžœ ˜(Kšžœž˜—Kšžœ˜—K˜š œžœ˜,Kšž˜š  œžœžœžœ˜8Kšž˜šžœžœž˜Kšœžœ ˜(šžœ˜ Kšœ%˜%Kšžœž˜ K˜——Kšžœ˜—Kšœ˜Kšœ1˜1Kšœ˜š žœžœ4žœžœž˜Kšžœžœ˜Kšœžœ@˜GKšœžœ8˜@Kšœ žœ9˜DKšœ2˜2KšœZ˜ZKšœ2žœ˜9Kšœ˜—Kšžœ˜—Kšžœ˜—K˜š œžœ˜7Kšž˜Kšœžœ˜ Kšœ8˜8š žœžœ4žœžœž˜Kšžœžœžœžœ˜XKšœ žœ˜'Kšœ žœ3˜>Kšœžœ8˜AKšžœžœžœ#˜4Kšœ2žœ˜8Kšœ˜—Kšžœ˜—Kšœ%žœ ˜2Kšžœ˜—K˜š  œž œ˜7Kšž˜Kšœ žœ,˜8Kšœ žœžœ˜Kšœ%˜%š žœžœ!žœžœž˜8šžœžœžœ˜,Kšœžœ˜Kšœ žœ˜šžœžœ˜Kšœžœ$˜-Kšœžœ˜Kšœ(žœ˜/Kšœ˜Kšœ˜šžœ>žœžœž˜PKšœi˜iKšžœ˜—Kšœ)˜)Kšž˜K˜—K˜—šžœžœ˜Kšžœ žœG˜XKšžœ2˜6—Kšžœ˜—Kšžœ˜—K˜š œžœ˜7Kšž˜Kšœžœ˜ Kšœ%˜%š žœžœ4žœžœž˜Kšžœžœžœ˜,Kšœ ˜ Kšœžœ˜Kšœ2žœ˜8K˜—Kšžœ˜—Kšœ,žœ ˜9Kšžœ˜—K˜Kšœžœ ˜KšœD˜DKšœH˜HKšœI˜IKšœE˜EKšœ<˜˜>KšœD˜DKšœdžœžœ˜‚Kšœežœžœ žœ ˜„Kšœfžœžœ˜…Kšœgžœžœ˜…KšœN˜NKšœb˜bKšœb˜bKšœC˜CKšœV˜VKšœZ˜ZKšœ`˜`Kšžœ˜—…—&ϊ2