CDSymbolicObjects.mesa (part of ChipNDale)
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, August 8, 1984 12:41:50 pm PDT
last edited Christian Jacobi, March 25, 1986 1:36:23 pm PST
DIRECTORY
CD, Rope;
CDSymbolicObjects: CEDAR DEFINITIONS =
BEGIN
Symbolic objects denote points, vertical and horizontal line segments and rectangles. These objects can be used to define interfaces.
Marks denote points: The object relative point [0, 0]. (The lower left point)
Segments denote line segments: The object relative segment from [0, 0] to [0, size.y]. (The left border)
Pins denote rectangles: The object relative rectangle [0, 0, size.x, size.y]. (All the area)
The interrest rect is equal to [0, 0, size.x, size.y]; the Client origin is at [0, 0]. The unused dimensions are of no consequence for Points or Segments. Point and Segment instances therefore must map the orientation of the object to get the denoting position(s).
It is perfectly ok to create instances of symbolic objects with any means, this module does not include any hidden features on these objects. It is common to have several symbolic object instances with the same name.
The actual properties like name, layer, property-list and its semantics are bound to the Instance, not the object.
The semantics of a symbolic object with NIL owner is not known, and no restrictions are required [or allowed!] from ChipNDale. Certain applications may demand restrictions, but can not rely on them. The owner field can be used to specify for what application an instance of a symbolic object is thought of; the owner field defines the semantics.
--Create procedures
--All create procedures may create objects of different genre if the parameters suggests. Symbolic objects may be shared by different instances or different designs. The dummy-dimension may be used to make the object larger than the denoting position(s); however, it is used as hint only.
CreateMark: PROC [dummySize: CD.Number𡤀] RETURNS [CD.Object];
CreateSegment: PROC [length: CD.Number, dummyWidth: CD.Number𡤀] RETURNS [CD.Object];
CreatePin: PROC [size: CD.Position] RETURNS [CD.Object];
--Recognizing symbolic objects
Kind: TYPE = {notSymbolic, mark, segment, pin};
SymbolicKind: PROC [ob: CD.Object] RETURNS [Kind];
IsSymbolicOb: PROC [ob: CD.Object] RETURNS [BOOL];
IsMark: PROC [ob: CD.Object] RETURNS [BOOL];
IsSegment: PROC [ob: CD.Object] RETURNS [BOOL];
IsPin: PROC [ob: CD.Object] RETURNS [BOOL];
--Properties of instances of symbolic objects
SetOwner: PROC [symInst: CD.Instance, owner: ATOMNIL];
GetOwner: PROC [symInst: CD.Instance] RETURNS [ATOM];
--If owner is not NIL it must be registered with CDProperties
SetName: PROC [symInst: CD.Instance, name: Rope.ROPE];
GetName: PROC [symInst: CD.Instance] RETURNS [Rope.ROPE];
SetLayer: PROC [symInst: CD.Instance, layer: CD.Layer];
GetLayer: PROC [symInst: CD.Instance] RETURNS [CD.Layer];
--I layer=CD.undefLayer means: not yet determined,
--  or either: object has more complex functionality
--It depends from the application whether the layer is meaningfull or not
Denotes: PROC [symInst: CD.Instance] RETURNS [CD.Rect];
--The denoted area; a rect for pins, a degenerated rect for segments and marks
--Direction and creation of directed instances
--It depends from the application whether Direction has any meaning...
DirectionOrNone: TYPE = {west, south, east, north, none};
Direction: TYPE = DirectionOrNone[west..north];
DirectionFromOrient: PROC [o: CD.Orientation] RETURNS [dir: Direction];
--returns direction where the west side of an oriented object faces
OrientFromDirection: PROC [dir: Direction] RETURNS [o: CD.Orientation];
--returns an orientation such that the west side of an oriented object faces dir
CreateSymInst: PROC [name: Rope.ROPENIL, denotes: CD.Rect, dummySize: CD.Number ← 0, layer: CD.Layer ← CD.undefLayer, owner: ATOMNIL, approachFrom: Direction ← west] RETURNS [CD.Instance];
--Lines will allways be approached from a direction perpendicular to their length.
--Special procedures for finding or enumerating symbolic objects in cells or (loaded) imports
InstEnumerator: TYPE = PROC [inst: CD.Instance] RETURNS [quit: BOOLFALSE];
EnumerateSymbolicObs: PROC [cellOb: CD.Object←NIL, eachInst: InstEnumerator] RETURNS [quit: BOOL];
--Random order; changes on cellOb while the enumeration may or may not be seen
--or may even cause other symbolic to be visited a different number than once.
--The instances are the real instances inside cellOb; modifycations would change cellOb
FindSymbolicObs: PROC [cellOb: CD.Object←NIL, name: Rope.ROPE] RETURNS [CD.InstanceList];
--Returns all symbolic objects with name "name"
--The instances are the real instances inside cellOb; modifycations would change cellOb
--implementors stuff
pinClass: PRIVATE READONLY CD.ObjectClass;
segmentClass: PRIVATE READONLY CD.ObjectClass;
markClass: PRIVATE READONLY CD.ObjectClass;
pinLayer: PRIVATE READONLY CD.Layer;
segmentLayer: PRIVATE READONLY CD.Layer;
--abstract layers to allow using stretch and split commands
END.