CDUtil.mesa
by Ch. Jacobi, June 7, 1985 5:16:21 pm PDT
last edited Ch. Jacobi, September 23, 1985 4:11:53 pm PDT
CDUtil: CEDAR DEFINITIONS =
BEGIN
Handy procedures for creating designs from programs.
Direction: TYPE = {right, up, left, down, none};
InstRec:
TYPE =
RECORD [
ob: CD.Object,
name: Rope.ROPE ← NIL, --instance Name
orient: CD.Orientation←CD.original,
dX: CD.Number𡤀,
dY: CD.Number𡤀,
properties: CD.PropList←NIL --for the instance
];
CreateSimpleCell:
PROC [
design: CD.Design,
contents: LIST OF InstRec,
cellName: Rope.ROPE ← NIL,
direction: Direction ← right,
alignHigh: BOOL ← FALSE]
RETURNS [CD.Object];
--Creates a cell by basically abutting the instances (interest rects)
--design: cell is included into design; all instances must be in design too
--contents: list of descriptions of instances
-- the first is placed at an origin,
-- all others are placed abutting their predecessor in direction "direction"
-- (if direction is none: dX, dY is absolute)
--cellName: name given to cell
--direction: direction of abutting
--alignHigh:
-- FALSE: put the edges with smaller coordinate values into a line
-- TRUE: put the edges with larger coordinate values into a line
-- dX, dY: the instance is displaced by this amount before including;
-- not defaulting this causes to create not really abutting instances
PartialCopy:
PROC [ob:
CD.Object, design:
CD.Design, instances:
LIST
OF Rope.
ROPE←
NIL, remove:
BOOL←
TRUE, prop:
ATOM ← $InstanceName, name: Rope.
ROPE←
NIL]
RETURNS [
CD.Object];
--Copy the object; creates a cell
--remove TRUE:
-- all the instances with property prop are and a value in instances are removed
--remove FALSE:
-- only the instances with property prop are and a value in instances are copied
--interest rect:
-- if explicit, it will be copied,
-- if defaulted, a new one will be defaulted
--the origin will be inherited
END.