CD.mesa; Main definitions for ChipNDale, a VLSI design editor
Copyright © 1983, 1985 by Xerox Corporation. All rights reserved.
by Ch. Jacobi, June 24, 1983 3:54 pm
last edited Christian Jacobi, May 1, 1985 10:13:45 am PDT
DIRECTORY
Graphics USING [Context, Color, PaintMode, black],
List USING [AList],
MBQueue USING [Queue],
D2Basic USING [Number, Coord, Rect],
RefTab USING [Ref],
Rope USING [ROPE],
SymTab USING [Ref];
CD: CEDAR DEFINITIONS =
--CD stands for ChipNDale,
BEGIN
-- measures
-- independent of coordinate system
Number: TYPE = D2Basic.Number;
Position: TYPE = D2Basic.Coord;
-- RECORD [x, y: Number];
Rect: TYPE = D2Basic.Rect;
-- RECORD [x1, y1, x2, y2: Number];
--A Rect is called normalized if (x1>x2) OR (y1>y2) means that the Rect is empty.
--Rects are normalized, except if a special comment denies.
--Rect's are closed: they include all the endpoints; as you expect, points have
--size 0; except if a special comment denies.
-- design coordinates
DesignNumber: TYPE = Number;
DesignPosition: TYPE = Position;
DesignRect: TYPE = Rect;
lambda: DesignNumber = 2;
--your program must not depend on the value of lambda
Orientation: TYPE = [0..7] ← 0;
--Module CDOrient exports all you probably need about Orientations;
--If your program depends on the representation of Orientation, it
--is probably wrong.
original: Orientation = 0;
-- Errors
Error: ERROR [ec: ErrorCode ← programmingError, explanation: Rope.ROPENIL];
ErrorCode: TYPE = {programmingError, callingError, noResource, doubleRegistration, missingRegistration, other};
-- properties
Properties: TYPE = List.AList;
--friendly use expected: don't assign properties without first register
--their names with CDProperties.
--use only CDProperties to access Properties
-- layers
layerNum: NAT = 256;
Layer: TYPE = [0..layerNum);
combined: Layer = 0; -- layer used for object containing different or unknown Layers
highLightShade: Layer = 1; -- visualization; not for generating masks
highLightError: Layer = 2; -- visualization; not for generating masks
backGround: Layer = 3; -- special pushed-in backGround; not for generating masks
NewLayer: PROC [technology: Technology, uniqueKey: ATOM] RETURNS [Layer];
--may raise Error[noResource] and others
--the technolgy implementation must guarantee for uniqueness of uniqueKey's
-- (unique only for the technology)
FetchLayer: PROC [t: Technology, uniqueKey: ATOM] RETURNS [Layer];
LayerTechnology: PROC [l: Layer] RETURNS [Technology];
LayerKey: PROC [l: Layer] RETURNS [ATOM];
--object, cells, applications
markNum: NAT = 256;
ObPtr: TYPE = REF ObjectDefinition;
ObjectDefinition: TYPE = RECORD [
p: REF --READONLY-- ObjectProcs, -- never modify p nor p^
size: DesignPosition ← [lambda, lambda],
layer: Layer ← combined,
marked: [0..markNum) ← 0, --only objects with inDirectory are not shared through designs
specificRef: REF ANYNIL,
properties: Properties ← NIL -- see warning
];
--Several applications may point to same object: consider on modifications.
--Some implementors of object-types share the bits of different objectdefinitions
--if they are the same, excluding properties. User of properties loose.
CellPtr: TYPE = REF CellRecord;
CellRecord: TYPE = RECORD [
contents: ApplicationList ← NIL,
simplifyOn: NATLAST[NAT],
ir: CD.DesignRect ← [0, 0, -1, -1],
dIr: CD.DesignRect ← [0, 0, -1, -1], --default value for interest rect
name: Rope.ROPENIL,
useDIr: BOOLTRUE, --should use the default for interest rect
origin: CD.DesignPosition ← [0, 0]
];
RectPtr: TYPE = REF RectRecord;
RectRecord: TYPE = RECORD [filler: PRIVATE REF];
ApplicationList: TYPE = LIST OF ApplicationPtr←NIL;
ApplicationPtr: TYPE = REF Application;
Application: TYPE = RECORD [
ob: ObPtr,
location: DesignPosition ← [0, 0], --in cd-coords
orientation: Orientation ← 0,
selected: BOOLFALSE,
reserved: BOOLFALSE,
properties: Properties ← NIL
];
ObjectProcs: TYPE = RECORD [ -- generic procedures for an object
quickDrawMe: DrawProc,
drawMe: DrawProc,
showMeSelected: DrawProc,
hitInside: HitInsideProc, -- if called, aptr.ob.p.hitInside MUST be the called procedure itself
interestRect: RectProc,
oldInsideRect: RectProc, -- old inside rect
technology: Technology, -- NIL on technology independent stuff
objectType: ATOM,
inDirectory: BOOL, -- if inDirectory then included in directory;
-- all object classes which have children must be in the directory
directoryProcs: REFNIL,
wireTyped: BOOL ← FALSE, -- if wiretyped then insideRect.y corresponds length
symbolic: BOOL ← FALSE,
reservedForCDEnvironment: BOOL ← FALSE,
reserved: BOOL ← FALSE,
internalWrite: InternalWriteProc,
internalRead: InternalReadProc,
description: Rope.ROPENIL,
describe: DescribeProc ← NIL,
describeApp: DescribeAppProc ← NIL,
origin: PosProc ← NIL,
further: PRIVATE RefTab.Ref,
properties: Properties ← NIL
];
DrawProc: TYPE = PROC [aptr: ApplicationPtr, pos: DesignPosition, orient: Orientation, pr: REF DrawInformation];
--ignores aptr.location and aptr.orientation, may use aptr.properties
HitInsideProc: TYPE = PROC [aptr: ApplicationPtr, hitRect: DesignRect] RETURNS [BOOL];
PosProc: TYPE = PROC [ob: ObPtr] RETURNS [DesignPosition];
RectProc: TYPE = PROC [ob: ObPtr] RETURNS [DesignRect];
BoolProc: TYPE = PROC [ob: ObPtr] RETURNS [BOOL];
InternalWriteProc: TYPE = PROC [me: ObPtr];
InternalReadProc: TYPE = PROC [] RETURNS [ObPtr];
DescribeProc: TYPE = PROC [me: ObPtr] RETURNS [Rope.ROPE];
DescribeAppProc: TYPE = PROC [ap: ApplicationPtr] RETURNS [Rope.ROPE];
DrawContextProc: TYPE = PROC [pr: DrawRef, proc: DrawContextLayerProc, ob: ObPtr, pos: DesignPosition, orient: Orientation, layer: Layer];
DrawContextLayerProc: TYPE = PROC [context: Graphics.Context, ob: ObPtr, layer: Layer];
RegisterObjectType: PROC [objectType: ATOM, technology: Technology←NIL]
RETURNS [REF ObjectProcs];
--may raise Error[doubleRegistration] and others
--Also initializes procedures with default values
--An object type may be used either in arbitrary technology or technology-independent.
--This should be the only way to create data of type ObjectProcsRec
FetchObjectProcs: PROC [objectType: REF, technology: Technology←NIL]
RETURNS [REF --READONLY-- ObjectProcs];
--may raise Error[missingRegistration]
--consider ObjectProcs as readonly if you are not the implementor of the object type
-- Design
PushRec: TYPE = RECORD [
dummyCell: ApplicationPtr,
originally a copy of mightReplace; warning: size may be wrong
mightReplace: ApplicationPtr←NIL,
specific: CellPtr, -- cache of dummyCell.ob.specificRef
changed: BOOLFALSE,
indirectlyChanged: BOOLFALSE,
deletedList: REFNIL
];
Design: TYPE = REF DesignRec;
DesignRec: TYPE = RECORD [ -- use only CDOps.CreateDesign to create record
actual: LIST OF PushRec, -- actual.first is most deeply pushed cell;
cellDirectory: PRIVATE CellTableRef,
-- pushed cells are copied and not part of the cellDirectory
name: Rope.ROPENIL,
technology: Technology←NIL,
designValues: DesignValues←NIL, --CDValue
queue: MBQueue.Queue,
seqPrivate: SequencerRef,
properties: Properties←NIL
--CDValue supports more fields
];
SequencerRef: TYPE = REF SequencerDesignPrivate;
SequencerDesignPrivate: TYPE;
CellTableRef: PRIVATE TYPE = SymTab.Ref;
DesignValues: TYPE = REF DesignValuesRep; --CDValue
DesignValuesRep: TYPE; --CDValue
-- Technology
Technology: TYPE = REF TechnologyRec;
TechnologyRec: TYPE = RECORD [ -- use RegisterTechnology to create record
key: ATOMNIL,
name: Rope.ROPENIL,
technologyPrivate: PRIVATE TechnologyPrivate,
technologyValues: TechnologyValues, --CDValue
technologyCommands: TechnologyCommands, --CDSequencer
usedLayers: LIST OF Layer, -- without constant Layers defined in CD
properties: Properties←NIL
--CDValue supports more fields
];
TechnologyValues: TYPE = REF TechnologyValuesRep; --CDValue
TechnologyCommands: TYPE = REF TechnologyCommandsRep; --CDSequencer
TechnologyPrivate: TYPE = PRIVATE REF TechnologyPrivateRep;
TechnologyValuesRep: TYPE; --CDValue
TechnologyCommandsRep: TYPE; --CDSequencer
TechnologyPrivateRep: TYPE;
RegisterTechnology: PROC [key: ATOM, name: Rope.ROPENIL] RETURNS [Technology];
--This must be the only way to create data of type TechnologyRec
--may raise Error[doubleRegistration] and others
FetchTechnology: PROC [key: ATOM] RETURNS [Technology];
--may raise Error[missingRegistration] and others
-- drawing
DrawRef: TYPE = REF DrawInformation;
DrawInformation: TYPE = RECORD [
interestClip: DesignRect, -- (interrest area; not device area), in doubt is larger;
minimalSize: Number, -- if xyz<minimalSize; xyz is not drawn the normal way (Cells)
scaleHint: REAL, -- to monitor simplifications; 0 means no simplifications
drawChild: DrawProc,
drawRect: DrawRectProc, -- still world coordinates, how many bits do device coordinates use?
saveRect: DrawRectProc,
outLineProc: OutLineProc, -- usefull for visualization only; not for generating masks
drawComment: DrawCommentProc,
drawContext: DrawContextProc,
stopFlag: REF BOOL,
devicePrivate: REF, -- differentiate among multiple (viewers) with same drawProc's
viewerPrivate: ViewerPrivate ← NIL, -- speed up for viewers devicePrivate
contextFilter: REF ContextFilter ← NIL,
environment: BOOLTRUE,
symbolics: BOOLTRUE,
b1, b2: BOOLTRUE, -- reserved for some experiment
setGround: SetGroundProc,
properties: Properties ← NIL,
--state of redrawing
deviceContext: PRIVATE Graphics.Context,
viewerSave: ViewerSave ← NIL, -- speed up for viewers saveRect's internal's
design: Design,
nesting: REF Nesting, -- shares Application's but not ApplicationPtr's
nestDepth: CARDINAL
];
--DrawInformation records should not be copied unless the state of drawing is
--separately initialized (including viewerSave for viewers).
Nesting: TYPE = RECORD[table: SEQUENCE max: CARDINAL OF CD.ApplicationPtr];
--points to applications which are part of cells, and also
--points to dummy applications. Consider readonly.
ViewerPrivate: TYPE = REF ViewerPrivateRep;
ViewerPrivateRep: TYPE;
ViewerSave: TYPE = REF ViewerSaveRep;
ViewerSaveRep: TYPE;
DrawRectProc: TYPE = PROC [r: DesignRect, l: Layer, pr: DrawRef];
OutLineProc: TYPE = PROC [r: DesignRect, pr: DrawRef];
DrawCommentProc: TYPE = PROC [r: DesignRect, comment: Rope.ROPE, pr: DrawRef];
SetGroundProc: TYPE = PROC [pr: DrawRef, pushedOut: BOOL];
ContextFilter: TYPE = ARRAY Layer OF RECORD [
doit: BOOL FALSE,
paintMode: Graphics.PaintMode ← transparent,
color: Graphics.Color ← Graphics.black
];
CreateDrawRef: PROC [design: Design, deviceContext: Graphics.Context←NIL] RETURNS [DrawRef];
--for conveniance; assigns usefull null procedures and default values,
--including sufficiently large nesting sequence.
InterestRect: PROC [ob: CD.ObPtr] RETURNS [r: CD.DesignRect] = INLINE {
RETURN [ob.p.interestRect[ob]]
};
END.