SXCommands.mesa
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Written by Shand, September 12, 1983 11:40 pm
Last Edited by: Shand, March 11, 1985 2:51:32 am PST
Last Edited by: BERETTA, November 5, 1984 3:59:41 pm PST
Last Edited by: Jacobi, December 6, 1984 3:33:54 pm PST
Last Edited by: Jacobi, April 8, 1985 12:14:48 pm PST
DIRECTORY
TerminalIO USING [WriteRope, RequestRope],
CD USING [Design, ObPtr, ApplicationList, DesignPosition, ApplicationPtr, lambda],
CDApplications USING [OnlySelected],
CDCommandOps,
CDSequencer USING [Command, ImplementCommand],
CDMenus USING [CreateEntry],
CDOps USING [AppList, Info],
CDOrient USING [MapPoint],
Process USING [SetPriority, priorityBackground],
Rope USING [Cat, ROPE],
IO USING [Error, EndOfStream, GetInt, RIS, STREAM],
SXAtoms USING [analyzeSelected, analyzeAndThymeSelected, thymePrint, analyzeAndRoseSelected, rosePrint, highlightPointedNode, highlightKeyboardCoordsNode],
SXAccess USING [Analyze],
SXHighlightNode USING [HighlightNode];
SXCommands:
CEDAR
PROGRAM
IMPORTS TerminalIO, CDApplications, CDCommandOps, CDSequencer, CDMenus, CDOps, CDOrient, Process, Rope, IO, SXAtoms, SXAccess, SXHighlightNode =
BEGIN
AnalyzeComm:
PROCEDURE [comm: CDSequencer.Command] =
BEGIN
stopFlag: REF BOOL ← NEW[BOOL←FALSE];
ProtectedAnalyzeComm:
PROCEDURE [comm: CDSequencer.Command] =
BEGIN
selected: CD.ApplicationList ← CDApplications.OnlySelected[CDOps.AppList[comm.design]];
IF selected=NIL THEN TerminalIO.WriteRope[ "no selection\n"]
ELSE {
skipped: BOOL;
format: REF ANY;
SELECT comm.a
FROM
SXAtoms.analyzeAndThymeSelected => {
TerminalIO.WriteRope["Analysis and Thyme format extraction of\n"];
format ← SXAtoms.thymePrint;
};
SXAtoms.analyzeAndRoseSelected => {
TerminalIO.WriteRope["Analysis and Rosemary format extraction of\n"];
format ← SXAtoms.rosePrint;
};
ENDCASE => {
TerminalIO.WriteRope["Analysis of\n"];
format ← NIL;
};
FOR list:
CD.ApplicationList ← selected, list.rest
WHILE list#
NIL
DO
TerminalIO.WriteRope[Rope.Cat[" ", CDOps.Info[list.first.ob], "\n"]];
ENDLOOP;
TRUSTED { Process.SetPriority[Process.priorityBackground] };
skipped ← SXAccess.Analyze[design: comm.design, hierarchyRoots: selected, formatKey: format, stopFlag: stopFlag];
IF skipped THEN TerminalIO.WriteRope["Analysis skipped\n"]
ELSE TerminalIO.WriteRope["Analysis complete\n"]
}
END;
TerminalIO.WriteRope["Spinifex\n"];
[] ← CDCommandOps.CallWithResource[ProtectedAnalyzeComm, comm, $Spinifex, stopFlag];
END;
HighLightNode:
PROCEDURE [comm: CDSequencer.Command] =
BEGIN
TerminalIO.WriteRope["Highlight Node (cur layer, pointed)\n"];
TRUSTED { Process.SetPriority[Process.priorityBackground] };
SXHighlightNode.HighlightNode[comm.design, comm.pos, comm.l];
END;
HighLightNodeFromKeyboard:
PROCEDURE [comm: CDSequencer.Command] =
BEGIN
ENABLE {
IO.Error => {
TerminalIO.WriteRope[" Invalid Coords (Format is: x y )\n"];
ERROR ABORTED
};
IO.EndOfStream => {
TerminalIO.WriteRope[" Invalid Coords (Format is: x y )\n"];
ERROR ABORTED
};
};
coords: CD.DesignPosition ← [0,0];
inLine: IO.STREAM ~ IO.RIS[ TerminalIO.RequestRope["Highlight Node (cur layer)\n Enter coords of node relative to currently pushed cell>"]];
coords.x ← IO.GetInt[inLine] * CD.lambda;
coords.y ← IO.GetInt[inLine] * CD.lambda;
TRUSTED { Process.SetPriority[Process.priorityBackground] };
-- Transform coords from those of currently pushed appliaction to those of screen.
{
a: CD.ApplicationPtr ~ comm.design.actual.first.mightReplace;
IF a #
NIL
THEN
coords ← CDOrient.MapPoint[ coords, a.ob.size, a.orientation, a.location];
};
SXHighlightNode.HighlightNode[comm.design, coords, comm.l];
END;
-- SpinifexCommands
CDSequencer.ImplementCommand[a: SXAtoms.analyzeSelected, p: AnalyzeComm, queue: doQueue];
CDSequencer.ImplementCommand[a: SXAtoms.analyzeAndThymeSelected, p: AnalyzeComm, queue: doQueue];
CDSequencer.ImplementCommand[a: SXAtoms.analyzeAndRoseSelected, p: AnalyzeComm, queue: doQueue];
CDSequencer.ImplementCommand[a: SXAtoms.highlightPointedNode, p: HighLightNode, queue: doQueue];
CDSequencer.ImplementCommand[a: SXAtoms.highlightKeyboardCoordsNode, p: HighLightNodeFromKeyboard, queue: doQueue];
CDMenus.CreateEntry[menu: $ProgramMenu, entry: "DRC", key: SXAtoms.analyzeSelected];
CDMenus.CreateEntry[menu: $ProgramMenu, entry: "DRC & Extract Thyme", key: SXAtoms.analyzeAndThymeSelected];
CDMenus.CreateEntry[menu: $ProgramMenu, entry: "DRC & Extract Rose", key: SXAtoms.analyzeAndRoseSelected];
CDMenus.CreateEntry[menu: $RectProgramMenu, entry: "Highlight node", key: SXAtoms.highlightPointedNode];
CDMenus.CreateEntry[menu: $ProgramMenu, entry: "Highlight node (at coords)", key: SXAtoms.highlightKeyboardCoordsNode];
TerminalIO.WriteRope["Spinifex layout analysis package loaded\n"]
END.
Edited on October 22, 1984 11:57:12 am PDT, by BERETTA
Implementation of dynamic menu entries (new feature of Chipndale).
changes to: DIRECTORY: added CDMenus,
IMPORTS: added CDMenus,
CDSequencer: parameters specified using keyword notation,
CDMenus: new, create a dynamic menu entry.
CDMenus: "Hilight pointed node" now in RectProgramMenu
Edited on December 6, 1984 3:14:29 pm PST, by Jacobi
changed the formatting, simplified, use of CDApplications.OnlySelected,
Edited on December 18, 1984 6:22:50 pm PST, by Jacobi
AnaysisAccess changed
Edited on January 30, 1985 7:49:17 pm PST, by Jacobi
Clear of SpinifexProperties removed and put in proper module
Edited on March 11, 1985 2:51:32 am PST, by Shand
New Command HighLightNodeFromKeyboard
changes to: DIRECTORY, HighLightNodeFromKeyboard, AnalyzeComm, HighLightNodeFromKeyboard, HighLightNodeFromKeyboard