TestSisyph.mesa
Copyright Ó 1985, 1986, 1987 by Xerox Corporation. All rights reserved.
Created by Pradeep Sindhu, November 26, 1985 3:06:31 pm PST
Pradeep Sindhu February 19, 1986 1:11:20 am PST
Bertrand Serlet April 14, 1987 2:32:33 am PDT
Barth, January 13, 1986 3:30:54 pm PST
DIRECTORY
CD, CDDirectory, CDRects, CDSatellites, CDCells,
Core, CoreClasses, CoreOps,
IO,
PW,
Rope,
Sinix,
Sisyph,
TerminalIO;
TestSisyph:
CEDAR
PROGRAM
IMPORTS CDDirectory, CoreClasses, CoreOps, PW, Sinix, Sisyph, TerminalIO = BEGIN
CellType: TYPE = Core.CellType;
Wire: TYPE = Core.Wire;
Object: TYPE = CD.Object;
ROPE: TYPE = Core.ROPE;
Context: TYPE = Sisyph.Context;
StructWire:
PROC [name:
ROPE, n:
INT]
RETURNS [Wire] = {
subWires: LIST OF Wire ← NIL;
WHILE n > 0 DO subWires ← CONS[CoreOps.CreateWire[], subWires]; n ← n-1; ENDLOOP;
RETURN [CoreOps.CreateWire[elements: subWires, name: name]]
};
TreeCellCode:
PROC []
RETURNS [CellType] = {
wire: Wire ← StructWire["father", 3];
RETURN [CoreClasses.CreateRecordCell[CoreOps.CreateWire[elements: LIST[wire]], CoreOps.CreateWire[elements: LIST[wire]], NIL]];
};
TestWireIcon:
PROC []
RETURNS [wire: Wire] = {
wire ← CoreOps.CreateWires[size: 3, name: "BigStruct"];
wire[0] ← CoreOps.CreateWire[name: "Zero"];
wire[1] ← CoreOps.CreateWire[name: "One"];
wire[2] ← CoreOps.CreateWires[size: 2, name: "SmallStruct"];
wire[2][0] ← CoreOps.CreateWire[name: "Zero"];
wire[2][1] ← CoreOps.CreateWire[name: "TwoOne"];
};
FooBarWireIcon:
PROC []
RETURNS [wires: Core.Wires] = {
wires ← LIST [CoreOps.CreateWire[name: "foo"], CoreOps.CreateWire[name: "bar"]];
};
TestCx:
PROC [] =
BEGIN
design: CD.Design ← PW.OpenDesign["ExtractExample"];
targetObj: CD.Object ← CDDirectory.Fetch[design, "nD"].object;
cx: Context ← Sisyph.Create[design];
result: REF ← Sinix.Extract[obj: targetObj, mode: Sisyph.mode, userData: cx].result;
CoreOps.Print[result, TerminalIO.TOS[]];
ERROR;
END;
Test:
PROC [] =
BEGIN
design: CD.Design ← PW.OpenDesign["TestSisyph"];
targetObj: CD.Object ← CDDirectory.Fetch[design, "TestCell"].object;
cx: Context ← Sisyph.Create[design];
result: REF ← Sinix.Extract[obj: targetObj, mode: Sisyph.mode, userData: cx].result;
CoreOps.Print[result, TerminalIO.TOS[]];
END;
END.