DIRECTORY CD, CDCells, CDDirectory, CDMenus, CDOps, CDOrient, CDProperties, CDSatellites, CDSequencer, Core, CoreClasses, CoreOps, Rope, Sinix, SinixHighlight, Sisyph, TerminalIO; SisyphCmdsImpl: CEDAR PROGRAM IMPORTS CDCells, CDDirectory, CDMenus, CDOps, CDProperties, CDSatellites, CoreClasses, CoreOps, Rope, Sinix, SinixHighlight, Sisyph, TerminalIO = BEGIN ROPE: TYPE = Rope.ROPE; Wire: TYPE = Core.Wire; CellType: TYPE = Core.CellType; MakeIcon: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelectedAndCell[selected, multiple] THEN RETURN; CDProperties.PutObjectProp[selected.ob, Sisyph.sisyphMode.cacheProp, NIL]; CDMenus.CallMenuAndExecute[$SisyphIconMenu, comm]; }; MakeInvisibleToExtractor: PROC [comm: CDSequencer.Command] = { FOR w: LIST OF CD.Instance _ CDOps.InstList[comm.design], w.rest WHILE w#NIL DO inst: CD.Instance _ w.first; IF inst.selected THEN CDProperties.PutProp[inst, Sisyph.sisyphMode.extractProcProp, $ExtractNull]; ENDLOOP; }; MakeVisibleToExtractor: PROC [comm: CDSequencer.Command] = { FOR w: LIST OF CD.Instance _ CDOps.InstList[comm.design], w.rest WHILE w#NIL DO inst: CD.Instance _ w.first; IF inst.selected THEN CDProperties.PutProp[inst, Sisyph.sisyphMode.extractProcProp, NIL]; ENDLOOP; }; FlushSisyphCaches: PROC [comm: CDSequencer.Command] = { FlushCache: PROC [obj: CD.Object] = { CDProperties.PutProp[obj, Sisyph.sisyphMode.cacheProp, NIL]; IF CDCells.IsCell[obj] THEN { cellPtr: CD.CellPtr _ NARROW[obj.specificRef]; FOR l: LIST OF CD.Instance _ cellPtr.contents, l.rest WHILE l#NIL DO FlushCache[l.first.ob]; ENDLOOP; }; }; FOR w: LIST OF CD.Instance _ CDOps.InstList[comm.design], w.rest WHILE w#NIL DO IF w.first.selected THEN FlushCache[w.first.ob]; ENDLOOP; }; ExtractSelectedObj: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; cx: Sisyph.Context _ Sisyph.Create[comm.design]; result: REF; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelectedAndCell[selected, multiple] THEN RETURN; [] _ CDSatellites.EnforceInvariants[comm.design, CDOps.InstList[comm.design]]; [result] _ Sinix.Extract[obj: selected.ob, mode: Sisyph.sisyphMode, properties: selected.properties, userData: cx]; IF result=NIL THEN TerminalIO.WriteF["Result of extraction is NIL.\n"] ELSE WITH result SELECT FROM wire: Wire => CoreOps.PrintWire[wire: wire, out: TerminalIO.TOS[], level: LAST [NAT]]; cellType: CellType => { IF cellType.class=CoreClasses.identityCellClass THEN cellType _ CoreOps.Recast[cellType]; CoreOps.PrintCellType[cellType: cellType, out: TerminalIO.TOS[], level: LAST [NAT]]; }; ENDCASE => ERROR; }; MakeCellIconWithCodeDef: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; cellIconExprPrefix: ROPE _ Rope.Cat[Sisyph.cellIconRope, " _ "]; cellIconExpr: ROPE; exprs: LIST OF ROPE; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelectedAndCell[selected, multiple] THEN RETURN; cellIconExpr _ TerminalIO.RequestRope[Rope.Cat["\nType code: ", cellIconExprPrefix]]; cellIconExpr _ Rope.Cat[cellIconExprPrefix, cellIconExpr]; exprs _ NARROW [CDProperties.GetObjectProp[selected.ob, Sisyph.expressionsProp]]; exprs _ CONS [cellIconExpr, StripResultExprs[exprs]]; CDProperties.PutProp[selected.ob, Sisyph.expressionsProp, exprs]; }; MakeCellIconWithGeometryDef: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; schematicName: ROPE; cellIconExprPrefix: ROPE _ Rope.Cat[Sisyph.cellIconRope, " _ "]; cellIconExpr: ROPE; exprs: LIST OF ROPE; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelectedAndCell[selected, multiple] THEN RETURN; schematicName _ TerminalIO.RequestRope["\nType schematic name: "]; IF CDDirectory.Fetch[comm.design, schematicName].object = NIL THEN { TerminalIO.WriteRope["\n** No such object in design.\n"]; RETURN; }; cellIconExpr _ Rope.Cat[cellIconExprPrefix, "ES[\"", schematicName, "\", cx]"]; exprs _ NARROW [CDProperties.GetObjectProp[selected.ob, Sisyph.expressionsProp]]; exprs _ CONS [cellIconExpr, StripResultExprs[exprs]]; CDProperties.PutProp[selected.ob, Sisyph.expressionsProp, exprs]; }; MakeWireIconWithCodeDef: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; wireIconExprPrefix: ROPE _ Rope.Cat[Sisyph.wireIconRope, " _ "]; wireIconExpr: ROPE; exprs: LIST OF ROPE; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelectedAndCell[selected, multiple] THEN RETURN; wireIconExpr _ TerminalIO.RequestRope[Rope.Cat["\nType code: ", wireIconExprPrefix]]; wireIconExpr _ Rope.Cat[wireIconExprPrefix, wireIconExpr]; exprs _ NARROW [CDProperties.GetObjectProp[selected.ob, Sisyph.expressionsProp]]; exprs _ CONS [wireIconExpr, StripResultExprs[exprs]]; CDProperties.PutProp[selected.ob, Sisyph.expressionsProp, exprs]; }; MakeWireIconWithGeometryDef: PROC [comm: CDSequencer.Command] = { }; ShowInstExpressions: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; exprs: LIST OF ROPE; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelected[selected, multiple] THEN RETURN; TerminalIO.WriteRope["Instance Expressions:"]; exprs _ NARROW[CDProperties.GetInstanceProp[selected, Sisyph.expressionsProp]]; WHILE exprs#NIL DO TerminalIO.WriteRope[Rope.Cat["\n ", exprs.first]]; exprs _ exprs.rest; ENDLOOP; TerminalIO.WriteRope["\n"]; }; AddInstExpression: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; exprs: LIST OF ROPE; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelected[selected, multiple] THEN RETURN; TerminalIO.WriteRope["Add Instance Expression\n"]; exprs _ NARROW[CDProperties.GetInstanceProp[selected, Sisyph.expressionsProp]]; exprs _ CONS[TerminalIO.RequestRope[Rope.Cat[" New Expression: "]], exprs]; CDProperties.PutInstanceProp[selected, Sisyph.expressionsProp, exprs] }; EditInstExpressions: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; exprs: LIST OF ROPE; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelected[selected, multiple] THEN RETURN; TerminalIO.WriteRope["Edit Instance Expressions\n"]; exprs _ NARROW[CDProperties.GetInstanceProp[selected, Sisyph.expressionsProp]]; exprs _ EditExpressions[exprs, "Expression"]; CDProperties.PutInstanceProp[selected, Sisyph.expressionsProp, exprs] }; ShowObjExpressions: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; exprs: LIST OF ROPE; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelected[selected, multiple] THEN RETURN; TerminalIO.WriteRope["Object Expressions:"]; exprs _ NARROW[CDProperties.GetObjectProp[selected.ob, Sisyph.expressionsProp]]; WHILE exprs#NIL DO TerminalIO.WriteRope[Rope.Cat["\n ", exprs.first]]; exprs _ exprs.rest; ENDLOOP; TerminalIO.WriteRope["\n"]; }; AddObjExpression: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; exprs: LIST OF ROPE; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelected[selected, multiple] THEN RETURN; TerminalIO.WriteRope["Add Object Expression\n"]; exprs _ NARROW[CDProperties.GetObjectProp[selected.ob, Sisyph.expressionsProp]]; exprs _ CONS[TerminalIO.RequestRope[Rope.Cat[" New Expression: "]], exprs]; CDProperties.PutObjectProp[selected.ob, Sisyph.expressionsProp, exprs] }; EditObjExpressions: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; exprs: LIST OF ROPE; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelected[selected, multiple] THEN RETURN; TerminalIO.WriteRope["Edit Object Expressions\n"]; exprs _ NARROW[CDProperties.GetObjectProp[selected.ob, Sisyph.expressionsProp]]; exprs _ EditExpressions[exprs, "Expression"]; CDProperties.PutObjectProp[selected.ob, Sisyph.expressionsProp, exprs] }; ShowParmNames: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; parms: LIST OF ROPE; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelected[selected, multiple] THEN RETURN; TerminalIO.WriteRope["Parm Names:"]; parms _ NARROW[CDProperties.GetObjectProp[selected.ob, Sisyph.parmNamesProp]]; WHILE parms#NIL DO TerminalIO.WriteRope[Rope.Cat["\n ", parms.first]]; parms _ parms.rest; ENDLOOP; TerminalIO.WriteRope["\n"]; }; AddParmName: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; parms: LIST OF ROPE; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelected[selected, multiple] THEN RETURN; TerminalIO.WriteRope["Add Parameter Name\n"]; parms _ NARROW[CDProperties.GetObjectProp[selected.ob, Sisyph.parmNamesProp]]; parms _ CONS[TerminalIO.RequestRope[Rope.Cat[" New Parameter: "]], parms]; CDProperties.PutObjectProp[selected.ob, Sisyph.parmNamesProp, parms] }; EditParmNames: PROC [comm: CDSequencer.Command] = { selected: CD.Instance; multiple: BOOL; parms: LIST OF ROPE; [selected, multiple] _ CDOps.SelectedInstance[comm.design]; IF ~IsSingleSelected[selected, multiple] THEN RETURN; TerminalIO.WriteRope["Edit Object Expressions\n"]; parms _ NARROW[CDProperties.GetObjectProp[selected.ob, Sisyph.parmNamesProp]]; parms _ EditExpressions[parms, "Parameter"]; CDProperties.PutObjectProp[selected.ob, Sisyph.parmNamesProp, parms] }; IsSingleSelectedAndCell: PROC [selected: CD.Instance, multiple: BOOL] RETURNS [BOOL] = { IF ~IsSingleSelected[selected, multiple] THEN RETURN [FALSE]; IF ~CDCells.IsCell[selected.ob] THEN { TerminalIO.WriteRope["\n** Selected instance is not a cellcan't do it.\n"]; RETURN[FALSE]; }; RETURN[TRUE]; }; IsSingleSelected: PROC [selected: CD.Instance, multiple: BOOL] RETURNS [BOOL] = { IF selected=NIL THEN { TerminalIO.WriteRope["\n** No current selection--can't do it.\n"]; RETURN[FALSE]; }; IF multiple THEN { TerminalIO.WriteRope["\n** Multiple instances selected--can't do it.\n"]; RETURN[FALSE]; }; RETURN[TRUE]; }; StripResultExprs: PROC [in: LIST OF ROPE] RETURNS [out: LIST OF ROPE] = { out _ NIL; FOR l: LIST OF ROPE _ in, l.rest WHILE l#NIL DO IF ~Sisyph.IsResultExpression[l.first] THEN out _ CONS [l.first, out] ENDLOOP; }; EditExpressions: PROC [oldExprs: LIST OF ROPE, prompt: ROPE] RETURNS [allExprs: LIST OF ROPE] = { replExprs, newExprs: LIST OF ROPE _ NIL; input: ROPE; TerminalIO.WriteRope["\n"]; WHILE oldExprs#NIL DO input _ TerminalIO.RequestRope[Rope.Cat[" ", prompt, ": ", oldExprs.first, " Replacement: "]]; SELECT TRUE FROM Rope.Equal[input, "-"] => TerminalIO.WriteRope[" ** Deleted\n"]; Rope.Equal[input, ""] => replExprs _ CONS[Rope.Translate[oldExprs.first], replExprs]; ENDCASE => replExprs _ CONS[input, replExprs]; oldExprs _ oldExprs.rest; ENDLOOP; input _ TerminalIO.RequestRope[Rope.Cat[" New ", prompt, ": "]]; WHILE ~Rope.Equal[input, ""] AND ~Rope.Equal[input, "-"] DO newExprs _ CONS[input, newExprs]; input _ TerminalIO.RequestRope[Rope.Cat[" New ", prompt, ": "]]; ENDLOOP; allExprs _ NIL; FOR l: LIST OF ROPE _ newExprs, l.rest WHILE l#NIL DO allExprs _ CONS[l.first, allExprs]; ENDLOOP; FOR l: LIST OF ROPE _ replExprs, l.rest WHILE l#NIL DO allExprs _ CONS[l.first, allExprs]; ENDLOOP; }; SisyphContextCreator: SinixHighlight.ExtractContextCreator = { context _ NEW [SinixHighlight.ExtractContextRec _ [mode: Sisyph.sisyphMode, userData: Sisyph.Create[design]]]; }; CDMenus.ImplementEntryCommand[menu: $OtherProgramMenu, entry: "Make Icon", p: MakeIcon, key: $SisyphMakeIcon, queue: doQueueAndMark]; CDMenus.ImplementEntryCommand[menu: $OtherProgramMenu, entry: "Make Invisible to Sisyph", p: MakeInvisibleToExtractor, key: $MakeInvisibleToExtractor, queue: doQueueAndMark]; CDMenus.ImplementEntryCommand[menu: $OtherProgramMenu, entry: "Make Visible to Sisyph", p: MakeVisibleToExtractor, key: $MakeVisibleToExtractor, queue: doQueueAndMark]; CDMenus.ImplementEntryCommand[menu: $OtherProgramMenu, entry: "Flush Sisyph Caches", p: FlushSisyphCaches, key: $FlushSisyphCaches]; CDMenus.ImplementEntryCommand[menu: $OtherProgramMenu, entry: "Sisyph Extract", p: ExtractSelectedObj, key: $SisyphExtractSelectedObj]; [] _ CDMenus.CreateMenu["Sisyph: Make Icon", $SisyphIconMenu]; CDMenus.ImplementCommandToCallMenu[$SisyphIconMenu, $SisyphIconMenu]; CDMenus.ImplementEntryCommand[menu: $SisyphIconMenu, entry: "CELL Icon _ CODE", p: MakeCellIconWithCodeDef, key: $MakeCellIconWithCodeDef, queue: doQueueAndMark]; CDMenus.ImplementEntryCommand[menu: $SisyphIconMenu, entry: "CELL Icon _ GEOMETRY", p: MakeCellIconWithGeometryDef, key: $MakeCellIconWithGeometryDef, queue: doQueueAndMark]; CDMenus.ImplementEntryCommand[menu: $SisyphIconMenu, entry: "WIRE Icon _ CODE", p: MakeWireIconWithCodeDef, key: $MakeWireIconWithCodeDef, queue: doQueueAndMark]; [] _ CDMenus.CreateMenu["Sisyph: Parameter Specification", $SisyphParameterMenu]; CDMenus.ImplementCommandToCallMenu[$SisyphParameterMenu, $SisyphParameterMenu]; CDMenus.ImplementEntryCommand[menu: $SisyphParameterMenu, entry: "Show Parameter Names", p: ShowParmNames, key: $SisyphShowParmNames]; CDMenus.ImplementEntryCommand[menu: $SisyphParameterMenu, entry: "Add Parameter Name", p: AddParmName, key: $SisyphAddParmName, queue: doQueueAndMark]; CDMenus.ImplementEntryCommand[menu: $SisyphParameterMenu, entry: "Edit Parameter Names", p: EditParmNames, key: $SisyphEditParmNames, queue: doQueueAndMark]; CDMenus.ImplementEntryCommand[menu: $SatellitesMenu, entry: "Show Instance Expressions (LI-Left)", p: ShowInstExpressions, key: $SisyphShowInstExpressions]; CDMenus.ImplementEntryCommand[menu: $SatellitesMenu, entry: "Add Instance Expression (LI-Middle)", p: AddInstExpression, key: $SisyphAddInstExpression, queue: doQueueAndMark]; CDMenus.ImplementEntryCommand[menu: $SatellitesMenu, entry: "Edit Instance Expressions (LI-Right)", p: EditInstExpressions, key: $SisyphEditInstExpressions, queue: doQueueAndMark]; CDMenus.ImplementEntryCommand[menu: $SatellitesMenu, entry: "Show Object Expressions (LO-Left)", p: ShowObjExpressions, key: $SisyphShowObjExpressions]; CDMenus.ImplementEntryCommand[menu: $SatellitesMenu, entry: "Add Object Expression (LO-Middle)", p: AddObjExpression, key: $SisyphAddObjExpression, queue: doQueueAndMark]; CDMenus.ImplementEntryCommand[menu: $SatellitesMenu, entry: "Edit Object Expressions (LO-Right)", p: EditObjExpressions, key: $SisyphEditObjExpressions, queue: doQueueAndMark]; SinixHighlight.RegisterHighlightCommand[ contextCreator: SisyphContextCreator, prompt: "Highlight net in schematic", key: $HighlightNetInSchematic]; END. šSisyphCmdsImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Created by Pradeep Sindhu, December 9, 1985 10:01:52 pm PST Pradeep Sindhu, May 2, 1986 7:44:59 pm PDT Barth, January 13, 1986 3:30:05 pm PST Bertrand Serlet June 1, 1986 3:47:54 pm PDT Command Procs Not implemented yet Internal Utilities Initialization Main Menu Make Icon Menu Make Parameter Menu Expressions Menu สn˜™Jšœ ฯmœ1™š žœžœžœžœ0žœžœž˜OKšœžœ˜KšžœžœM˜bKšžœ˜—Kšœ˜—K˜š œžœ ˜<š žœžœžœžœ0žœžœž˜OKšœžœ˜Kšžœžœ?žœ˜YKšžœ˜—Kšœ˜—K˜š œžœ ˜7š  œžœžœ ˜%Kšœ7žœ˜<šžœžœ˜Kšœ žœ žœ˜.š žœžœžœžœ%žœžœž˜DK˜Kšžœ˜—K˜—K˜—K˜š žœžœžœžœ0žœžœž˜OKšžœžœ˜0Kšžœ˜—Kšœ˜—K˜š œžœ ˜8Kšœ žœ ˜Kšœ žœ˜Kšœ0˜0Kšœžœ˜ K˜Kšœ;˜;Kšžœ.žœžœ˜Kšœ žœa˜nK˜——™K™ Kšœ…˜…Kšœฎ˜ฎKšœจ˜จKšœ„˜„Kšœ‡˜‡K˜K™Kšœ>˜>KšœE˜EK˜Kšœข˜ขKšœฎ˜ฎKšœข˜ขK˜K™KšœQ˜QKšœO˜OK™Kšœ†˜†Kšœ—˜—Kšœ˜K˜K˜K™Kšœœ˜œKšœฏ˜ฏKšœด˜ดK˜Kšœ˜˜˜Kšœซ˜ซKšœฐ˜ฐK•StartOfExpansion~[technology: CD.Technology, contextCreator: SinixHighlight.ExtractContextCreator, prompt: ROPE _ NIL, key: ATOM _ NIL]˜šœ(˜(Kšœ%˜%Kšœ%˜%Kšœ˜K˜—K˜Kšžœ˜——…—9$I,