DIRECTORY D2Basic USING [Number, Pos, Rect], Imager USING [Color, Context], PropertyLists USING [PropList], Rope USING [ROPE]; CD: CEDAR DEFINITIONS = BEGIN Number: TYPE = D2Basic.Number; Position: TYPE = D2Basic.Pos; Rect: TYPE = D2Basic.Rect; Orientation: TYPE = [0..7] _ 0; original: Orientation = 0; Error: ERROR [ec: ErrorCode _ programmingError, explanation: Rope.ROPE _ NIL]; ErrorCode: TYPE = {programmingError, callingError, noResource, doubleRegistration, missingRegistration, other}; PropList: TYPE = PropertyLists.PropList; PropRef: TYPE = REF PropList _ ; --ABSOLUTELY NEVER NIL InitPropRef: PROC [] RETURNS [PropRef] = INLINE { RETURN [NEW[PropList_NIL]] }; layerNum: NAT = 256; Layer: TYPE = [0..layerNum); undefLayer: Layer = 0; -- layer used for object containing different or unknown Layers shadeLayer: Layer = 1; -- visualization; not for generating masks errorLayer: Layer = 2; -- real layer reserved for error messages; rarely for generating masks backgroundLayer: Layer = 3; -- special pushed-in backGround; not for generating masks outlineLayer: Layer = 4; -- special color for outline; not for generating masks selectionLayer: Layer = 5; -- special color for selection; not for generating masks commentLayer: Layer = 6; -- real layer; may or may not be used by technologies NewLayer: PROC [technology: Technology, uniqueKey: ATOM] RETURNS [Layer]; FetchLayer: PROC [t: Technology, uniqueKey: ATOM] RETURNS [Layer]; LayerTechnology: PROC [l: Layer] RETURNS [Technology]; LayerKey: PROC [l: Layer] RETURNS [ATOM]; markNum: NAT = 256; Object: TYPE = REF ObjectRep; ObjectRep: TYPE = RECORD [ class: ObjectClass, -- never modify class nor class^ size: Position _ [2, 2], -- maximal size drawn, not influence... layer: Layer _ undefLayer, marked: [0..markNum) _ 0, --only usefull for objects in the design's directory specificRef: REF ANY _ NIL, properties: PropList _ NIL -- see warning ]; CellPtr: TYPE = REF CellRep; CellRep: TYPE = RECORD [ contents: InstanceList _ NIL, ir: Rect _ [0, 0, -1, -1], --actual interest rect origin: Position _ [0, 0], --(for cells:) position where client may think the origin is name: Rope.ROPE _ NIL, --once included directory, use only CDDirectory to change name simplifyOn: REAL _ LAST[NAT], --a treshold for simplification on quickdraw dIr: Rect _ [0, 0, -1, -1], --default value for interest rect drawBorder: BOOL _ FALSE, --border should be drawn useDIr: BOOL _ TRUE --whether the default is used for interest rect ]; RectPtr: TYPE = REF RectRep; RectRep: TYPE = RECORD [filler: PRIVATE REF]; InstanceList: TYPE = LIST OF Instance_NIL; Instance: TYPE = REF InstanceRep; InstanceRep: TYPE = RECORD [ ob: Object, location: Position _ [0, 0], --in cd-coords orientation: Orientation _ 0, selected: BOOL _ FALSE, reserved: BOOL _ FALSE, properties: PropList _ NIL ]; ObjectClass: TYPE = REF ObjectClassRec; ObjectClassRec: TYPE = RECORD [ -- generic procedures for an object quickDrawMe: DrawProc _ NIL, drawMe: DrawProc _ NIL, showMeSelected: DrawProc _ NIL, hitInside: HitInsideProc _ NIL, interestRect: RectProc _ NIL, technology: Technology _ NIL, -- NIL on technology independent stuff objectType: ATOM _ NIL, inDirectory: BOOL _ FALSE, directoryProcs: REF _ NIL, wireTyped: BOOL _ FALSE, -- if wireTyped then insideRect.y corresponds to the length symbolic: BOOL _ FALSE, reserved: BOOL _ FALSE, --reserved for test of future features internalWrite: InternalWriteProc _ NIL, internalRead: InternalReadProc _ NIL, description: Rope.ROPE _ NIL, describe: DescribeProc _ NIL, describeInst: DescribeInstProc _ NIL, origin: PosProc _ NIL, parent: ObjectClass _ NIL, properties: PropRef _ NIL ]; DrawProc: TYPE = PROC [inst: Instance, pos: Position, orient: Orientation, pr: REF DrawInformation]; HitInsideProc: TYPE = PROC [ob: Object, hitRect: Rect] RETURNS [BOOL]; PosProc: TYPE = PROC [ob: Object] RETURNS [Position]; RectProc: TYPE = PROC [ob: Object] RETURNS [Rect]; BoolProc: TYPE = PROC [ob: Object] RETURNS [BOOL]; InternalWriteProc: TYPE = PROC [me: Object]; InternalReadProc: TYPE = PROC [] RETURNS [Object]; DescribeProc: TYPE = PROC [me: Object] RETURNS [Rope.ROPE]; DescribeInstProc: TYPE = PROC [ap: Instance] RETURNS [Rope.ROPE]; DrawContextProc: TYPE = PROC [pr: DrawRef, proc: DrawContextLayerProc, ob: Object, pos: Position, orient: Orientation, layer: Layer]; DrawContextLayerProc: TYPE = PROC [context: Imager.Context, ob: Object, layer: Layer]; RegisterObjectClass: PROC [objectType: ATOM, class: ObjectClassRec] RETURNS [ObjectClass]; FetchObjectClass: PROC [objectType: REF, technology: Technology_NIL] RETURNS [--readonly-- ObjectClass]; PushRec: TYPE = RECORD [ dummyCell: Instance, mightReplace: Instance_NIL, specific: CellPtr, -- cache of dummyCell.ob.specificRef changed: BOOL_FALSE, indirectlyChanged: BOOL_FALSE, deletedList: REF_NIL ]; 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; name: Rope.ROPE _ NIL, technology: Technology _ NIL, properties: PropRef _ , cdDirectoryPriv: PRIVATE REF, --field owned by CDDirectoryImpl cdValuePriv: PRIVATE PrivateValueDRef _ NIL, cdSequencerPriv: PRIVATE PrivateSequencerDRef, cdDrawQueuePriv: PRIVATE REF _ NIL, cdOpsPriv: PRIVATE REF _ NIL, reserved: PRIVATE REF _ NIL ]; PrivateSequencerDRef: TYPE = REF PrivateSequencerDRep; PrivateSequencerDRep: TYPE; PrivateValueDRef: TYPE = REF PrivateValueDRep; PrivateValueDRep: TYPE; Technology: TYPE = REF TechnologyRep; TechnologyRep: TYPE = RECORD [ -- use RegisterTechnology to create record key: ATOM _ NIL, name: Rope.ROPE _ NIL, lambda: CD.Number _ 2, usedLayers: LIST OF Layer, --only technology dependant Layers properties: PropRef _ , cdPriv: PRIVATE PrivateTRef, cdValuePriv: PRIVATE PrivateValueTRef, cdSequencerPriv: PRIVATE PrivateSequencerTRef ]; PrivateSequencerTRef: TYPE = REF PrivateSequencerTRep; PrivateSequencerTRep: TYPE; PrivateValueTRef: TYPE = REF PrivateValueTRep; PrivateValueTRep: TYPE; PrivateTRef: TYPE = PRIVATE REF PrivateTRep; PrivateTRep: TYPE; RegisterTechnology: PROC [key: ATOM, name: Rope.ROPE _ NIL, lambda: CD.Number _ 2] RETURNS [Technology]; FetchTechnology: PROC [key: ATOM] RETURNS [Technology]; EnumerateTechnologies: PROC [proc: TechnologyEnumerator] RETURNS [quit: BOOL]; TechnologyEnumerator: TYPE = PROC[tech: CD.Technology] RETURNS [quit: BOOL_FALSE]; DrawRef: TYPE = REF DrawInformation; DrawInformation: TYPE = RECORD [ interestClip: Rect _ [Number.FIRST, Number.FIRST, Number.LAST, Number.LAST], -- (interrest area; not device area), in doubt is larger; drawChild: DrawProc _ NIL, drawRect: DrawRectProc _ NIL, -- design coordinates stopFlag: REF BOOL _ NIL, drawOutLine: DrawRectProc _ NIL, -- visualization only; not for generating masks drawContext: DrawContextProc _ NIL, drawComment: DrawCommentProc _ NIL, -- visualization only; not for generating masks setGround: SetGroundProc _ NIL, priorityChecker: CheckPriorityProc _ NIL, --usually no-op scaleHint: REAL _ 0, -- to monitor simplifications; 0 means no simplifications environment: BOOL _ TRUE,--draw the outside of pushed in cells symbolics: BOOL _ TRUE, --draw symbolic objects specialFonts: BOOL _ FALSE, --usually FALSE; device may replace fonts checkPriority: BOOL _ FALSE, --usually FALSE; priority of running process borders: BOOL _ FALSE, -- visualization only; not for generating masks b4: BOOL _ TRUE, -- reserved for experiments b5: BOOL _ TRUE, -- reserved for experiments devicePrivate: REF _ NIL, -- differentiate among multiple (viewers) with same drawProc's viewerPrivate: ViewerPrivate _ NIL, -- speed up for viewers devicePrivate deviceContext: Imager.Context _ NIL, --may or may not be used contextFilter: REF ContextFilter _ NIL, --(default uses filter only if deviceContext=NIL) contextColors: REF ContextColors _ NIL, --(default uses colors only if deviceContext#NIL) design: Design _ NIL, properties: PropRef _ NIL ]; ViewerPrivate: TYPE = REF ViewerPrivateRep; ViewerPrivateRep: TYPE; DrawRectProc: TYPE = PROC [r: Rect, l: Layer, pr: DrawRef]; DrawCommentProc: TYPE = PROC [r: Rect, comment: Rope.ROPE, pr: DrawRef]; SetGroundProc: TYPE = PROC [pr: DrawRef, pushedOut: BOOL]; CheckPriorityProc: TYPE = PROC [pr: DrawRef]; ContextFilter: TYPE = PACKED ARRAY Layer OF BOOL _ ALL[FALSE]; ContextColors: TYPE = ARRAY Layer OF Imager.Color _ ALL[NIL]; CreateDrawRef: PROC [inf: DrawInformation] RETURNS [DrawRef]; InterestRect: PROC [ob: Object] RETURNS [r: Rect] = INLINE { RETURN [ob.class.interestRect[ob]] }; InterestSize: PROC [ob: Object] RETURNS [sz: Position] = INLINE { r: CD.Rect = ob.class.interestRect[ob]; RETURN [[r.x2-r.x1, r.y2-r.y1]]; }; ClientOrigin: PROC [ob: Object] RETURNS [pos: Position] = INLINE { RETURN [ob.class.origin[ob]] }; END. ΜCD.mesa; Main definitions for ChipNDale, a VLSI design editor Copyright c 1983, 1986 by Xerox Corporation. All rights reserved. by Ch. Jacobi, June 24, 1983 3:54 pm last edited Christian Jacobi, March 25, 1986 1:09:12 pm PST -- CD: ChipNDale, a VLSI design editor and data base -- measures -- independent of coordinate system -- RECORD [x, y: Number]; -- 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. -- Module CDOrient exports all you probably need about Orientations; -- If your program depends on the representation of Orientation, it -- is probably wrong. -- Errors -- properties --Friendly use expected: don't assign properties without first register --their names with CDProperties. --Use only CDProperties to modify ChipNDale PropList; NOT PropertyLists -- Layers -- may raise Error[noResource] and others -- the technolgy implementation must guarantee for uniqueness of uniqueKey's -- (unique only for the technology) --object, cells, instances --Objects are the main things in ChipNDale --Objects must draw the same way independant of their environment -- Several instances may point to same object: consider on modifications. -- Some implementors of object-classes share the bits of different ObjectRep's -- (therefore usage of properties of Objects not in the directory is restricted to -- the object class implentor.) if inDirectory then objects of this class must be included in designs directory; if ~inDirectory then objects of this class must be immutable; -- object classes of objects which have children must have inDirectory=TRUE --proc ignores inst.location and inst.orientation, may use inst.properties --object class which uses a DrawContextProc must guarantee -- ob#NIL -- ob.size < [NAT.LAST, NAT.LAST] --objectType field must be initialized --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 --NIL if not found --consider ObjectClass as readonly if you are not the implementor of the object type -- Design originally a copy of mightReplace; but size may be wrong -- CDValue or CDProperties for more fields -- pushed cells are copied; the copy is not included in the directory --CDValue supports more fields -- Technology -- all fields except properties read only -- CDValue or CDProperties for more fields --This must be the only way to create data of type TechnologyRep --may raise Error[doubleRegistration] and others --NIL if not found -- drawing -- use CreateDrawRef for creation unless all fields are set. --A TRUE entry means the layer is visible --A NIL color entry means the layer is invisible -- and assigns usefull default procedures and values. --vanilla procedures -- Returns the interest rect in objects internal cd coords -- Returns the size of the interest rect -- Returns the position of the client's object origin in objects internal cd coords Κ `˜codešœ?™?Kšœ Οmœ7™BKšœ%™%Kšœ<™<—K˜šΟk ˜ Kšœžœ˜"Kšœžœ˜Kšœžœ ˜Kšœžœžœ˜—K˜šΠlnœžœž œ˜Kšœ4™4—Kšž˜K˜Kšœ ™ ˜Kšœ#™#—Kšœžœ žœ˜šœ žœ žœ˜Kšœžœ™—šœžœ˜Kšœžœ™#KšœQ™QK™Kšœ#žœ˜'Kšœ!žœ˜%Kšœžœžœ˜Kšœžœ˜Kšœ!žœ˜%Kšœžœ˜Kšœžœ˜Kšœžœ˜K˜K˜—šœ žœžœ:žœ˜dKšœJ™J—Kš œžœžœžœžœ˜IKšœ žœžœžœ ˜5Kšœ žœžœžœ˜2Kš œ žœžœžœžœ˜2Kšœžœžœ˜,Kšœžœžœžœ ˜2Kš œžœžœžœžœ˜;Kš œžœžœžœžœ˜Ašœžœžœi˜…Kšœ;™;Kšœ ™ Kšœ#™#—Kšœžœžœ5˜VK˜š’œžœžœžœ˜[Kšœ&™&Kšœ0™0Kšœ2™2KšœV™VKšœC™CK˜—š ’œžœžœžœžœ‘ œ˜iKšœ™KšœU™UK˜—K˜Kšœ ™ K˜šœ žœžœ˜šœ˜Kšœ8™8—Kšœžœ˜Kšœ‘$˜7Kšœ žœžœ˜Kšœžœžœ˜Kšœ žœž˜K˜K˜—Kšœžœžœ ˜šœ žœžœ˜Kš‘/˜/Kšœ+™+šœžœžœ ˜Kš‘,˜,KšœE™E—Kšœ žœžœ˜Kšœžœ˜Kšœ˜Kšœžœžœ‘ ˜>Kšœ žœžœ˜-Kšœžœ˜.Kšœžœžœž˜#Kšœ žœžœž˜Kšœ žœžœž˜Kšœ™K˜K˜Kšœžœžœ˜6Kšœžœ‘˜Kšœžœžœ˜/Kšœžœ‘˜K˜—K˜Kšœ ™ K™Kšœ žœžœ˜%šœžœžœ˜Kš‘*˜*Kšœ)™)Kšœ+™+Kšœžœžœ˜Kšœ žœžœ˜Kšœžœ ˜Kšœ žœžœ‘"˜=Kšœž˜Kšœžœ ˜Kšœ žœ˜'Kšœžœ˜.K˜K˜Kšœžœžœ˜7Kšœžœ˜Kšœžœžœ‘˜/Kšœžœ˜Kšœ žœžœžœ˜-Kšœ žœ˜K˜—š’œžœžœ žœžœ žœ žœ˜hKšœ@™@Kšœ0™0K˜—š’œžœžœžœ˜7Kšœ™—K˜š’œžœžœžœ˜NKš œžœžœžœ žœžœžœ˜RK˜—K™Kšœ ™ K˜Kšœ žœžœ˜$šœžœžœ˜ š œžœ žœ žœ žœ˜MKšœ‘7˜9—Kšœžœ˜Kšœžœ‘˜3Kšœ žœž œ˜Kšœžœ‘/˜PKšœžœ˜#Kšœžœ‘/˜SKšœžœ˜Kšœ%žœ‘˜9Kšœ žœ‘9˜NKšœ žœžœ‘%˜>Kšœ žœžœ‘˜/Kšœžœžœ‘)˜EKšœžœžœ‘,˜IKšœ žœžœ‘/˜FKšœžœžœ‘œ˜-Kšœžœžœ‘˜,Kšœž œ‘>˜XKšœžœ‘%˜IKšœ žœ‘˜=Kšœžœžœ‘2˜YKšœžœžœ‘1˜ZKšœžœ˜Kšœž˜K˜Kšœ=™=Kšœžœžœ˜+Kšœžœ˜K˜—Kšœžœžœ!˜;Kšœžœžœžœ˜HKšœžœžœžœ˜:šœžœžœ˜-K˜—šœžœžœžœžœžœžœžœ˜>Kšœžœ!™)—š œžœžœžœžœžœ˜=Kšœ0™0K˜K˜K˜—š’ œžœžœ ˜=Kšœ5™5K˜—K˜K™K˜š’ œžœžœ žœ˜