SinixBridgeImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reversed.
Created by Bertrand Serlet August 30, 1985 12:16:42 pm PDT
Bertrand Serlet October 27, 1985 3:26:51 pm PST
DIRECTORY
CD, CDCells, CDDefaultProcs, CDDirectory, CDProperties,
Core, CoreProperties,
Sinix, SinixBridge;
SinixBridgeImpl: CEDAR PROGRAM
IMPORTS CD, CDCells, CDDefaultProcs, CDDirectory, CDProperties, CoreProperties, Sinix
EXPORTS SinixBridge
SHARES CDDirectory =
BEGIN OPEN SinixBridge;
sinixBridgeClass: PUBLIC REF CD.ObjectClass ← CD.RegisterObjectClass[$WireToObjectBridge];
dp: REF CDDirectory.DirectoryProcs;
BridgeSpecific: TYPE = REF BridgeSpecificRec; -- hanging on the specificRef
BridgeSpecificRec: TYPE = RECORD [fatherSize: CD.Position, wire: Core.Wire, expandedAsPins: CD.Object ← NIL];
This last field is a cache
InstancesToCell: PROC [fatherSize: CD.Position, instances: LIST OF CD.Instance] RETURNS [cell: CD.Object] = {
cellPtr: CD.CellPtr;
cell ← CDCells.CreateEmptyCell[];
cellPtr ← NARROW [cell.specificRef];
cellPtr.contents ← instances;
cell.size ← fatherSize;
};
WireToObjectBridge: PUBLIC PROC [fatherSize: CD.Position, wire: Core.Wire] RETURNS [object: CD.Object] = {
IF Sinix.GetWireGeometryPropFromWire[wire]=NIL THEN ERROR;
IF CoreProperties.GetWireProp[wire, Sinix.pinsProp]=NIL THEN ERROR; -- Not all public wires have pins (for example in the case when the extraction is done flat).
object ← NEW [CD.ObjectRep ← [class: sinixBridgeClass, specificRef: NEW [BridgeSpecificRec ← [fatherSize: fatherSize, wire: wire]]]];
object.size ← fatherSize;
};
ExpandAsGeometry: PUBLIC CDDirectory.AnotherProc -- [me: CD.Object, from: CD.Design, to: CD.Design] RETURNS [CD.Object] -- = {
bridgeData: BridgeSpecific ← NARROW [me.specificRef];
RETURN [InstancesToCell[bridgeData.fatherSize, Sinix.GetWireGeometryPropFromWire[bridgeData.wire]]];
};
ExpandAsPins: PUBLIC CDDirectory.AnotherProc -- [me: CD.Object, from: CD.Design, to: CD.Design] RETURNS [CD.Object] -- = {
bridgeData: BridgeSpecific ← NARROW [me.specificRef];
IF bridgeData.expandedAsPins=NIL
THEN bridgeData.expandedAsPins ← InstancesToCell[bridgeData.fatherSize, NARROW [CoreProperties.GetWireProp[bridgeData.wire, Sinix.pinsProp]]];
RETURN [bridgeData.expandedAsPins];
};
SinixBridgeTouchProc: Sinix.TouchProc = {
instance1 ← NEW [CD.InstanceRep ← [
ob: ExpandAsPins[instance1.ob, NIL, NIL],
location: instance1.location, orientation: instance1.orientation
]];
RETURN [Sinix.Touch[instance1, instance2]];
};
dp ← CDDirectory.InstallDirectoryProcs[sinixBridgeClass];
dp.expand ← ExpandAsGeometry;
sinixBridgeClass.showMeSelected ← CDDefaultProcs.ShowMeSelectedWithExpand;
sinixBridgeClass.interestRect ← CDDefaultProcs.InterestRectWithExpand;
CDProperties.PutProp[sinixBridgeClass, Sinix.touchProcProp, NEW [Sinix.TouchProc ← SinixBridgeTouchProc]];
END.