DIRECTORY CD, CDCellsInteractions, CDCells, CDDirectory, CDImports, CDOps, CDProperties, CDSequencer, Core, CoreCDUser, CoreClasses, CoreFlat, CoreGeometry, CoreOps, ExtractOps, IO, Rope, Sinix, TerminalIO, ViewerClasses, ViewerOps; CoreCDUserCmdsImpl: CEDAR PROGRAM IMPORTS CDCellsInteractions, CDCells, CDDirectory, CDImports, CDOps, CDProperties, CDSequencer, CoreCDUser, CoreFlat, CoreGeometry, CoreOps, ExtractOps, IO, Rope, Sinix, TerminalIO, ViewerOps SHARES CDImports = BEGIN ExtractSelectedCellsCommand: PROC [command: CDSequencer.Command] = { NullProcedure: CoreCDUser.EachRootCellTypeProc = {}; [] _ CoreCDUser.EnumerateSelectedCellTypes[command.design, NullProcedure]; TerminalIO.PutRope["CoreCDUser: Done\n"]; }; HighlightSelectedFlatWireCommand: PROC [command: CDSequencer.Command] = { CanonizeWire: PROC [root: Core.CellType, child: CoreFlat.FlatWireRec] RETURNS [parent: CoreFlat.FlatWireRec] = { WindUp: CoreFlat.UnboundFlatCellProc = { FindBoundWire: CoreOps.EachWirePairProc = { IF publicWire=canonized.wire THEN { new _ actualWire; quit _ TRUE; }; }; new: Core.Wire; previousCells _ CONS [cell, previousCells]; previousInstances _ CONS [instance, previousInstances]; CoreFlat.NextUnboundCellType[cell, target, flatCell, instance, index, parent, flatParent, NIL, WindUp]; previousCells _ previousCells.rest; previousInstances _ previousInstances.rest; IF CoreGeometry.HasObject[decoration, cell] AND ExtractOps.SameCDObject[rootObject, CoreGeometry.GetObject[decoration, cell]] THEN stop _ TRUE; IF stop OR previousCells=NIL THEN RETURN; IF instance=previousInstances.first AND cell=previousCells.first THEN RETURN; IF CoreOps.VisitBinding[actual: IF instance=NIL OR instance.type#cell THEN previousCells.first.public ELSE instance.actual, public: cell.public, eachWirePair: FindBoundWire] THEN canonized _ [flatCell: flatParent, wireRoot: IF instance=NIL OR instance.type#cell THEN public ELSE internal, wire: new] ELSE stop _ TRUE; }; canonized: CoreFlat.FlatWireRec _ child; previousCells: LIST OF Core.CellType _ NIL; previousInstances: LIST OF CoreClasses.CellInstance _ NIL; stop: BOOL _ FALSE; WindUp[cell: root, target: child.flatCell]; RETURN [parent: canonized]; }; HighlightAWire: CoreCDUser.SelectedFlatWireActionProc = { flatWires _ CONS[CanonizeWire[root, selectedFlatWire^], flatWires]; }; root: Core.CellType _ CoreCDUser.GetDesignRootCellType[command.design]; decoration: CoreGeometry.Decoration _ CoreCDUser.GetRootCellTypeDecoration[root]; rootObject: CD.Object _ NIL; flatWires: LIST OF CoreFlat.FlatWireRec _ NIL; IF root=NIL THEN TerminalIO.PutRope["CoreCDUser: No root cell type\n"] ELSE { foundNotPower: BOOL _ FALSE; FOR stack: LIST OF CD.PushRec _ command.design.actual, stack.rest WHILE stack.rest#NIL DO rootObject _ stack.first.mightReplace.ob; ENDLOOP; CoreCDUser.DoForSelectedFlatWires[root: root, action: HighlightAWire, design: command.design]; FOR fwl: LIST OF CoreFlat.FlatWireRec _ flatWires, fwl.rest UNTIL fwl=NIL DO canonicalName: Rope.ROPE _ CoreFlat.WirePathRope[root, fwl.first]; IF NOT (Rope.Equal["public.Vdd", canonicalName] OR Rope.Equal["public.Gnd", canonicalName]) THEN { IF foundNotPower THEN { TerminalIO.PutRope["CoreCDUser: Multiple wires not Vdd or Gnd selected:\n"]; FOR afwl: LIST OF CoreFlat.FlatWireRec _ flatWires, afwl.rest UNTIL afwl=NIL DO TerminalIO.PutRopes[" ", CoreFlat.WirePathRope[root, afwl.first], "\n"]; ENDLOOP; TerminalIO.PutRope["CoreCDUser: Cannot highlight more than one wire at once"]; GOTO oops; }; foundNotPower _ TRUE; }; ENDLOOP; FOR fwl: LIST OF CoreFlat.FlatWireRec _ flatWires, fwl.rest UNTIL fwl=NIL DO canonicalName: Rope.ROPE _ CoreFlat.WirePathRope[root, fwl.first]; IF NOT (Rope.Equal["public.Vdd", canonicalName] OR Rope.Equal["public.Gnd", canonicalName]) THEN { CoreCDUser.HighlightFlatWire[root, fwl.first, command.design ! CoreCDUser.CoreCDUserError => {TerminalIO.PutRope[msg]; GOTO oops}]; }; ENDLOOP; TerminalIO.PutRope["CoreCDUser: Done\n"]; EXITS oops => NULL; }; }; PrintSelectedFlatWiresCoreCommand: PROC [command: CDSequencer.Command] = { PrintAWire: CoreCDUser.SelectedFlatWireActionProc = { CoreOps.PrintWire[selectedFlatWire.wire, TerminalIO.TOS[]]; }; root: Core.CellType _ CoreCDUser.GetDesignRootCellType[command.design]; IF root=NIL THEN TerminalIO.PutRope["CoreCDUser: No root cell type\n"] ELSE { CoreCDUser.DoForSelectedFlatWires[root: root, action: PrintAWire, design: command.design]; TerminalIO.PutRope["\nCoreCDUser: Done\n"]; }; }; PrintSelectedFlatCellTypesCoreCommand: PROC [command: CDSequencer.Command] = { PrintACellType: CoreCDUser.SelectedFlatCellActionProc = { CoreOps.PrintCellType[CoreFlat.ResolveFlatCellType[root, selectedFlatCell^].cellType, TerminalIO.TOS[]]; }; root: Core.CellType _ CoreCDUser.GetDesignRootCellType[command.design]; IF root=NIL THEN TerminalIO.PutRope["CoreCDUser: No root cell type\n"] ELSE { CoreCDUser.DoForSelectedFlatCells[root: root, action: PrintACellType, design: command.design]; TerminalIO.PutRope["\nCoreCDUser: Done\n"]; }; }; PrintSelectedFlatCellTypesRecastedCoreCommand: PROC [command: CDSequencer.Command] ~ { PrintACellTypeWithRecasts: CoreCDUser.SelectedFlatCellActionProc = { cell: Core.CellType _ CoreFlat.ResolveFlatCellType[root, selectedFlatCell^].cellType; FOR c: Core.CellType _ cell, CoreOps.Recast[c] UNTIL c.class.recast=NIL DO NULL ENDLOOP; DO CoreOps.PrintCellType[cell, TerminalIO.TOS[]]; IF cell.class=Sinix.iconClass THEN cell _ CoreOps.Recast[cell]; -- already printed... IF cell.class.recast=NIL THEN EXIT; cell _ CoreOps.Recast[cell]; TerminalIO.PutF["\n\nRecasts into:"]; ENDLOOP; TerminalIO.PutF["\n\n--- End of recast chain ---\n"]; }; root: Core.CellType _ CoreCDUser.GetDesignRootCellType[command.design]; IF root=NIL THEN TerminalIO.PutRope["CoreCDUser: No root cell type\n"] ELSE { CoreCDUser.DoForSelectedFlatCells[root: root, action: PrintACellTypeWithRecasts, design: command.design]; TerminalIO.PutRope["\nCoreCDUser: Done\n"]; }; }; HighlightFlatCellTypeCommand: PROC [command: CDSequencer.Command] = { DoFlatCellType: CellTypeCommandActionProc = {CoreCDUser.HighlightFlatCellType[root, flatCell]}; DoFlatCellTypeCommand[command, DoFlatCellType]}; SelectFlatCellTypeCommand: PROC [command: CDSequencer.Command] = { DoFlatCellType: CellTypeCommandActionProc = {CoreCDUser.SelectFlatCellType[root, flatCell]}; DoFlatCellTypeCommand[command, DoFlatCellType]}; CellTypeCommandActionProc: TYPE = PROC[root: Core.CellType, flatCell: CoreFlat.FlatCellTypeRec]; DoFlatCellTypeCommand: PROC [command: CDSequencer.Command, action: CellTypeCommandActionProc] = { root: Core.CellType _ CoreCDUser.GetDesignRootCellType[command.design]; IF root=NIL THEN TerminalIO.PutRope["CoreCDUser: No root cell type\n"] ELSE { flatCell: CoreFlat.FlatCellTypeRec _ CoreFlat.ParseCellTypePath[root, TerminalIO.RequestRope["Flat Cell>"] ! CoreFlat.PathError => {TerminalIO.PutRopes[msg, "\n"]; GOTO Quit}]; action[root, flatCell ! CoreCDUser.CoreCDUserError => {TerminalIO.PutRopes[msg, "\n"]; GOTO Quit}]; TerminalIO.PutRopes["CoreCDUser: Done\n"]; EXITS Quit => NULL; }; }; PrintSelectedFlatCellTypesCommand: PROC [command: CDSequencer.Command] = { PrintACellType: CoreCDUser.SelectedFlatCellActionProc = { TerminalIO.PutF[ "Selected flat cell: %g\n", IO.rope[CoreFlat.CellTypePathRope[root, selectedFlatCell^]]]; }; root: Core.CellType _ CoreCDUser.GetDesignRootCellType[command.design]; IF root=NIL THEN TerminalIO.PutRope["CoreCDUser: No root cell type\n"] ELSE { CoreCDUser.DoForSelectedFlatCells[root: root, action: PrintACellType, design: command.design]; TerminalIO.PutRope["CoreCDUser: Done\n"]; }; }; HighlightFlatWireCommand: PROC [command: CDSequencer.Command] = { DoFlatWire: WireCommandActionProc = {CoreCDUser.HighlightFlatWire[root, flatWire]}; DoFlatWireCommand[command, DoFlatWire]}; SelectFlatWireCommand: PROC [command: CDSequencer.Command] = { DoFlatWire: WireCommandActionProc = {CoreCDUser.SelectFlatWire[root, flatWire]}; DoFlatWireCommand[command, DoFlatWire]}; WireCommandActionProc: TYPE = PROC[root: Core.CellType, flatWire: CoreFlat.FlatWireRec]; DoFlatWireCommand: PROC [command: CDSequencer.Command, action: WireCommandActionProc] = { root: Core.CellType _ CoreCDUser.GetDesignRootCellType[command.design]; IF root=NIL THEN TerminalIO.PutRope["CoreCDUser: No root cell type\n"] ELSE { flatWire: CoreFlat.FlatWireRec _ CoreFlat.ParseWirePath[root, TerminalIO.RequestRope["Flat Wire>"] ! CoreFlat.PathError => {TerminalIO.PutRopes[msg, "\n"]; GOTO Quit}]; action[root, flatWire! CoreCDUser.CoreCDUserError => {TerminalIO.PutRopes[msg, "\n"]; GOTO Quit}]; TerminalIO.PutRopes["CoreCDUser: Done\n"]; EXITS Quit => NULL; }; }; PrintSelectedFlatWiresCommand: PROC [command: CDSequencer.Command] = { PrintAWire: CoreCDUser.SelectedFlatWireActionProc = { TerminalIO.PutF[ "Selected flat wire: %g, canonical wire: %g\n", IO.rope[CoreFlat.WirePathRope[root, selectedFlatWire^]], IO.rope[CoreFlat.WirePathRope[root, CoreFlat.CanonizeWire[root, selectedFlatWire^]]]]; }; root: Core.CellType _ CoreCDUser.GetDesignRootCellType[command.design]; IF root=NIL THEN TerminalIO.PutRope["CoreCDUser: No root cell type\n"] ELSE { CoreCDUser.DoForSelectedFlatWires[root: root, action: PrintAWire, design: command.design]; TerminalIO.PutRope["CoreCDUser: Done\n"]; }; }; RemoveHighlight: PROC [command: CDSequencer.Command] = { ExtractOps.HighlightDesign[command.design]; }; indirectStack: LIST OF IndirectStackRec; IndirectStackRec: TYPE = RECORD[design: CD.Design, name: Rope.ROPE]; PopIndirect: PROC [command: CDSequencer.Command] = { IF indirectStack#NIL THEN { design: CD.Design _ indirectStack.first.design; name: Rope.ROPE _ indirectStack.first.name; indirectStack _ indirectStack.rest; CDSequencer.ExecuteCommand[comm: NEW[CDSequencer.CommandRec _ [ key: $PushNamed, design: design, data: name, ref: GetOpenViewer[design] ]]]} }; PushIndirect: PROC [command: CDSequencer.Command] = { Err: PROC[msg: Rope.ROPE] = {TerminalIO.PutF["CoreCDUser: %g. No action\n", IO.rope[msg]]}; selName: Rope.ROPE _ NIL; pushedName: Rope.ROPE _ NIL; design: CD.Design _ command.design; multiple: BOOL _ FALSE; instance: CD.Instance _ NIL; maskName: Rope.ROPE _ NIL; maskobj: CD.Object _ NIL; localObjSch: Rope.ROPE; localInstSch: Rope.ROPE; newComm: CDSequencer.Command _ NEW[CDSequencer.CommandRec _ [design: design]]; [instance, multiple] _ CDOps.SelectedInstance[design]; localObjSch _ NARROW[CDProperties.GetProp[instance.ob, $IconFor]]; localInstSch _ NARROW[CDProperties.GetProp[instance, $IconFor]]; selName _ CDDirectory.Name[instance.ob, design]; maskName _ selName.Substr[0, selName.Index[0, "."]].Cat[".mask"]; maskobj _ CDDirectory.Fetch[design, maskName]; pushedName _ IF CDCells.IsPushedIn[design] THEN CDDirectory.Name[design.actual.first.mightReplace.ob, design] ELSE selName; SELECT TRUE FROM multiple => {Err["Multiple selections"]; RETURN}; instance=NIL => {Err["No selection"]; RETURN}; CDImports.IsImport[instance.ob] => { specific: CDImports.ImportSpecific _ NARROW[instance.ob.specific]; iDesign: CD.Design _ specific.boundDesign; IF iDesign=NIL THEN {Err["Import not bound yet"]; RETURN} ELSE { newComm.key _ $PushNamed; newComm.design _ iDesign; newComm.data _ GetIconFor[iDesign, specific.objectName]; newComm.ref _ GetOpenViewer[iDesign]} }; localInstSch#NIL => {newComm.key _ $PushNamed; newComm.data _ localInstSch}; localObjSch#NIL => {newComm.key _ $PushNamed; newComm.data _ localObjSch}; maskobj#NIL => {newComm.key _ $PushNamed; newComm.data _ maskName}; ENDCASE => {newComm.key _ $PushS}; IF pushedName.Length#0 THEN indirectStack _ CONS[[design, pushedName], indirectStack]; CDSequencer.ExecuteCommand[comm: newComm]}; GetOpenViewer: PROC [design: CD.Design] RETURNS[viewer: ViewerClasses.Viewer] = { viewer _ ExtractOps.FindViewer[design, CoreCDUser.GetDesignLabel[design]]; IF viewer.iconic THEN ViewerOps.OpenIcon[viewer]; WHILE CDCells.IsPushedIn[design] DO [] _ CDCellsInteractions.PopFromCell[design, interactive] ENDLOOP}; PushIntoImportViewer: PROC [command: CDSequencer.Command] = { multiple: BOOL _ FALSE; instance: CD.Instance _ NIL; err: Rope.ROPE _ NIL; importedDesign: CD.Design _ NIL; specific: CDImports.ImportSpecific _ NIL; [instance, multiple] _ CDOps.SelectedInstance[command.design]; SELECT TRUE FROM multiple => err _ "Multiple selections"; instance=NIL => err _ "No selection"; NOT CDImports.IsImport[instance.ob] => err _ "Not an import"; ENDCASE => { -- normal case (well, almost) specific _ NARROW[instance.ob.specific]; importedDesign _ specific.boundDesign; IF importedDesign=NIL THEN err _ "Import not bound yet"; }; IF err#NIL THEN {TerminalIO.PutF["CoreCDUser: %g. No action\n", IO.rope[err]]; RETURN}; CDSequencer.ExecuteCommand[comm: NEW [CDSequencer.CommandRec _ [ key: $PushNamed, design: importedDesign, ref: ExtractOps.FindViewer[importedDesign, CoreCDUser.GetDesignLabel[importedDesign]], data: GetIconFor[importedDesign, specific.objectName]]]]}; GetIconFor: PROC [design: CD.Design, name: Rope.ROPE] RETURNS [target: Rope.ROPE] ~ { obj: CD.Object = CDDirectory.Fetch[design, name]; IF obj=NIL THEN RETURN [NIL]; target _ NARROW[CDProperties.GetProp[obj, $IconFor]]; IF target=NIL THEN target _ name}; CDSequencer.ImplementCommand[key: $ExtractSelectedCellsCommand, proc: ExtractSelectedCellsCommand, queue: doQueue]; CDSequencer.ImplementCommand[key: $HighlightSelectedFlatWireCommand, proc: HighlightSelectedFlatWireCommand, queue: doQueue]; CDSequencer.ImplementCommand[key: $PrintSelectedFlatWiresCoreCommand, proc: PrintSelectedFlatWiresCoreCommand, queue: doQueue]; CDSequencer.ImplementCommand[key: $PrintSelectedFlatCellTypesCoreCommand, proc: PrintSelectedFlatCellTypesCoreCommand, queue: doQueue]; CDSequencer.ImplementCommand[key: $PrintSelectedFlatCellTypesRecastedCoreCommand, proc: PrintSelectedFlatCellTypesRecastedCoreCommand, queue: doQueue]; CDSequencer.ImplementCommand[key: $HighlightFlatCellTypeCommand, proc: HighlightFlatCellTypeCommand, queue: doQueue]; CDSequencer.ImplementCommand[key: $SelectFlatCellTypeCommand, proc: SelectFlatCellTypeCommand, queue: doQueue]; CDSequencer.ImplementCommand[key: $PrintSelectedFlatCellTypesCommand, proc: PrintSelectedFlatCellTypesCommand, queue: doQueue]; CDSequencer.ImplementCommand[key: $HighlightFlatWireCommand, proc: HighlightFlatWireCommand, queue: doQueue]; CDSequencer.ImplementCommand[key: $SelectFlatWireCommand, proc: SelectFlatWireCommand, queue: doQueue]; CDSequencer.ImplementCommand[key: $PrintSelectedFlatWiresCommand, proc: PrintSelectedFlatWiresCommand, queue: doQueue]; CDSequencer.ImplementCommand[key: $RemoveHighlight, proc: RemoveHighlight, queue: doQueue]; CDSequencer.ImplementCommand[key: $PushIntoImportViewer, proc: PushIntoImportViewer, queue: doQueue]; CDSequencer.ImplementCommand[$PushSIconic, PushIndirect,, doQueue]; CDSequencer.ImplementCommand[$PopIndirect, PopIndirect,, doQueue]; END. CoreCDUserCmdsImpl.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. Barth, October 14, 1987 4:34:52 pm PDT Jean-Marc Frailong January 4, 1988 4:48:02 pm PST Command Implementation Return schematic name if any, or return initial name PrintTransitiveObjectClosure: PROC [command: CDSequencer.Command] = { PrintName: PROC [object: CD.Object, design: CD.Design] = { name: Rope.ROPE _ CDDirectory.Name[object, design]; SELECT TRUE FROM Rope.Length[name]>0 => TerminalIO.PutRope[name]; Rope.Length[object.class.description]>0 => TerminalIO.PutRopes["<", object.class.description, ">"]; ENDCASE => TerminalIO.PutRope["~unknown~"]; }; PrintObject: RefTab.EachPairAction = { PrintObjectEntry: RefTab.EachPairAction = { TerminalIO.PutRope[" "]; PrintName[NARROW[key], NARROW[val]]; }; PrintName[NARROW[key], NARROW[RefTab.Fetch[NARROW[val], key].val]]; TerminalIO.PutRope[": "]; [] _ RefTab.Pairs[NARROW[val], PrintObjectEntry]; TerminalIO.PutRope["\n"]; }; design: CD.Design _ command.design; topInstances: CD.InstanceList _ GetTopInstances[design]; TerminalIO.PutRope["\n"]; [] _ RefTab.Pairs[ObjectTransitiveClosure[design, topInstances], PrintObject]; }; Start Code CDSequencer.ImplementCommand[key: $PrintTransitiveObjectClosure, proc: PrintTransitiveObjectClosure, queue: doQueue]; Κ ‰˜code– "Cedar" stylešœ™K– "Cedar" style™šž œ˜#Kšœ,˜,—Kšœ(˜(K˜—šœœœ6˜XK˜—šžœœB˜YKšœG˜GKšœœœ6˜Fšœ˜Kšœœœ˜¨KšœVœ˜bKšœ*˜*Kšœ œ˜K˜—K˜K˜—šžœœ#˜Fšž œ+˜5šœ˜Kšœ0˜0Kšœ7˜9KšœT˜V—K˜—KšœG˜GKšœœœ6˜Fšœ˜KšœZ˜ZK˜)K˜—K˜K˜—šžœœ#˜8Kšœ+˜+K˜K˜—Jšœœœ˜)Jšœœœœ˜DJ˜šž œœ#˜4šœœœ˜Jšœœ%˜/Jšœ œ˜,Jšœ#˜#šœ!œ˜?Jšœ˜Jšœ˜Jšœ ˜ Jšœ#˜#———J˜šž œœ#˜5Jšžœœ œ4œ ˜[Jšœœœ˜Jšœœœ˜Jšœ œ˜%Jšœ œœ˜Jšœ œ œ˜Jšœœœ˜Jšœ œ œ˜Jšœœ˜Jšœœ˜Jšœœ,˜NJšœ6˜6Jšœœ.˜BJšœœ,˜AJšœ1˜1JšœA˜AJšœ/˜/šœ œ˜*Jšœ>˜BJšœ ˜ —šœœ˜Jšœžœœ˜2Jšœ œžœœ˜0šœ%˜%Jšœ%œ˜BJšœ œ˜*šœ ˜Jšœœ˜*šœ˜Jšœ˜Jšœ˜Jšœ9˜9Jšœ)˜)———Jšœ œ<˜LJšœ œ;˜JJšœœ:˜EJšœ˜%—šœœ˜Jšœœ&˜:—Jšœ+˜+J˜—šž œœ œ œ"˜QKšœHΟtœ˜JJšœœ˜1šœ˜#Jšœ:œ˜CK˜——šžœœ#˜=Kšœ œœ˜Kšœ œ œ˜Kšœ œœ˜Kšœœ œ˜ Kšœ%œ˜)Jšœ>˜>šœœ˜Kšœ(˜(Kšœ œ˜%Kšœ:˜=šœŸ˜*Kšœ œ˜(Kšœ&˜&Kšœœœ˜8Kšœ˜——Kš œœœ1œ œ˜Wšœ!œ˜@Kšœ˜Kšœ˜KšœT œ˜VKšœ:˜:—K˜—š ž œœ œœœœ˜UK™4Kšœœ*˜1Kš œœœœœ˜Kšœ œ&˜5Kšœœœ˜"K˜—šžœœ#™Ešž œœ œœ ™:Kšœ œ$™3šœœ™Kšœ0™0Kšœc™cKšœ$™+—K™—šž œ™&šžœ™+Kšœ™Kšœ œœ™$K™—Kšœ œœœ™CKšœ™Jšœœ™1Kšœ™K™—Kšœ œ™$Kšœœ(™8Kšœ™JšœN™NK™K™——™ Kšœs˜sKšœ}˜}Kšœ˜Kšœ‡˜‡Kšœ—˜—Kšœu˜uKšœo˜oKšœ˜Kšœm˜mKšœg˜gKšœw˜wKšœ[˜[Kšœe˜eKšœu™uK˜Kšœ+ž œ ˜CKšœ+ž œ ˜BK˜—Kšœ˜—…—:DLε