InsertSegments:
PROC [table: Table, object:
CD.Object, instance:
CD.Instance, makeHashKey: HashKeyProc] ~ {
found: BOOL;
val: REF;
net: Net;
side: RTBasic.Side ← FromSideToSide[PWPins.GetSide[object, instance].side];
rect: CD.Rect ← CDSymbolicObjects.Denotes[instance];
name: Rope.ROPE ← CDSymbolicObjects.GetName[instance];
segment: Segment ← NEW[SegmentRec ← [name: name, object: object, range: CoordsAlongSide[instance, side, object], side: side, layer: CDSymbolicObjects.GetLayer[instance], segmentDat: NIL]];
tabIndex: Rope.ROPE ← IF makeHashKey=NIL THEN name ELSE makeHashKey[instance];
[found, val] ← Fetch[table, tabIndex];
net ← IF ~found THEN NEW[NetRec ← [name: name]] ELSE NARROW[val];
net.segments ← CONS[segment, net.segments];
[] ← Store[table, tabIndex, net]};
CoordsAlongSide:
PROC [instance:
CD.Instance, side: RTBasic.Side, object:
CD.Object]
RETURNS [range: Range] ~ {
rect: CD.Rect ← CDSymbolicObjects.Denotes[instance];
SELECT side
FROM
top, bottom => range ← [rect.x1 - object.bbox.x1, rect.x2 - object.bbox.x1];
left, right => range ← [rect.y1 - object.bbox.y1, rect.y2 - object.bbox.y1];
ENDCASE};