DIRECTORY Atom, CD, CDBasics, CDCallSpecific, CDCommandOps, CDCommandOpsExtras3, CDInstances, CDLayers, CDIO, CDOps, CDPanel, CDProperties, CDRects, CDSequencer, CDSimpleOps, CDValue, CDViewer, CDVArrow, CDVPrivate, CDVScale, IO, ProcessProps, Rope, TiogaMenuOps, TerminalIO, ViewerClasses USING [Viewer], ViewerOps; CDExtraCommands: CEDAR PROGRAM IMPORTS Atom, CD, CDBasics, CDCallSpecific, CDCommandOps, CDCommandOpsExtras3, CDInstances, CDIO, CDLayers, CDOps, CDPanel, CDProperties, CDRects, CDSequencer, CDSimpleOps, CDValue, CDVArrow, CDViewer, CDVScale, IO, ProcessProps, TiogaMenuOps, TerminalIO, ViewerOps = BEGIN WithWDir: PROC [wDir: Rope.ROPE, proc: PROC] = { ProcessProps.AddPropList[ propList: Atom.PutPropOnList[NIL, $WorkingDirectory, wDir], inner: proc ]; }; HelpComm: PROC [comm: CDSequencer.Command] = BEGIN Do: PROC [] = { v: ViewerClasses.Viewer _ TiogaMenuOps.Open["CDCrib.tioga"]; IF v#NIL THEN ViewerOps.OpenIcon[v]; }; WithWDir[CDIO.GetWorkingDirectory[NIL], Do]; TerminalIO.WriteRope["for more documentation, open also\n ChipNDaleIntroduction.tioga\n ChipNDaleDoc.tioga\n ChipNDaleToolsDoc.tioga\n"]; END; verbosity: INT _ 1; CoordinatesCommand: PROC [comm: CDSequencer.Command] = BEGIN WriteInLambda: PROC [n: CD.Number] = { TerminalIO.WriteRope[CDCommandOps.LambdaRope[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[CDCommandOps.LambdaRope[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"]; CDVArrow.ShowArrow[comm.design, comm.pos]; END; RemoveArrow: PROC [comm: CDSequencer.Command] = BEGIN TerminalIO.WriteRope["remove arrow\n"]; CDVArrow.RemoveArrow[comm.design]; END; ArrowInformation: PROC [comm: CDSequencer.Command] = BEGIN WriteInLambda: PROC [n: CD.Number] = { TerminalIO.WriteRope[CDCommandOps.LambdaRope[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[CDCommandOps.LambdaRope[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 { TerminalIO.WriteRope[CDCommandOps.InstRope[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.GetLayerProp[layer, $DontUse]=NIL THEN { TerminalIO.WriteRopes[" ", CDOps.LayerName[layer], "\n"]; CDLayers.SetCurrentLayer[comm.design, layer]; } ELSE TerminalIO.WriteRope[" NOT DONE\n"]; CDOps.ReOrderInstance[comm.design, inst] } END; GridComm: PROC [comm: CDSequencer.Command] = BEGIN GetScaleRec: PROC [comm: CDSequencer.Command] RETURNS [CDVScale.ScaleRec] = BEGIN v: ViewerClasses.Viewer _ CDViewer.GetViewer[comm]; IF v#NIL THEN WITH v.data SELECT FROM my: CDVPrivate.VRef => RETURN [my.scale] ENDCASE => NULL; TerminalIO.WriteRope["no viewer\n"]; ERROR ABORTED END; scale: CDVScale.ScaleRec; TerminalIO.WriteRope["move to grid positions\n"]; scale _ GetScaleRec[comm]; 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]; CDOps.RedrawInstance[comm.design, l.first]; l.first.location _ CDBasics.AddPoints[l.first.location, CDBasics.SubPoints[gridded, pos]]; CDOps.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}; CDOps.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.errorLayer 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]; TerminalIO.WriteRopes[CDCommandOps.InstRope[inst], "\n"]; 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.errorLayer THEN { cnt _ cnt+1; l.first.selected _ TRUE; CDOps.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[$MoveToGrid, GridComm]; CDSequencer.ImplementCommand[$IncreaseByWidth, IncreaseByWidthComm]; CDSequencer.ImplementCommand[$Help, HelpComm,, dontQueue]; CDCommandOps.ImplementSpecificCommand[specificAtom: $ChangeLayer, tipBase: "ChangeLayer", useFor: "SFXA"]; 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"]; CDCommandOpsExtras3.RegisterCurrentLayerCommand[key: $LayerComment, layer: CD.commentLayer]; CDCommandOpsExtras3.RegisterCurrentLayerCommand[key: $LayerGreen, layer: CD.FetchLayer[NIL, $green]]; CDCommandOpsExtras3.RegisterCurrentLayerCommand[key: $LayerYellow, layer: CD.FetchLayer[NIL, $yellow]]; CDCommandOpsExtras3.RegisterCurrentLayerCommand[key: $LayerRed, layer: CD.FetchLayer[NIL, $red]]; CDCommandOpsExtras3.RegisterCurrentLayerCommand[key: $LayerBlue, layer: CD.FetchLayer[NIL, $blue]]; CDSequencer.ImplementCommand[$ShowErrors, ShowErrorComm,, doQueue]; CDSequencer.ImplementCommand[$SelectAllErrors, SelectAllErrorsComm,, doQueue]; CDPanel.DefineButton[name: " menu", command: $GlobalMenu, topLine: TRUE]; CDPanel.DefineButton[name: " help", command: $Help, topLine: TRUE]; END. TCDExtraCommands.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, March 29, 1986 6:11:17 pm PST Last Edited by: Jacobi July 25, 1986 12:17:41 pm PDT Last Edited by: Christian Jacobi, September 4, 1986 3:54:09 pm PDT Κ ˜codešœ*™*Kšœ Οmœ7™BKšœ+™+Kšœ;™;K™4K™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šœ ˜ Kšœžœ ˜Kšœ ˜ —K˜šΠlnœžœž˜KšžœΝžœ6˜Œ—Kšž˜K˜šΟnœžœ žœžœ˜0šœ˜Kšœžœ˜;Kšœ ˜ K˜—K˜—K˜š œžœ˜,Kšž˜š œžœ˜Kšœ<˜Kšœžœ8˜AKšžœžœžœ#˜4Kšœ+žœ˜1Kšœ˜—Kšžœ˜—Kšœ%žœ ˜2Kšžœ˜—K˜š  œž œ˜7Kšž˜Kšœ žœ,˜8Kšœ žœžœ˜Kšœ%˜%š žœžœ!žœžœž˜8šžœžœ žœ˜(Kšœžœ˜Kšœ žœ˜šžœžœ˜Kšœžœ$˜-Kšœžœ˜Kšœ(žœ˜/Kšœ9˜9šžœ>žœžœž˜PKšœi˜iKšžœ˜—Kšœ)˜)Kšž˜K˜—K˜—šžœžœ˜Kšžœ žœG˜XKšžœ2˜6—Kšžœ˜—Kšžœ˜—K˜š œžœ˜7Kšž˜Kšœžœ˜ Kšœ%˜%š žœžœ4žœžœž˜Kšžœžœ žœ˜(Kšœ ˜ Kšœžœ˜Kšœ+žœ˜1K˜—Kšžœ˜—Kšœ,žœ ˜9Kšžœ˜—K˜K˜Kšœžœ ˜K˜KšœD˜DKšœH˜HKšœI˜IKšœE˜EKšœ<˜