<> <> <> <> DIRECTORY Atom USING [GetPName], CD USING [Design, Technology], CDMenus USING [CreateEntry], CDProperties USING [GetProp], CDSequencer USING [Command, ImplementCommand], CStitching USING [Tesselation], CSMonitor USING [Monitor, PaintPredicate], Rope USING [Cat, ROPE], SXAtoms USING [spinifex], SX USING [ConstraintPtr, SpinifexLayerIndex, TechHandle], SXLayers USING [GetTesselation, SaveTesselations], TerminalIO USING [RequestSelection, WriteRope]; SXShowTessImpl: CEDAR PROGRAM IMPORTS Atom, CDMenus, CDProperties, CDSequencer, CSMonitor, Rope, SXAtoms, SXLayers, TerminalIO = BEGIN NameList: TYPE ~ LIST OF Rope.ROPE; RegisterCommand: PROCEDURE ~ { id: ATOM ~ $showTesselation; CDSequencer.ImplementCommand [key: id, proc: ShowWorld, queue: doQueue]; CDMenus.CreateEntry [menu: $ProgramMenu, entry: "Show Spinifex Tesselation", key: id]; TerminalIO.WriteRope ["Spinifex utility showing tesselations loaded.\n"] }; -- end RegisterCommand Menu: PROCEDURE [selections: NameList] RETURNS [discarded, conflictWorld: BOOL, layer: SX.SpinifexLayerIndex] = <> BEGIN selection: CARDINAL; selection _ TerminalIO.RequestSelection [label: "Spinifex layer", choice: selections]; IF discarded _ (selection = 0) THEN RETURN; layer _ selection - 1; selection _ TerminalIO.RequestSelection [label: "World", choice: LIST["Areas of interest", "Geometry"]]; IF discarded _ (selection = 0) THEN RETURN; conflictWorld _ (selection = 1) END; -- end Menu AtomOrConstraint: CSMonitor.PaintPredicate = BEGIN RETURN [(ISTYPE [val, ATOM]) OR (ISTYPE [val, SX.ConstraintPtr])] END; -- AtomOrConstraint ShowWorld: PROCEDURE [comm: CDSequencer.Command] = <> BEGIN design: CD.Design ~ comm.design; th: REF SX.TechHandle; viewerLabel: Rope.ROPE; world: CStitching.Tesselation; conflicts, abort: BOOL; layerNames: NameList; layer: SX.SpinifexLayerIndex; th _ NARROW [CDProperties.GetProp [from: design.technology, prop: SXAtoms.spinifex]]; IF (th = NIL) THEN { TerminalIO.WriteRope ["The input focus is not on a design with a Spinifex technology.\n"]; ERROR ABORTED }; FOR l: SX.SpinifexLayerIndex DECREASING IN [0.. th.numSpinifexLayers) DO layerNames _ CONS [Atom.GetPName[th.spinifexLayerNames[l].layerId], layerNames] ENDLOOP; [abort, conflicts, layer] _ Menu [layerNames]; IF abort THEN RETURN; viewerLabel _ IF conflicts THEN "Areas of interest. " ELSE "Geometry World. "; viewerLabel _ Rope.Cat ["Spinifex ", viewerLabel, "Layer: ", Atom.GetPName[th.spinifexLayerNames[layer].layerId]]; world _ SXLayers.GetTesselation [conflicts, layer]; IF world = NIL THEN BEGIN TerminalIO.WriteRope ["The desired Spinifex world does not exist (Did you DRC?).\n"]; ERROR ABORTED END; [] _ CSMonitor.Monitor [plane: world, name: viewerLabel, paintDark: AtomOrConstraint]; TerminalIO.WriteRope ["The shown tesselation corresponds to the LAST actually analysed cell.\n"]; TerminalIO.WriteRope ["The following additional commands are available:\na middle: print tile\ns middle: print value attached to tile\nr: redisplay\nc: center\n"]; TerminalIO.WriteRope ["d: INC[depth]; D: DEC[depth];\nw: INC[width]; W: DEC[width]\n [Roughly speaking, the depth parameter controls the nesting depth before '...' is used, e.g. of records within records within arrays within ..., width controls the number of characters printed at each nesting level before '...' is used.]\n"] END; -- end ShowWorld SXLayers.SaveTesselations [TRUE]; RegisterCommand [] END.