SXShowTessImpl.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Last edited by Giordano Beretta, April 23, 1985 3:31:53 pm PST
gbb March 25, 1986 2:07:26 pm PST
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] =
Sets up a menu to get the layer and a submenu to specify the desired world (geometry or conflict).
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] =
Called by ChipNDale.
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.