RoseDisplayBrowsing.Mesa
Last Edited by: Spreitzer, July 13, 1984 11:21:46 pm PDT
Last Edited by: Barth, April 23, 1984 5:39:57 pm PST
DIRECTORY
Atom, Buttons, Graphs, GraphBrowsers, HierarchicalDisplays, IO, List, Menus, MessageWindow, OrderedSymbolTableRef, Rope, RoseConditions, RoseDisplayInsides, RoseEvents, RoseTypes, Trees, VFonts, ViewerClasses, ViewerOps, ViewerTools, ViewRec;
RoseDisplayBrowsing:
PROGRAM
IMPORTS Atom, GraphBrowsers, HD: HierarchicalDisplays, List, OrderedSymbolTableRef, MessageWindow, Rope, RoseDisplayInsides, RoseEvents, RoseTypes, VF:VFonts, VO: ViewerOps, VR: ViewRec
EXPORTS RoseDisplayInsides =
BEGIN OPEN RoseDisplayInsides;
nodeDisplaysProp: PUBLIC ATOM ← Atom.MakeAtom["Spreitzer January 6, 1984 9:24 pm"];
cellStateDisplayProp: PUBLIC ATOM ← Atom.MakeAtom["January 6, 1984 9:24 pm Spreitzer"];
cellStateClass:
PUBLIC
HD.ChildClass ←
NEW [
HD.ChildClassRep ← [
buttonProc: CellStateButtonProc,
NotifyOnRemove: NoticeCellStateRemoval]];
roseType: Graphs.NodeType ←
NEW [Graphs.NodeTypeRep ← [
Expand: RoseExpand,
NameNeighbors: NIL,
GetNamedNeighbor: NIL,
GetIndexedNeighbor: NIL,
GetNeighborCount: RoseNeighborCount,
View: NIL]];
rosemaryBrowser: GraphBrowsers.BrowserClass ←
NEW [GraphBrowsers.BrowserClassRep ← [
cmds: [
GraphBrowsers.basicBrowserClass.cmds[red],
ALL[ALL[[BrowserClick]]],
ALL[ALL[[BrowserClick]]]] ]];
BrowseDisplay:
PROC [display: Display, info: ViewerClasses.ViewerRec ← [], paint:
BOOLEAN ←
TRUE]
RETURNS [v: ViewerClasses.Viewer] =
BEGIN
v ← GraphBrowsers.Browse[node: CellNode[display.rootCell, display], browserClass: rosemaryBrowser, browserData: display, viewerInit: info, paint: paint].BrowserQuaViewer[];
END;
CellNode:
SAFE
PROC [cell: Cell, display: Display]
RETURNS [node: Graphs.Node] =
CHECKED
{node ← NEW [Graphs.NodeRep ← [type: roseType, rep: NEW [CellBrowserRep ← [cell, display]]]]};
StateNode:
SAFE
PROC [cb: CellBrowser]
RETURNS [node: Graphs.Node] =
CHECKED
{node ← NEW [Graphs.NodeRep ← [type: roseType, rep: NEW [CellStateRep ← [cb]]]]};
InterfaceNode:
SAFE
PROC [cb: CellBrowser]
RETURNS [node: Graphs.Node] =
CHECKED
{node ← NEW [Graphs.NodeRep ← [type: roseType, rep: NEW [InterfaceNodesRep ← [cb]]]]};
InternalNode:
SAFE
PROC [cb: CellBrowser]
RETURNS [node: Graphs.Node] =
CHECKED
{node ← NEW [Graphs.NodeRep ← [type: roseType, rep: NEW [InternalNodesRep ← [cb]]]]};
ComponentsNode:
SAFE
PROC [cb: CellBrowser]
RETURNS [node: Graphs.Node] =
CHECKED
{node ← NEW [Graphs.NodeRep ← [type: roseType, rep: NEW [ComponentsRep ← [cb]]]]};
NodeNode:
SAFE
PROC [ne: NodeElt]
RETURNS [node: Graphs.Node] =
CHECKED
{node ← NEW [Graphs.NodeRep ← [type: roseType, rep: ne]]};
RoseNeighborCount: Graphs.NeighborCountProc
--PROC [node: Node] RETURNS [neighborCount: INT]-- =
CHECKED
BEGIN
WITH node.rep
SELECT
FROM
cb: CellBrowser => RETURN[4];
in: InterfaceNodes => RETURN[in.cb1.cell.class.ports.length];
in: InternalNodes => RETURN[in.cb2.cell.internalNodes.Size[]];
components: Components => RETURN[components.cb3.cell.components.Size[]];
cs: CellState => RETURN [0];
ne: NodeElt => RETURN [CountLinksFromNode[ne.node]];
ENDCASE => ERROR;
END;
RoseExpand: Graphs.ExpandProc
--PROC [node: Node, consume: LinkConsumer]-- =
TRUSTED
BEGIN
WITH node.rep
SELECT
FROM
cb: CellBrowser => EnumerateCell[cb, consume];
in: InterfaceNodes => EnumerateInterfaceNodes[in, consume];
in: InternalNodes => EnumerateInternalNodes[in, consume];
components: Components => EnumerateComponents[components, consume];
cs: CellState => NULL;
ne: NodeElt => EnumerateFromNode[ne, consume];
ENDCASE => ERROR;
END;
CountLinksFromNode:
SAFE
PROC [node: Node]
RETURNS [count:
INT] =
TRUSTED
BEGIN
Do:
PROC [sl: RoseTypes.SocketList] =
BEGIN
FOR sl ← sl, sl.rest
WHILE sl #
NIL
DO
count ← count + 1;
ENDLOOP;
END;
count ← 0;
Do[node.readers];
Do[node.writers];
Do[node.bidirs];
END;
EnumerateFromNode:
PROC [ne: NodeElt, to: Graphs.LinkConsumer] =
BEGIN
Do:
PROC [sl: RoseTypes.SocketList, how:
ROPE] =
BEGIN
FOR sl ← sl, sl.rest
WHILE sl #
NIL
DO
to.proc[[
name: Rope.Cat[sl.first.cell.class.ports[sl.first.index].name, how, sl.first.cell.name],
otherSide: CellNode[cell: sl.first.cell, display: ne.org.display]], to.data];
ENDLOOP;
END;
Do[ne.node.readers, ">"];
Do[ne.node.writers, "<"];
Do[ne.node.bidirs, "="];
END;
EnumerateCell:
SAFE
PROC [cb: CellBrowser, to: Graphs.LinkConsumer, interf, intern:
BOOLEAN ←
TRUE] =
CHECKED
BEGIN
canInterf: BOOLEAN ← cb.cell.interfaceNodes.length > 0;
canIntern: BOOLEAN ← cb.cell.internalNodes.Size[] > 0;
canBoth: BOOLEAN ← canInterf AND canIntern;
interf ← interf OR NOT canBoth;
intern ← intern OR NOT canBoth;
IF canInterf AND interf THEN to.proc[["Interface Nodes", InterfaceNode[cb]], to.data];
IF canIntern AND intern THEN to.proc[["Internal Nodes", InternalNode[cb]], to.data];
IF cb.cell.components.Size[] > 0 THEN to.proc[["Components", ComponentsNode[cb]], to.data];
IF (IF cb.cell.realCellStuff = NIL THEN FALSE ELSE IF cb.cell.realCellStuff.state = NIL THEN FALSE ELSE NOT ISTYPE[cb.cell.realCellStuff.state, RoseTypes.Structure]) THEN to.proc[["State", StateNode[cb]], to.data];
END;
EnumerateInterfaceNodes:
SAFE
PROC [in: InterfaceNodes, to: Graphs.LinkConsumer] =
CHECKED
BEGIN
FOR ni:
CARDINAL
IN [0 .. in.cb1.cell.class.ports.length)
DO
port: RoseTypes.Port ← in.cb1.cell.class.ports[ni];
node: Node ← in.cb1.cell.interfaceNodes[ni];
ne: NodeElt ←
NEW [NodeEltRep ← [
name: port.name,
node: node,
org: [display: in.cb1.display, socket: [cell: in.cb1.cell, index: ni]],
parent: in.cb1,
format: node.type.procs.GetFormat[node.type, ""],
interfaceIndex: ni,
interfaceNode: TRUE
]];
IF ne.format = NIL THEN ERROR --type should supply default keyed by empty string--;
to.proc[[PortLinkName[port.name, node.name], NodeNode[ne]], to.data];
ENDLOOP;
END;
PortLinkName:
SAFE
PROC [portName, nodeName:
ROPE]
RETURNS [linkName:
ROPE] =
CHECKED
BEGIN
linkName ← IF portName.Equal[nodeName] THEN portName ELSE portName.Cat[": ", nodeName];
END;
EnumerateInternalNodes:
SAFE
PROC [in: InternalNodes, to: Graphs.LinkConsumer] =
CHECKED
BEGIN
FOR node: Node ← in.cb2.cell.firstInternalNode, node.next
WHILE node #
NIL
DO
ne: NodeElt ←
NEW [NodeEltRep ← [
node: node,
name: node.name,
org: [display: in.cb2.display, socket: [cell: in.cb2.cell, index: notFound]],
parent: in.cb2,
format: node.type.procs.GetFormat[node.type, ""],
interfaceIndex: notLookedFor]];
IF ne.format = NIL THEN ERROR;
to.proc[[node.name, NodeNode[ne]], to.data];
ENDLOOP;
END;
notFound: CARDINAL = RoseTypes.notFound;
notLookedFor: CARDINAL = notFound - 1;
EnumerateComponents:
SAFE
PROC [components: Components, to: Graphs.LinkConsumer] =
CHECKED
BEGIN
FOR cell: Cell ← components.cb3.cell.leftChild, cell.rightSibling
WHILE cell #
NIL
DO
to.proc[[cell.name, CellNode[cell: cell, display: components.cb3.display]], to.data];
ENDLOOP;
END;
NDLSearch:
PUBLIC
SAFE
PROC [ndl: NodeDisplayList, org: NodeOrigin, remove:
BOOLEAN]
RETURNS [newdl: NodeDisplayList, nd: NodeDisplay, found:
BOOLEAN] =
CHECKED
BEGIN
prev: NodeDisplayList ← NIL;
newdl ← ndl; found ← FALSE;
FOR ndl ← ndl, ndl.rest
WHILE ndl #
NIL
DO
IF ndl.first.org = org
THEN
BEGIN
IF found THEN ERROR ELSE found ← TRUE;
nd ← ndl.first;
IF remove
THEN
{IF prev = NIL THEN newdl ← ndl.rest ELSE prev.rest ← ndl.rest};
RETURN;
END;
prev ← ndl;
ENDLOOP;
END;
whatToDo: ARRAY Menus.MouseButton[yellow .. blue] OF ARRAY BOOL--ctl-- OF ARRAY BOOL--shift-- OF Graphs.LinkConsumerProc ← ALL[ALL[ALL[NIL]]];
BrowserClick: GraphBrowsers.BrowserCmdProc
--PROC [pane: Pane, index: CARDINAL- -origin 0- -, cmdData, browserData: REF ANY, button: Menus.MouseButton, ctl, shift, paint: BOOLEAN]-- =
CHECKED
BEGIN
n: Graphs.Node ← GraphBrowsers.GetPaneNode[pane];
d: Display ← GetDisplay[n];
d.mucking ← d.mucking + 1;
{ENABLE UNWIND => d.mucking ← d.mucking - 1;
whatToDo[button][ctl][shift][
[pane.GetChildName[index], pane.GetChildNode[index]],
NIL];
};
d.mucking ← d.mucking - 1;
END;
GetDisplay:
SAFE
PROC [n: Graphs.Node]
RETURNS [d: Display] =
CHECKED {
d ←
WITH n.rep
SELECT
FROM
cb: CellBrowser => cb.display,
cs: CellState => cs.cb0.display,
in: InterfaceNodes => in.cb1.display,
in: InternalNodes => in.cb2.display,
c: Components => c.cb3.display,
ne: NodeElt => ne.org.display,
ENDCASE => ERROR};
LogUD: Graphs.LinkConsumerProc =
CHECKED
BEGIN
WITH link.otherSide.rep
SELECT
FROM
ne: NodeElt => {
RoseEvents.RemoveWatcher[event: $NewNodeUD, watcher: [NotifyNodeUD, ne.org.display], watched: ne.node];
RoseEvents.AddWatcher[event: $NewNodeUD, watcher: [NotifyNodeUD, ne.org.display], watched: ne.node]};
cs: CellState => NULL;
cb: CellBrowser => NULL;
in: InterfaceNodes => NULL;
in: InternalNodes => NULL;
components: Components => NULL;
ENDCASE => ERROR;
END;
DontLogUD: Graphs.LinkConsumerProc =
CHECKED
BEGIN
WITH link.otherSide.rep
SELECT
FROM
ne: NodeElt => RoseEvents.RemoveWatcher[event: $NewNodeUD, watcher: [NotifyNodeUD, ne.org.display], watched: ne.node];
cs: CellState => NULL;
cb: CellBrowser => NULL;
in: InterfaceNodes => NULL;
in: InternalNodes => NULL;
components: Components => NULL;
ENDCASE => ERROR;
END;
DisplayAllButState: Graphs.LinkConsumerProc =
CHECKED
BEGIN
WITH link.otherSide.rep
SELECT
FROM
ne: NodeElt => DisplayNode[ne, FALSE];
cs: CellState => NULL;
cb: CellBrowser => EnumerateCell[cb: cb, to: [DisplayAllButState], interf: FALSE];
in: InterfaceNodes => EnumerateInterfaceNodes[in, [DisplayAllButState]];
in: InternalNodes => EnumerateInternalNodes[in, [DisplayAllButState]];
components: Components => EnumerateComponents[components, [DisplayAllButState]];
ENDCASE => ERROR;
END;
UnDisplayAll: Graphs.LinkConsumerProc =
TRUSTED
BEGIN
WITH link.otherSide.rep
SELECT
FROM
ne: NodeElt => UnDisplayNode[ne, FALSE];
cs: CellState => UnDisplayCellState[cs];
cb: CellBrowser => UnDisplayCell[cb];
in: InterfaceNodes => EnumerateInterfaceNodes[in, [UnDisplayAll]];
in: InternalNodes => EnumerateInternalNodes[in, [UnDisplayAll]];
components: Components => EnumerateComponents[components, [UnDisplayAll]];
ENDCASE => ERROR;
END;
DisplayAllState: Graphs.LinkConsumerProc =
TRUSTED
BEGIN
WITH link.otherSide.rep
SELECT
FROM
ne: NodeElt => NULL;
cs: CellState => DisplayCellState[cs];
cb: CellBrowser => EnumerateCell[cb: cb, to: [DisplayAllState], interf: FALSE];
in: InterfaceNodes => NULL;
in: InternalNodes => NULL;
components: Components => EnumerateComponents[components, [DisplayAllState]];
ENDCASE => ERROR;
END;
UnDisplayAllState: Graphs.LinkConsumerProc =
TRUSTED
BEGIN
WITH link.otherSide.rep
SELECT
FROM
ne: NodeElt => NULL;
cs: CellState => UnDisplayCellState[cs];
cb: CellBrowser => EnumerateCell[cb: cb, to: [UnDisplayAllState], interf: FALSE];
in: InterfaceNodes => NULL;
in: InternalNodes => NULL;
components: Components => EnumerateComponents[components, [UnDisplayAllState]];
ENDCASE => ERROR;
END;
DisplayCellState:
PROC [cs: CellState] =
BEGIN
dl: HD.Leaf ← NARROW[List.Assoc[key: cellStateDisplayProp, aList: cs.cb0.cell.props]];
IF dl =
NIL
THEN
BEGIN
CreateValue:
HD.ValueCreater
--PROC [leaf: Leaf] RETURNS [value: Viewer]-- =
CHECKED
BEGIN
value ←
VR.ViewRef[
agg: cs.cb0.cell.realCellStuff.state,
viewerInit: [
parent: leaf.container,
wx: 10,
wy: leaf.nameButton.wy + leaf.nameButton.wh + 2,
ww: MAX[100, leaf.container.cw - 10],
wh: VF.FontHeight[] + 5,
iconic: FALSE,
border: TRUE,
scrollable: FALSE],
createOptions: [mayInitiateRelayout: FALSE, feedBackHeight: 0],
parent: cs.cb0.display.rv,
paint: FALSE].RVQuaViewer[];
END;
dp: HD.Parent ← EnsureDisplay[cs.cb0];
name: ROPE ← cs.cb0.cell.name.Cat["'s state:"];
dl ← HD.AddLeaf[parent: dp, before: NextCellChild[cs.cb0.display, cs.cb0.cell.leftChild], name: name, class: cellStateClass, instanceData: cs, CreateValue: CreateValue, paint: FALSE];
cs.cb0.cell.props ← List.PutAssoc[key: cellStateDisplayProp, val: dl, aList: cs.cb0.cell.props];
END;
END;
UnDisplayCellState:
PROC [cs: CellState] =
BEGIN
dl: HD.Leaf ← NARROW[List.Assoc[key: cellStateDisplayProp, aList: cs.cb0.cell.props]];
IF dl # NIL THEN HD.Remove[dl];
END;
NoticeCellStateRemoval:
HD.ChildNotifyProc
-- PROC [child: Child]-- =
CHECKED
BEGIN
cs: CellState ← NARROW[child.instanceData];
cs.cb0.cell.props ← List.PutAssoc[key: cellStateDisplayProp, val: NIL, aList: cs.cb0.cell.props];
END;
CellStateButtonProc: Buttons.ButtonProc =
CHECKED
BEGIN
MessageWindow.Append[message: "Don't do that", clearFirst: TRUE];
END;
UnDisplayNode:
PROC [ne: NodeElt, noisy:
BOOLEAN] =
BEGIN
displays: NodeDisplayList ← NARROW[List.Assoc[key: nodeDisplaysProp, aList: ne.node.props]];
nd: NodeDisplay;
found: BOOLEAN;
[displays, nd, found] ← NDLSearch[ndl: displays, org: ne.org, remove: FALSE];
IF
NOT found
THEN
{IF noisy THEN ne.org.display.rv.DisplayMessage[msg: "not displayed!"]}
ELSE
BEGIN
HD.Remove[nd.dc];
IF noisy THEN ne.org.display.rv.DisplayMessage[msg: "ok"];
END;
END;
EnsureInterfaceIndex:
SAFE
PROC [ne: NodeElt] =
CHECKED {
IF ne.interfaceIndex = notLookedFor THEN ne.interfaceIndex ← RoseTypes.GetIndex[ne.org.socket.cell.class.ports, ne.name]};
DisplayNode:
SAFE
PROC [ne: NodeElt, noisy:
BOOLEAN] =
CHECKED
BEGIN
displays: NodeDisplayList ← NARROW[List.Assoc[key: nodeDisplaysProp, aList: ne.node.props]];
nd: NodeDisplay;
found: BOOLEAN;
[, nd, found] ← NDLSearch[ndl: displays, org: ne.org, remove: FALSE];
IF found
THEN
{IF noisy THEN ne.org.display.rv.DisplayMessage[msg: "already displayed!"]}
ELSE
IF ne.node.visible.cell #
NIL
THEN
BEGIN
CreateValue:
HD.ValueCreater =
TRUSTED
BEGIN
value ←
VO.CreateViewer[flavor: $Text, paint:
FALSE,
info: [parent: leaf.container,
data:
IF ne.org.display.ctlPanel.mode = Value
THEN ne.format.FormatValue[
ne.node,
ne.format,
ne.node.ValWP[]]
ELSE ne.format.FormatTest[
ne.node.type,
ne.format,
ne.testProc,
ne.testData],
wx: leaf.nameButton.wx + leaf.nameButton.ww + 2,
ww: ne.format.MaxWidth[ne.node.type, ne.format, VF.defaultFont] + 20,
wh: VF.FontHeight[] + 5,
iconic: FALSE,
border: FALSE,
scrollable: FALSE]];
VO.AddProp[viewer: value, prop: leafProp, val: leaf];
END;
dp: HD.Parent ← EnsureDisplay[ne.parent];
dc: HD.Leaf;
name: ROPE ← ne.name;
IF NOT ne.interfaceNode THEN name ← name.Concat[":"];
EnsureInterfaceIndex[ne];
IF ne.interfaceIndex # notFound
THEN
BEGIN
name ← name.Concat[SELECT (IF ne.org.socket.cell.class.ports[ne.interfaceIndex].input THEN 1 ELSE 0) + (IF ne.org.socket.cell.class.ports[ne.interfaceIndex].output THEN 2 ELSE 0) FROM 1 => "<", 2 => ">", 3 => "=", ENDCASE => ERROR];
END;
dc ← HD.AddLeaf[parent: dp, before: NextNodeChild[ne], name: name, class: nodeClass, instanceData: ne, CreateValue: CreateValue, paint: FALSE];
displays ← CONS[[ne.org, dc], displays];
ne.node.props ← List.PutAssoc[key: nodeDisplaysProp, val: displays, aList: ne.node.props];
RoseEvents.AddWatcher[watched: ne.node, watcher: [NotifyNodeView, dc], event: $ChangeEarly];
IF noisy THEN ne.org.display.rv.DisplayMessage[msg: "ok"];
END
ELSE ne.org.display.rv.DisplayMessage[ne.name.Cat[" can't be displayed"]];
END;
NextNodeChild:
SAFE
PROC [ne: NodeElt]
RETURNS [child:
HD.Child] =
CHECKED
BEGIN
Displayed:
SAFE
PROC [node: Node]
RETURNS [
BOOLEAN] =
CHECKED
BEGIN
displays: NodeDisplayList ← NARROW[List.Assoc[key: nodeDisplaysProp, aList: node.props]];
nd: NodeDisplay;
found: BOOLEAN;
[, nd, found] ← NDLSearch[ndl: displays, org: ne.org, remove: FALSE];
IF found THEN child ← nd.dc;
RETURN [found];
END;
node: Node ← ne.node.next;
IF ne.interfaceNode
THEN
BEGIN
FOR c:
CARDINAL
IN (ne.interfaceIndex .. ne.org.socket.cell.interfaceNodes.length)
DO
IF Displayed[ne.org.socket.cell.interfaceNodes[c]] THEN RETURN;
ENDLOOP;
node ← ne.org.socket.cell.firstInternalNode;
END;
FOR node ← node, node.next
WHILE node #
NIL
DO
IF Displayed[node] THEN RETURN ENDLOOP;
child ← NARROW[List.Assoc[key: cellStateDisplayProp, aList: ne.org.socket.cell.props]];
IF child # NIL THEN RETURN;
child ← NextCellChild[ne.org.display, ne.org.socket.cell.leftChild];
END;
UnDisplayCell:
PROC [cb: CellBrowser] =
BEGIN
dpAsAny: REF ANY ← List.Assoc[aList: cb.cell.props, key: cb.display];
IF dpAsAny #
NIL
THEN
BEGIN
dp: HD.Parent ← NARROW[dpAsAny];
IF dp.asChild #
NIL
THEN
BEGIN
HD.Remove[dp.asChild];
END;
END;
END;
NextCellChild:
SAFE
PROC [display: Display, start: Cell]
RETURNS [child:
HD.Child] =
CHECKED
BEGIN
FOR cell: Cell ← start, cell.rightSibling
WHILE cell #
NIL
DO
nextDPAsAny: REF ANY ← List.Assoc[aList: cell.props, key: display];
IF nextDPAsAny #
NIL
THEN
{child ← NARROW[nextDPAsAny, HD.Parent].asChild; EXIT};
ENDLOOP;
END;
EnsureDisplay:
SAFE
PROC [cb: CellBrowser]
RETURNS [dp:
HD.Parent] =
CHECKED
BEGIN
dpAsAny: REF ANY ← List.Assoc[aList: cb.cell.props, key: cb.display];
IF dpAsAny =
NIL
THEN
BEGIN
pdp: HD.Parent ← IF cb.cell.parent = NIL THEN cb.display.rootDisplay ELSE EnsureDisplay[NEW [CellBrowserRep ← [cb.cell.parent, cb.display]]];
dc: HD.Child;
dp ← (dc ← HD.AddInternalNode[parent: pdp, before: NextCellChild[cb.display, cb.cell.rightSibling], name: cb.cell.name.Cat[": "], class: cellClass, instanceData: cb, paint: FALSE]).asParent;
cb.cell.props ← List.PutAssoc[key: cb.display, val: dp, aList: cb.cell.props];
IF cb.cell.type = Real
THEN
BEGIN
RoseEvents.AddWatcher[$Schedule, [NotifyCellView, dc], cb.cell];
NotifyCellView[$Schedule, cb.cell, dc, NIL];
END;
END
ELSE dp ← NARROW[dpAsAny];
END;
Setup:
PROC =
BEGIN
whatToDo[yellow][FALSE][FALSE] ← DisplayAllButState;
whatToDo[yellow][FALSE][TRUE] ← UnDisplayAll;
whatToDo[blue][FALSE][FALSE] ← DisplayAllState;
whatToDo[blue][FALSE][TRUE] ← UnDisplayAllState;
whatToDo[yellow][TRUE][FALSE] ← DisplayAllButState;
whatToDo[yellow][TRUE][TRUE] ← UnDisplayAll;
whatToDo[blue][TRUE][FALSE] ← LogUD;
whatToDo[blue][TRUE][TRUE] ← DontLogUD;
END;
Setup[];
END.