SXShowTessImpl.mesa
Copyright © 1984, 1986 by Xerox Corporation. All rights reserved.
Last edited by Giordano Beretta, April 23, 1985 3:31:53 pm PST
gbb December 8, 1986 2:58:12 pm PST
DIRECTORY
Atom USING [GetPName],
CD USING [Design, Technology],
CDPanel USING [DefineButton],
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, PutRope];
SXShowTessImpl: CEDAR PROGRAM
IMPORTS Atom, CDPanel, 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];
CDPanel.DefineButton [name: "Show Spinifex Tesselation", border: TRUE, command: id];
CDMenus.CreateEntry [menu: $ProgramMenu, entry: "Show Spinifex Tesselation", key: id];
TerminalIO.PutRope ["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 [header: "Spinifex layer", choice: selections];
IF discarded ← (selection = 0) THEN RETURN;
layer ← selection - 1;
selection ← TerminalIO.RequestSelection [header: "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.PutRope ["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.PutRope ["The desired Spinifex world does not exist (Did you DRC?).\n"];
ERROR ABORTED
END;
[] ← CSMonitor.Monitor [plane: world, name: viewerLabel, paintDark: AtomOrConstraint];
TerminalIO.PutRope ["The shown tesselation corresponds to the LAST actually analysed cell.\n"];
TerminalIO.PutRope ["The following additional commands are available:\na middle: print tile\ns middle: print value attached to tile\nr: redisplay\nc: center\n"];
TerminalIO.PutRope ["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.