WireIconsImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reversed.
Bertrand Serlet December 13, 1986 1:37:57 pm PST
Attention: this code should be simplified once Reposition goes away!!!
DIRECTORY
AMBridge, AMModelBridge, AMTypes,
CD, CDBasics, CDDirectory, CDProperties, CDRects, CDTexts,
Core, CoreOps,
CoreGeometry,
Interpreter, IO,
PrincOpsUtils, PW, Rope,
Sinix, Sisyph, WireIcons;
WireIconsImpl: CEDAR PROGRAM
IMPORTS AMBridge, AMModelBridge, CD, CDBasics, CDDirectory, CDProperties, CDRects, CDTexts, CoreOps, CoreGeometry, Interpreter, IO, PrincOpsUtils, PW, Rope, Sinix, Sisyph
EXPORTS WireIcons
SHARES Sisyph = BEGIN OPEN WireIcons;
Utilities
font: CDTexts.CDFont ← CDTexts.MakeFont["Xerox/TiogaFonts/Helvetica8", 4];
PutPin: PROC [wire: Wire, obj: CD.Object, size, pos: CD.Position] = {
pin: CD.Instance = PW.IncludeInCell[obj, CDRects.CreateRect[size, CD.commentLayer], pos];
CoreGeometry.PutPin[Sisyph.mode.decoration, wire, pin];
};
EvaluateParameters: PUBLIC PROC [userData: REF, obj: CD.Object, properties: CD.PropList] RETURNS [cx: Sisyph.Context] = {
resultRope: ROPE;
[cx, resultRope] ← Sisyph.EvaluateParameters[userData, obj, properties];
IF resultRope#NIL THEN ERROR;
};
EvalNat: PROC [cx: Sisyph.Context, expr: ROPE] RETURNS [nat: NAT] = {
result: AMTypes.TV;
errorRope: ROPE;
noResult: BOOL;
refInt: REF INT;
TRUSTED {[result, errorRope, noResult] ← Interpreter.Evaluate[
rope: expr,
context: AMModelBridge.ContextForFrame[
AMBridge.TVForFrame[PrincOpsUtils.GetReturnFrame[]]
],
symTab: cx
]};
IF errorRope#NIL THEN SIGNAL Sisyph.InterpreterError[cx, expr, errorRope];
TRUSTED {refInt ← NARROW [AMBridge.SomeRefFromTV[result]]};
RETURN [NAT [refInt^]];
};
Composer icon
MakeComposer: PUBLIC PROC [design: CD.Design, size: NAT] RETURNS [wire: Wire, obj: CD.Object] = {
l: INT = design.technology.lambda;
increment: INTSELECT TRUE FROM
size<4 => 8, size<6 => 6, size<8 => 4, size<16 => 2, size<32 => 2, ENDCASE => 1;
wire ← CoreOps.CreateWires[size: size];
obj ← PW.CreateEmptyCell[];
The big rectangle
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[increment*(size-1)*l+7*l/2, 7*l/2], CD.commentLayer], [0, l/2]];
The structured wire
PutPin[wire, obj, [l/2, l/2], [increment*(size-1)*l/2+2*l, 4*l]];
The composed wires
FOR i: NAT IN [0 .. size) DO
wire[i] ← CoreOps.CreateWire[];
PutPin[wire[i], obj, [l/2, l/2], [increment*i*l+2*l, 0]];
ENDLOOP;
The first composed wire
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[l, l/2], CD.commentLayer], [3*l/2, 0]];
CDProperties.PutObjectProp[obj, $ComposerSize, NEW [INT ← size]];
CDProperties.PutObjectProp[obj, Sisyph.mode.extractProcProp, $WireIconsExtractComposer];
PW.RepositionCell[obj];
CDCells.SetSimplificationTreshhold[obj, 10.0];
};
Composer: PW.UserProc = {
name: ROPE;
int: INTPW.RequestInt["Size of the composer? "];
IF int<1 THEN RETURN;
name ← IO.PutFR["::Composer[%g].icon", IO.int[int]];
ob ← CDDirectory.Fetch[design, name].object;
IF ob=NIL THEN {
ob ← MakeComposer[design, NAT [int]].obj;
[] ← CDDirectory.Include[design, ob, name];
};
};
ExtractComposer: Sinix.ExtractProc = {
cx: Sisyph.Context = NARROW [userData];
refNat: REF INTNARROW [CDProperties.GetObjectProp[obj, $ComposerSize]];
size: NATNAT [refNat^];
result ← MakeComposer[Sisyph.GetDesign[cx], size].wire;
};
Bus icon
MakeSlash: PROC [design: CD.Design] RETURNS [obj: CD.Object] = {
l: INT = design.technology.lambda;
obj ← PW.CreateEmptyCell[];
FOR i: INT IN [0 .. 2*l+l/4) DO
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[l/4, l/4], CD.commentLayer], [i, 2*i]];
ENDLOOP;
PW.RepositionCell[obj];
CDCells.SetSimplificationTreshhold[obj, 10.0];
};
MakeBus: PUBLIC PROC [design: CD.Design, size: NAT, slash: CD.Object ← NIL] RETURNS [wire: Wire, obj: CD.Object] = {
l: INT = design.technology.lambda;
wire ← CoreOps.CreateWires[size: size];
obj ← PW.CreateEmptyCell[];
The slash (if not present, the resulting obj should NOT be used)
IF slash#NIL THEN [] ← PW.IncludeInCell[obj, slash, [l-l/4, 0]];
The structured wire
PutPin[wire, obj, [9*l/2, l/2], [0, 2*l]];
The composed wires
FOR i: NAT IN [0 .. size) DO
wire[i] ← CoreOps.CreateWire[];
ENDLOOP;
The text
[] ← PW.IncludeInCell[obj, CDTexts.CreateText[IO.PutR1[IO.int[size]], font], [6*l/4, -13*l/4]];
CDProperties.PutObjectProp[obj, $BusSize, NEW [INT ← size]];
CDProperties.PutObjectProp[obj, Sisyph.mode.extractProcProp, $WireIconsExtractBus];
PW.SetInterestRect[obj, [9*l/2, 9*l/2]];
PW.RepositionCell[obj];
CDCells.SetSimplificationTreshhold[obj, 10.0];
};
Bus: PW.UserProc = {
slash: CD.Object;
int: INTPW.RequestInt["Size of the bus? "];
IF int<1 THEN RETURN;
slash ← CDDirectory.Fetch[design, "::SlashForBusIcon"].object;
IF slash=NIL THEN {
slash ← MakeSlash[design];
[] ← CDDirectory.Include[design, slash, "::SlashForBusIcon"];
};
ob ← MakeBus[design, NAT [int], slash].obj;
[] ← CDDirectory.Include[design, ob];
};
ExtractBus: Sinix.ExtractProc = {
cx: Sisyph.Context = NARROW [userData];
refNat: REF INTNARROW [CDProperties.GetObjectProp[obj, $BusSize]];
size: NATNAT [refNat^];
result ← MakeBus[Sisyph.GetDesign[cx], size].wire;
};
Extractor icon
MakeExtractor: PUBLIC PROC [design: CD.Design, index, size: NAT] RETURNS [wire: Wire, obj: CD.Object] = {
l: INT = design.technology.lambda;
wire ← CoreOps.CreateWires[size: size];
The composed wires
FOR i: NAT IN [0 .. size) DO wire[i] ← CoreOps.CreateWire[] ENDLOOP;
obj ← PW.CreateEmptyCell[];
The structured wire
PutPin[wire, obj, [9*l/2, l/2], [0, 2*l]];
The extracted wire
PutPin[wire[index], obj, [l/2, 3*l/2], [2*l, 0]];
The square
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[3*l/2, l/8], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[3*l/2, l/8], CD.commentLayer], [l, 3*l]];
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [19*l/8, 13*l/8]];
The texts
[] ← PW.IncludeInCell[obj, CDTexts.CreateText[IO.PutR1[IO.int[index]], font], [9*l/4, -13*l/4]];
[] ← PW.IncludeInCell[obj, CDTexts.CreateText[IO.PutR1[IO.int[size]], font], [9*l/4, 5*l/4]];
CDProperties.PutObjectProp[obj, $ExtractorIndex, NEW [INT ← index]];
CDProperties.PutObjectProp[obj, $ExtractorSize, NEW [INT ← size]];
CDProperties.PutObjectProp[obj, Sisyph.mode.extractProcProp, $WireIconsExtractExtractor];
PW.SetInterestRect[obj, [9*l/2, 7*l/2]];
PW.RepositionCell[obj];
CDCells.SetSimplificationTreshhold[obj, 10.0];
};
Extractor: PW.UserProc = {
int: INTPW.RequestInt["Index of the extracted wire? "];
int2: INTPW.RequestInt["Size of the structured wire? "];
IF int<0 OR int2<1 OR int>=int2 THEN RETURN;
ob ← MakeExtractor[design, NAT [int], NAT [int2]].obj;
[] ← CDDirectory.Include[design, ob];
};
ExtractExtractor: Sinix.ExtractProc = {
cx: Sisyph.Context = NARROW [userData];
refNat: REF INTNARROW [CDProperties.GetObjectProp[obj, $ExtractorIndex]];
refNat2: REF INTNARROW [CDProperties.GetObjectProp[obj, $ExtractorSize]];
index: NATNAT [refNat^];
size: NATNAT [refNat2^];
result ← MakeExtractor[Sisyph.GetDesign[cx], index, size].wire;
};
Range Extractor icon
MakeRangeExtractor: PUBLIC PROC [design: CD.Design, index, subSize, size: NAT] RETURNS [wires: Wires, obj: CD.Object] = {
l: INT = design.technology.lambda;
We create an extra level of hierarchy in the wires to extract things properly
structWire: Wire ← CoreOps.CreateWires[size: size];
subWire: Wire ← CoreOps.CreateWires[size: subSize];
wires ← LIST [subWire, structWire];
The composed wires
FOR i: NAT IN [0 .. size) DO structWire[i] ← CoreOps.CreateWire[] ENDLOOP;
FOR i: NAT IN [0 .. subSize) DO subWire[i] ← structWire[i+index] ENDLOOP;
obj ← PW.CreateEmptyCell[];
The structured wire
PutPin[structWire, obj, [19*l/2, l/2], [0, 2*l]];
The extracted wire
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[l/2, 3*l/2], CD.commentLayer], [5*l/2, 0]];
PutPin[subWire, obj, [l/2, 3*l/2], [3*l, 0]];
The rectangle
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[5*l/2, l/8], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[5*l/2, l/8], CD.commentLayer], [l, 3*l]];
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[obj, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [27*l/8, 13*l/8]];
The texts
[] ← PW.IncludeInCell[obj, CDTexts.CreateText[IO.PutFR["%g/%g", IO.int[index], IO.int[subSize]], font], [13*l/4, -13*l/4]];
[] ← PW.IncludeInCell[obj, CDTexts.CreateText[IO.PutR1[IO.int[size]], font], [13*l/4, 5*l/4]];
CDProperties.PutObjectProp[obj, $ExtractorIndex, NEW [INT ← index]];
CDProperties.PutObjectProp[obj, $ExtractorSubSize, NEW [INT ← subSize]];
CDProperties.PutObjectProp[obj, $ExtractorSize, NEW [INT ← size]];
CDProperties.PutObjectProp[obj, Sisyph.mode.extractProcProp, $WireIconsExtractRangeExtractor];
PW.SetInterestRect[obj, [19*l/2, 7*l/2]];
PW.RepositionCell[obj];
CDCells.SetSimplificationTreshhold[obj, 10.0];
};
RangeExtractor: PW.UserProc = {
int: INTPW.RequestInt["Index of the extracted wire? "];
int2: INTPW.RequestInt["Size of the extracted wire? "];
int3: INTPW.RequestInt["Size of the structured wire? "];
IF int<0 OR int2<1 OR int3<1 OR int>=int3 OR int+int2>int3 THEN RETURN;
ob ← MakeRangeExtractor[design, NAT [int], NAT [int2], NAT [int3]].obj;
[] ← CDDirectory.Include[design, ob];
};
ExtractRangeExtractor: Sinix.ExtractProc = {
cx: Sisyph.Context = NARROW [userData];
refNat: REF INTNARROW [CDProperties.GetObjectProp[obj, $ExtractorIndex]];
refNat2: REF INTNARROW [CDProperties.GetObjectProp[obj, $ExtractorSubSize]];
refNat3: REF INTNARROW [CDProperties.GetObjectProp[obj, $ExtractorSize]];
index: NATNAT [refNat^];
subSize: NATNAT [refNat2^];
size: NATNAT [refNat3^];
result ← MakeRangeExtractor[Sisyph.GetDesign[cx], index, subSize, size].wires;
};
Parametrized Bus icon
ParametrizedBus: PW.UserProc = {
l: INT = design.technology.lambda;
slash: CD.Object ← CDDirectory.Fetch[design, "::SlashForBusIcon"].object;
sizeRope: ROPEPW.RequestRope["Size of the parametrized bus? "];
IF slash=NIL THEN {
slash ← MakeSlash[design];
[] ← CDDirectory.Include[design, slash, "::SlashForBusIcon"];
};
ob ← PW.CreateEmptyCell[];
[] ← PW.IncludeInCell[ob, slash, [l-l/4, 0]];
PutPin[CoreOps.CreateWire[], ob, [9*l/2, l/2], [0, 2*l]]; -- throw away wire!
The text
[] ← PW.IncludeInCell[ob, CDTexts.CreateText[sizeRope, font], [6*l/4, -13*l/4]];
CDProperties.PutObjectProp[ob, $BusSize, sizeRope];
CDProperties.PutObjectProp[ob, Sisyph.mode.extractProcProp, $WireIconsExtractParametrizedBus];
PW.SetInterestRect[ob, [9*l/2, 9*l/2]];
PW.RepositionCell[ob];
CDCells.SetSimplificationTreshhold[ob, 10.0];
[] ← CDDirectory.Include[design, ob];
};
ExtractParametrizedBus: Sinix.ExtractProc = {
cx: Sisyph.Context ← EvaluateParameters[userData, obj, properties];
design: CD.Design ← Sisyph.GetDesign[cx];
slash: CD.Object ← CDDirectory.Fetch[design, "::SlashForBusIcon"].object;
l: INT = design.technology.lambda;
sizeRope: ROPENARROW [CDProperties.GetObjectProp[obj, $BusSize]];
size: NAT ← EvalNat[cx, sizeRope];
wire: Wire;
ob: CD.Object ← PW.CreateEmptyCell[]; -- we need this because of repositionment!!!
IF size<1 THEN ERROR;
IF slash=NIL THEN slash ← MakeSlash[design];
wire ← CoreOps.CreateWires[size: size];
[] ← PW.IncludeInCell[ob, slash, [l-l/4, 0]];
The structured wire
PutPin[wire, ob, [9*l/2, l/2], [0, 2*l]]; -- new object thrown away!
[] ← PW.IncludeInCell[ob, CDTexts.CreateText[sizeRope, font], [6*l/4, -13*l/4]];
PW.SetInterestRect[ob, [9*l/2, 9*l/2]];
PW.RepositionCell[ob];
The composed wires
FOR i: NAT IN [0 .. size) DO
wire[i] ← CoreOps.CreateWire[];
ENDLOOP;
result ← wire;
};
Parametrized Extractor icon
ParametrizedExtractor: PW.UserProc = {
l: INT = design.technology.lambda;
indexRope: ROPEPW.RequestRope["Parametrized index of the extracted wire? "];
sizeRope: ROPEPW.RequestRope["Size of the parametrized bus? "];
ob ← PW.CreateEmptyCell[];
The structured wire
PutPin[CoreOps.CreateWire[], ob, [9*l/2, l/2], [0, 2*l]];
The extracted wire
PutPin[CoreOps.CreateWire[], ob, [l/2, 3*l/2], [2*l, 0]];
The square
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[3*l/2, l/8], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[3*l/2, l/8], CD.commentLayer], [l, 3*l]];
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [19*l/8, 13*l/8]];
The texts
[] ← PW.IncludeInCell[ob, CDTexts.CreateText[indexRope, font], [9*l/4, -13*l/4]];
[] ← PW.IncludeInCell[ob, CDTexts.CreateText[sizeRope, font], [9*l/4, 5*l/4]];
CDProperties.PutObjectProp[ob, $ExtractorIndex, indexRope];
CDProperties.PutObjectProp[ob, $ExtractorSize, sizeRope];
CDProperties.PutObjectProp[ob, Sisyph.mode.extractProcProp, $WireIconsExtractParametrizedExtractor];
PW.SetInterestRect[ob, [9*l/2, 7*l/2]];
PW.RepositionCell[ob];
CDCells.SetSimplificationTreshhold[ob, 10.0];
[] ← CDDirectory.Include[design, ob];
};
ExtractParametrizedExtractor: Sinix.ExtractProc = {
cx: Sisyph.Context ← EvaluateParameters[userData, obj, properties];
design: CD.Design ← Sisyph.GetDesign[cx];
l: INT = design.technology.lambda;
indexRope: ROPENARROW [CDProperties.GetObjectProp[obj, $ExtractorIndex]];
sizeRope: ROPENARROW [CDProperties.GetObjectProp[obj, $ExtractorSize]];
index: NAT ← EvalNat[cx, indexRope];
size: NAT ← EvalNat[cx, sizeRope];
wire: Wire;
ob: CD.Object ← PW.CreateEmptyCell[]; -- we need this because of repositionment!!!
IF index<0 OR size<1 OR index>=size THEN ERROR;
wire ← CoreOps.CreateWires[size: size];
FOR i: NAT IN [0 .. size) DO wire[i] ← CoreOps.CreateWire[] ENDLOOP;
The structured wire
PutPin[wire, ob, [9*l/2, l/2], [0, 2*l]];
The extracted wire
PutPin[wire[index], ob, [l/2, 3*l/2], [2*l, 0]];
The square
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[3*l/2, l/8], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[3*l/2, l/8], CD.commentLayer], [l, 3*l]];
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [19*l/8, 13*l/8]];
The texts
[] ← PW.IncludeInCell[ob, CDTexts.CreateText[indexRope, font], [9*l/4, -13*l/4]];
[] ← PW.IncludeInCell[ob, CDTexts.CreateText[sizeRope, font], [9*l/4, 5*l/4]];
PW.SetInterestRect[ob, [9*l/2, 7*l/2]];
PW.RepositionCell[ob];
result ← wire;
};
Parametrized Range Extractor icon
ParametrizedRangeExtractor: PW.UserProc = {
l: INT = design.technology.lambda;
indexRope: ROPEPW.RequestRope["Parametrized index of the extracted wire? "];
subSizeRope: ROPEPW.RequestRope["Size of the parametrized sub wire? "];
sizeRope: ROPEPW.RequestRope["Size of the parametrized bus? "];
ob ← PW.CreateEmptyCell[];
The structured wire
PutPin[CoreOps.CreateWire[], ob, [19*l/2, l/2], [0, 2*l]];
The extracted wire
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[l/2, 3*l/2], CD.commentLayer], [5*l/2, 0]];
PutPin[CoreOps.CreateWire[], ob, [l/2, 3*l/2], [3*l, 0]];
The rect
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[5*l/2, l/8], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[5*l/2, l/8], CD.commentLayer], [l, 3*l]];
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [27*l/8, 13*l/8]];
The texts
[] ← PW.IncludeInCell[ob, CDTexts.CreateText[IO.PutFR["%g/%g", IO.rope[indexRope], IO.rope[subSizeRope]], font], [13*l/4, -13*l/4]];
[] ← PW.IncludeInCell[ob, CDTexts.CreateText[sizeRope, font], [13*l/4, 5*l/4]];
CDProperties.PutObjectProp[ob, $ExtractorIndex, indexRope];
CDProperties.PutObjectProp[ob, $ExtractorSubSize, subSizeRope];
CDProperties.PutObjectProp[ob, $ExtractorSize, sizeRope];
CDProperties.PutObjectProp[ob, Sisyph.mode.extractProcProp, $WireIconsExtractParametrizedRangeExtractor];
PW.SetInterestRect[ob, [19*l/2, 7*l/2]];
PW.RepositionCell[ob];
CDCells.SetSimplificationTreshhold[ob, 10.0];
[] ← CDDirectory.Include[design, ob];
};
ExtractParametrizedRangeExtractor: Sinix.ExtractProc = {
cx: Sisyph.Context ← EvaluateParameters[userData, obj, properties];
design: CD.Design ← Sisyph.GetDesign[cx];
l: INT = design.technology.lambda;
indexRope: ROPENARROW [CDProperties.GetObjectProp[obj, $ExtractorIndex]];
subSizeRope: ROPENARROW [CDProperties.GetObjectProp[obj, $ExtractorSubSize]];
sizeRope: ROPENARROW [CDProperties.GetObjectProp[obj, $ExtractorSize]];
index: NAT ← EvalNat[cx, indexRope];
subSize: NAT ← EvalNat[cx, subSizeRope];
size: NAT ← EvalNat[cx, sizeRope];
wire, subWire: Wire;
wires: Wires;
ob: CD.Object ← PW.CreateEmptyCell[]; -- we need this because of repositionment!!!
IF index<0 OR subSize<1 OR size<1 OR index>=size OR index+subSize>size THEN RETURN;
wire ← CoreOps.CreateWires[size: size];
subWire ← CoreOps.CreateWires[size: subSize];
FOR i: NAT IN [0 .. size) DO wire[i] ← CoreOps.CreateWire[] ENDLOOP;
FOR i: NAT IN [0 .. subSize) DO subWire[i] ← wire[i+index] ENDLOOP;
The structured wire
PutPin[wire, ob, [19*l/2, l/2], [0, 2*l]];
The extracted wire
PutPin[subWire, obj, [l/2, 3*l/2], [3*l, 0]];
The rect
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[5*l/2, l/8], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[5*l/2, l/8], CD.commentLayer], [l, 3*l]];
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [l, 3*l/2]];
[] ← PW.IncludeInCell[ob, CDRects.CreateRect[[l/8, 3*l/2], CD.commentLayer], [27*l/8, 13*l/8]];
The texts
[] ← PW.IncludeInCell[ob, CDTexts.CreateText[IO.PutFR["%g/%g", IO.rope[indexRope], IO.rope[subSizeRope]], font], [13*l/4, -13*l/4]];
[] ← PW.IncludeInCell[ob, CDTexts.CreateText[sizeRope, font], [13*l/4, 5*l/4]];
PW.SetInterestRect[ob, [9*l/2, 7*l/2]];
PW.RepositionCell[ob];
wires ← LIST [subWire, wire];
result ← wires;
};
Compatibility Code
Convert: PROC [design: CD.Design] = {
EachObj: CDDirectory.EachEntryAction = {
SELECT TRUE FROM
Rope.Match[":Composer[*].icon", name] => {
refNat: REF INTNARROW [CDProperties.GetObjectProp[ob, $ComposerSize]];
size: NATNAT [refNat^];
new: CD.Object = MakeComposer[design, size].obj;
off: CD.Position = CDBasics.SubPoints[CDBasics.BaseOfRect[CD.InterestRect[ob]], CDBasics.BaseOfRect[CD.InterestRect[new]]];
CDDirectory.ReplaceObject[design, ob, new, off];
};
Rope.Match[":Bus[*].icon", name] => {
refNat: REF INTNARROW [CDProperties.GetObjectProp[ob, $BusSize]];
size: NATNAT [refNat^];
new: CD.Object = MakeBus[design, size].obj;
off: CD.Position = CDBasics.SubPoints[CDBasics.BaseOfRect[CD.InterestRect[ob]], CDBasics.BaseOfRect[CD.InterestRect[new]]];
CDDirectory.ReplaceObject[design, ob, new, off];
};
Rope.Match[":Extractor[*, *].icon", name] => {
refNat: REF INTNARROW [CDProperties.GetObjectProp[ob, $ExtractorIndex]];
refNat2: REF INTNARROW [CDProperties.GetObjectProp[ob, $ExtractorSize]];
index: NATNAT [refNat^];
size: NATNAT [refNat2^];
new: CD.Object = MakeExtractor[design, index, size].obj;
off: CD.Position = CDBasics.SubPoints[CDBasics.BaseOfRect[CD.InterestRect[ob]], CDBasics.BaseOfRect[CD.InterestRect[new]]];
CDDirectory.ReplaceObject[design, ob, new, off];
};
Rope.Match[":RangeExtractor[*/*, *].icon", name] => {
refNat: REF INTNARROW [CDProperties.GetObjectProp[ob, $ExtractorIndex]];
refNat2: REF INTNARROW [CDProperties.GetObjectProp[ob, $ExtractorSubSize]];
refNat3: REF INTNARROW [CDProperties.GetObjectProp[ob, $ExtractorSize]];
index: NATNAT [refNat^];
subSize: NATNAT [refNat2^];
size: NATNAT [refNat3^];
new: CD.Object = MakeRangeExtractor[design, index, subSize, size].obj;
off: CD.Position = CDBasics.SubPoints[CDBasics.BaseOfRect[CD.InterestRect[ob]], CDBasics.BaseOfRect[CD.InterestRect[new]]];
CDDirectory.ReplaceObject[design, ob, new, off];
};
ENDCASE => {};
};
[] ← CDDirectory.Enumerate[design, EachObj];
};
Initialization
PW.Register[Composer, "Composer"];
Sinix.RegisterExtractProc[$WireIconsExtractComposer, ExtractComposer];
PW.Register[Bus, "Bus"];
Sinix.RegisterExtractProc[$WireIconsExtractBus, ExtractBus];
PW.Register[Extractor, "Extractor"];
Sinix.RegisterExtractProc[$WireIconsExtractExtractor, ExtractExtractor];
PW.Register[RangeExtractor, "Range Extractor"];
Sinix.RegisterExtractProc[$WireIconsExtractRangeExtractor, ExtractRangeExtractor];
PW.Register[ParametrizedBus, "Parametrized Bus"];
Sinix.RegisterExtractProc[$WireIconsExtractParametrizedBus, ExtractParametrizedBus];
PW.Register[ParametrizedExtractor, "Parametrized Extractor"];
Sinix.RegisterExtractProc[$WireIconsExtractParametrizedExtractor, ExtractParametrizedExtractor];
PW.Register[ParametrizedRangeExtractor, "Parametrized Range Extractor"];
Sinix.RegisterExtractProc[$WireIconsExtractParametrizedRangeExtractor, ExtractParametrizedRangeExtractor];
END.