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 = BEGIN Number: TYPE = D2Basic.Number; Position: TYPE = D2Basic.Coord; -- RECORD [x, y: Number]; Rect: TYPE = D2Basic.Rect; -- RECORD [x1, y1, x2, y2: Number]; DesignNumber: TYPE = Number; DesignPosition: TYPE = Position; DesignRect: TYPE = Rect; lambda: DesignNumber = 2; 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}; Properties: TYPE = List.AList; 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]; FetchLayer: PROC [t: Technology, uniqueKey: ATOM] RETURNS [Layer]; LayerTechnology: PROC [l: Layer] RETURNS [Technology]; LayerKey: PROC [l: Layer] RETURNS [ATOM]; 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 ANY _ NIL, properties: Properties _ NIL -- see warning ]; CellPtr: TYPE = REF CellRecord; CellRecord: TYPE = RECORD [ contents: ApplicationList _ NIL, simplifyOn: NAT _ LAST[NAT], ir: CD.DesignRect _ [0, 0, -1, -1], dIr: CD.DesignRect _ [0, 0, -1, -1], --default value for interest rect name: Rope.ROPE _ NIL, useDIr: BOOL _ TRUE, --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: BOOL _ FALSE, reserved: BOOL _ FALSE, 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; directoryProcs: REF _ NIL, 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.ROPE _ NIL, 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]; 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]; FetchObjectProcs: PROC [objectType: REF, technology: Technology_NIL] RETURNS [REF --READONLY-- ObjectProcs]; PushRec: TYPE = RECORD [ dummyCell: ApplicationPtr, mightReplace: ApplicationPtr_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; cellDirectory: PRIVATE CellTableRef, -- pushed cells are copied and not part of the cellDirectory name: Rope.ROPE_NIL, technology: Technology_NIL, designValues: DesignValues_NIL, --CDValue queue: MBQueue.Queue, seqPrivate: SequencerRef, properties: Properties_NIL ]; SequencerRef: TYPE = REF SequencerDesignPrivate; SequencerDesignPrivate: TYPE; CellTableRef: PRIVATE TYPE = SymTab.Ref; DesignValues: TYPE = REF DesignValuesRep; --CDValue DesignValuesRep: TYPE; --CDValue Technology: TYPE = REF TechnologyRec; TechnologyRec: TYPE = RECORD [ -- use RegisterTechnology to create record key: ATOM_NIL, name: Rope.ROPE_NIL, technologyPrivate: PRIVATE TechnologyPrivate, technologyValues: TechnologyValues, --CDValue technologyCommands: TechnologyCommands, --CDSequencer usedLayers: LIST OF Layer, -- without constant Layers defined in CD properties: Properties_NIL ]; 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.ROPE_NIL] RETURNS [Technology]; FetchTechnology: PROC [key: ATOM] RETURNS [Technology]; DrawRef: TYPE = REF DrawInformation; DrawInformation: TYPE = RECORD [ interestClip: DesignRect, -- (interrest area; not device area), in doubt is larger; minimalSize: Number, -- if xyzx2) 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 --your program must not depend on the value of lambda --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 access Properties -- layers --may raise Error[noResource] and others --the technolgy implementation must guarantee for uniqueness of uniqueKey's -- (unique only for the technology) --object, cells, applications --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. -- all object classes which have children must be in the directory --ignores aptr.location and aptr.orientation, may use aptr.properties --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 --may raise Error[missingRegistration] --consider ObjectProcs as readonly if you are not the implementor of the object type -- Design originally a copy of mightReplace; warning: size may be wrong --CDValue supports more fields -- Technology --CDValue supports more fields --This must be the only way to create data of type TechnologyRec --may raise Error[doubleRegistration] and others --may raise Error[missingRegistration] and others -- drawing --state of redrawing --DrawInformation records should not be copied unless the state of drawing is --separately initialized (including viewerSave for viewers). --points to applications which are part of cells, and also --points to dummy applications. Consider readonly. --for conveniance; assigns usefull null procedures and default values, --including sufficiently large nesting sequence. Ê Æ˜šœ?™?Jšœ Ïmœ7™BJšœ%™%Jšœ:™:—J˜šÏk ˜ Jšœ žœ$˜2Jšœžœ ˜Jšœžœ ˜Jšœžœ˜$Jšœžœ˜Jšœžœžœ˜Jšœžœ˜J˜—šÏnœžœž œ˜Jšœ™—Jšž˜J˜J˜Jšœ ™ ˜Jšœ#™#—Jšœžœ žœ˜šœ žœ žœ˜Jšœžœ˜—šœžœ˜Jšœžœ˜#JšœQ™QJ™˜YJšœ žœžœžœ˜Jšœžœ¡˜,J˜JšœK™KJšœQ™QJšœI™IJ˜—Jšœ žœžœ ˜šœ žœžœ˜Jšœžœ˜ Jšœ žœžœžœ˜Jšœžœ˜#Jšœžœ¡"˜FJšœ žœžœ˜Jšœžœžœ¡*˜?Jšœžœ˜"J˜J˜—Jšœ žœžœ ˜Jš œ žœžœ žœžœ˜0J˜Jš œžœžœžœžœ˜3Jšœžœžœ ˜'šœ žœžœ˜J˜ Jšœ#¡˜1J˜Jšœ žœžœ˜Jšœ žœžœ˜Jšœžœ˜J˜J˜J˜—šœ žœžœ¡#˜@J˜J˜J˜Jšœ¡E˜`J˜Jšœ¡˜+Jšœ¡&˜?Jšœ žœ˜šœ žœ¡-˜@JšœB™BJšœžœžœ˜—Jšœ ž œ¡4˜MJšœ ž œ¡˜Jšœž œ˜(Jšœ ž œ˜J˜!J˜Jšœžœžœ˜Jšœžœ˜Jšœžœ˜#Jšœžœ˜Jšœ žœ ˜Jšœžœ˜J˜J˜—šœ žœžœFžœ˜pJšœE™E—Jš œžœžœ-žœžœ˜YJšœ žœžœ žœ˜:Jšœ žœžœ žœ˜7Jš œ žœžœ žœžœ˜1Jšœžœžœ ˜+Jšœžœžœžœ ˜1Jš œžœžœ žœžœ˜:Jš œžœžœžœžœ˜FJšœžœžœn˜ŠJšœžœžœ6˜WJ˜šŸœžœžœžœ˜HJšžœžœ˜Jšœ0™0Jšœ2™2JšœV™VJšœC™CJ˜—šŸœžœžœžœ˜EJšžœžœž œ˜(Jšœ(™(JšœU™UJ˜J˜—Jšœ ™ J˜šœ žœžœ˜šœ˜Jšœ=™=—Jšœžœ˜!Jšœ¡$˜7Jšœ žœžœ˜Jšœžœžœ˜Jšœ žœž˜J˜J˜—Jšœžœžœ ˜šœ žœžœ¡/˜JJšœžœžœ ¡,˜Ešœžœ˜%Jš¡<˜<—Jšœ žœžœ˜Jšœžœ˜Jšœžœ¡ ˜)Jšœ˜Jšœ˜Jšœž˜Jšœ™J˜J˜Jšœžœžœ˜0Jšœžœ¡˜Jšœž œ˜(Jšœžœžœ¡ ˜3Jšœžœ¡ ˜ —J˜J˜Jšœ ™ J™Jšœ žœžœ˜%šœžœžœ¡*˜IJšœžœžœ˜Jšœ žœžœ˜Jšœžœ˜-Jšœ$¡ ˜-Jšœ(¡ ˜5Jšœ žœžœ¡(˜CJšœž˜Jš¡™J˜J˜Jšœžœžœ¡ ˜;Jšœžœžœ¡ ˜CJšœžœžœžœ˜˜SJšœ žœ¡9˜JJšœ˜Jšœ¡D˜\J˜Jšœ¡;˜VJ˜J˜Jšœ žœžœ˜Jšœžœ¡>˜SJšœžœ¡%˜JJšœžœžœ˜'Jšœ žœžœ˜Jšœ žœžœ˜Jšœžœžœ¡˜4Jšœ˜Jšœžœ˜Jšœ™Jšœžœ˜)Jšœžœ¡-˜KJ˜Jšœ žœ ¡1˜GJšœ žœ˜J˜Jšœ:¡œ™MJšœ=™=—š œ žœžœžœžœžœžœ˜KJšœ:™:Jšœ3™3—J˜Jšœžœžœ˜+Jšœžœ˜J˜Jšœ žœžœ˜%šœžœ˜J˜—Jšœžœžœ'˜AJšœ žœžœ˜6Jšœžœžœ2˜NJšœžœžœžœ˜:J˜š œžœžœžœžœ˜-Jšœžœžœ˜Jšœ,˜,Jšœ&˜&J˜Jšœ˜—J˜šŸ œžœ2žœžœ ˜\JšœF™FJ™0—J˜š Ÿ œžœžœžœžœžœ˜GJšžœ˜J˜—J˜Jšžœ˜J˜—…—ü6