CDBusCellsImpl.mesa (part of ChipNDale)
Copyright © 1983, 1985, 1986 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, June 24, 1983 4:58 pm
Last edited by: Christian Jacobi, October 22, 1986 10:58:22 am PDT
DIRECTORY
CD,
CDBasics,
CDBusCells,
CDCells,
CDDirectory,
CDIO,
CDRects,
TokenIO;
CDBusCellsImpl: CEDAR PROGRAM
IMPORTS CD, CDBasics, CDCells, CDDirectory, CDIO, CDRects, TokenIO
EXPORTS CDBusCells =
BEGIN
--========================================================
--for compatibility only
ReadBus: CD.InternalReadProc = {
sizeOfFirstX: INT = TokenIO.ReadInt[h];
sizeOfFirstY: INT = TokenIO.ReadInt[h];
lev: CD.Layer = CDIO.ReadLayer[h];
count: INT = TokenIO.ReadInt[h];
offsetX: INT = TokenIO.ReadInt[h];
offsetY: INT = TokenIO.ReadInt[h];
lengIncrement: INT = TokenIO.ReadInt[h];
RETURN [ CreateBusCell[
design: CDIO.DesignInReadOperation[h],
sizeOfFirst: [sizeOfFirstX, sizeOfFirstY],
lev: lev,
count: count,
offset: [offsetX, offsetY],
lengIncrement: lengIncrement
]];
};
--========================================================
CreateBusCell: PUBLIC PROC [design: CD.Design, sizeOfFirst: CD.Position, lev: CD.Layer, count: NAT, offset: CD.Position, lengIncrement: CD.Number𡤀] RETURNS [CD.Object] = {
sz: CD.Position ← sizeOfFirst;
pos: CD.Position ← [0, 0];
co: CD.Object ← CDCells.CreateEmptyCell[];
count ← MAX[count, 1];
IF sz.x<=0 THEN sz.x𡤁
IF sz.y<=0 THEN sz.y𡤁
IF sz.y+(count-1)*lengIncrement<0 THEN lengIncrement𡤀
IF offset.x<0 THEN {pos.x ← -offset.x*(count-1)};
IF offset.y<0 THEN {pos.y ← -offset.y*(count-1)};
FOR i: NAT IN [1..count] DO
rec: CD.Object ← CDRects.CreateRect[sz, lev];
pos ← CDBasics.AddPoints[pos, offset];
sz.y ← sz.y+lengIncrement;
[] ← CDCells.IncludeOb[design: NIL, cell: co, ob: rec, trans: [pos, original], mode: dontResize];
ENDLOOP;
[] ← CDCells.SetInterestRect[NIL, co,, dontResize];
[] ← CDCells.ResizeCell[NIL, co];
IF design#NIL THEN [] ← CDDirectory.Include[design, co, "-bus-"];
RETURN [co];
};
[] ← CD.RegisterObjectClass[$Bus, [internalRead: ReadBus]];
END.