CDCells.mesa (a Chipndale module)
by Christian Jacobi 23-Aug-83
last edited Christian Jacobi March 2, 1984 5:36:26 pm PST
DIRECTORY
Rope USING [ROPE],
CD USING [Design, ObPtr, DesignPosition, ApplicationPtr];
CDCells: CEDAR DEFINITIONS =
BEGIN
CreateEmptyCell: PROC [] RETURNS [CD.ObPtr];
--Does not includes the cell into any design or celldirectory.
--Does not name the cell.
--Use CDDirectory.Include to include cell to a design.
CreateCellSelected: PROC [design: CD.Design, name: Rope.ROPENIL]
RETURNS [done: BOOL, cellOb: CD.ObPtr];
--name=NIL: interactive read for name.
--name#NIL: hint for name; may be modified.
--If done: cell is included in directory of design.
PushInCellSelected: PROC [design: CD.Design] RETURNS [done: BOOL];
--message of problem if not done
PushInCellPointed: PROC [design: CD.Design, pos: CD.DesignPosition] RETURNS [done: BOOL];
--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};
RemoveApplication: PROC [design: CD.Design, cell: CD.ObPtr, aptr: CD.ApplicationPtr, draw: BOOLTRUE] RETURNS [removed: CD.ApplicationPtr←NIL, repositioned: BOOLFALSE];
--If necessary, modifies the boundary and translates all applications of the cell,
-- and further, translates all the instances of the cell. This changes the
-- parent cells, which therefore may be repositioned recursively too.
--noop if cell does not contain aptr (directly).
--Do not assume aptr^ to be freed for other use but use removed;
-- removed=NIL: aptr has not successfully been removed
-- removed#NIL: aptr is removed, removed is a copy of aptr for arbitrary re-use
--If design=NIL: to handle cells which are not part of any design
IncludeApplication: PROC [design: CD.Design, cell: CD.ObPtr, aptr: CD.ApplicationPtr, draw: BOOLTRUE, relativeTo: CD.ApplicationPtr←NIL] RETURNS [repositioned: BOOLFALSE];
--aptr^ is supposed to be referenced by aptr exclusively, and aptr^ may be changed by
-- IncludeApplication.
--If necessary, modifies the boundary and translates all applications of the cell,
-- and further, translates all the instances of the cell. This changes the
-- parent cells, which therefore may be repositioned recursively too.
--relativeTo#NIL: handy but trivial hook for clients which fear that repositioning
-- fools their origin: aptr is first translated by relativeTo.location: if relativeTo
-- points to an application of the cell itself, repositioning changes relativeTo^
-- exactly the right amount to compensate for the repositioning. It is the clients
-- responsibility that relativeTo is actual contained by cell.
--If design=NIL: to handle cells which are not part of any design
END.