CDCells.mesa (a ChipNDale module)
Copyright © 1983, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, 23-Aug-83
last edited Christian Jacobi, March 25, 1986 1:35:33 pm PST
DIRECTORY
Rope USING [ROPE],
CD USING [Instance, Design, Object, ObjectClass, Rect, Position, Orientation],
CDDirectory USING [ReplaceList];
CDCells: CEDAR DEFINITIONS =
BEGIN
IsCell: PROC [ob: CD.Object] RETURNS [BOOL] = INLINE {
RETURN [ ob.class = cellClass ]
};
cellClass: PRIVATE READONLY CD.ObjectClass;
CreateEmptyCell: PROC [] RETURNS [CD.Object];
--Does not includes the cell into any design or celldirectory.
--Does not name the cell.
--Use CDDirectory.Include to include this cell to a design's directory.
--Use CDCells.IncludeOb to include objects into this cell.
--procedures for creating designs by programs...
CoordSystem: TYPE = {cdCoords, interrestCoords, originCoords};
-- cdCoords: chipndales internal and native coordinate system used in Instances
-- interrestCoords: base of interest-rects.
-- originCoords: invariant fake origin which for cells never changes, but might be far off...
IncludeMode: TYPE = {doit, dontReposition, dontPropagate, dontInclude};
IncludeOb: PROC [design: CD.Design←NIL, cell: CD.Object←NIL, ob: CD.Object,
position: CD.Position←[0, 0], --evaluated before an eventual repositioning
orientation: CD.Orientation𡤀,
cellCSystem: CoordSystem←originCoords,
obCSystem: CoordSystem←originCoords,
mode: IncludeMode𡤍oit]
RETURNS [newInst: CD.Instance, rep: BOOL];
--design (NIL: allowed, if cell really is not yet part of a design)
--cell (NIL: include into design; assumes the designs origin at [0, 0])
--  (design&cell NIL: simply create an application)
--ob: object to include in cell
--position: ...
--orientation: of ob inside cell
--cellCSystem: tells reference point in cell (for designs: [0, 0] anyway)
--obCSystem: reference point of object
--mode:
-- doit: normal case everything is done
-- dontReposition: speed up hack
--  Caution: makes temporary a wrong coordinate system! cell is
--  not legal until repositioning is called to clean up.
--  Has no effect if cell is NIL.
--  Does not cause redrawing of the design.
-- dontPropagate: speed up hack.
--  does neither reposition nor propagate the changed event; cell gets
--  an illegal state until repositioning and change-propagation occurs.
-- dontInclude: hack to create instances; cell is not changed at all.
--newInst: the new created application
--rep: Reposition was done or should be done, depending of mode
RemoveInstance: PROC [design: CD.Design←NIL, cell: CD.Object←NIL, inst: CD.Instance,
mode: IncludeMode𡤍oit] RETURNS [removed: BOOL, rep: BOOL];
--design (NIL: allowed, if cell really is not yet part of a design)
--cell (NIL: remove from design)
--  (design&cell NIL: Error)
--ob: object to include in cell
--position: ...
--orientation: of ob inside cell
--cellCSystem: tells reference point in cell (for designs: [0, 0] anyway)
--obCSystem: reference point of object
--mode:
-- doit: normal case everything is done
-- dontReposition: speed up hack
--  Caution: makes temporary a wrong coordinate system! cell is
--  not legal until repositioning is called to clean up.
--  Has no effect if cell is NIL.
--  Does not cause redrawing of the design.
-- dontPropagate: speed up hack.
--  does neither reposition nor propagate the changed event; cell gets
--  an illegal state until repositioning and change-propagation occurs.
-- dontInclude: hack to create instances; cell is not changed at all.
--rep: Reposition was done or should be done, depending of mode
ReplaceDirectChildForDummyCells: PRIVATE PROC [cellOb: CD.Object, replace: CDDirectory.ReplaceList] RETURNS [needReposition: BOOL];
--is like a real ReplaceDChildsProc, but does not start a recursive repositioning
RepositionCell: PROC [cellOb: CD.Object, design: CD.Design] RETURNS [didReposition: BOOL];
--save
SetInterestRect: PROC [cellOb: CD.Object, r: CD.Rect ← [0, 0, -1, -1]];
--defaulting r means to use a reasonable default for the interest rect
--does not propagate the change; caller must cause correct propagation separately
IsPushedIn: PROC [design: CD.Design] RETURNS [yes: BOOL];
SetSimplificationTreshhold: PROC [cell: CD.Object, val: REAL, inPixels: BOOLTRUE];
SetBorder: PROC [cell: CD.Object, border: BOOL];
--procedures for the interactive edit
CreateCellSelected: PROC [design: CD.Design, name: Rope.ROPENIL] RETURNS [done: BOOL, cellOb: CD.Object];
--name=NIL: interactive read for name.
--name#NIL: hint for name; may be modified.
--If done: cell is included in directory of design.
PushInCellInstance: PROC [design: CD.Design, inst: CD.Instance] RETURNS [done: BOOL];
--inst must be an instance of the currently toplevel pushed in cell of design
--message of problem if not done
PopFromCell: PROC [design: CD.Design, m: Method←interactive, name: Rope.ROPENIL] RETURNS [done: BOOL];
--message of problem if not done
Method: TYPE = {flush, newcell, replace, interactive};
PushedCellName: PROC [design: CD.Design] RETURNS [Rope.ROPE];
END.