DIRECTORY Graphics USING [Context, Color, PaintMode, black], List USING [AList], MBQueue USING [Queue], RefTab USING [Ref], Rope USING [ROPE], SymTab USING [Ref]; CD: CEDAR DEFINITIONS = BEGIN Number: TYPE = INT; Position: TYPE = RECORD [x, y: Number]; Rect: TYPE = RECORD [x1, y1, x2, y2: Number]; DesignNumber: TYPE = Number; DesignPosition: TYPE = Position; DesignRect: TYPE = Rect; lambda: DesignNumber = 2; Orientation: TYPE = [0..15] _ 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; levelNumber: NAT = 256; Level: TYPE = [0..levelNumber); combined: Level = 0; -- level used for object containing different or unknown levels highLightShade: Level = 1; -- visualization; not for generating masks highLightError: Level = 2; -- visualization; not for generating masks NewLevel: PROC [technology: Technology, uniqueKey: ATOM] RETURNS [Level]; FetchLevel: PROC [t: Technology, uniqueKey: ATOM] RETURNS [Level]; LevelTechnology: PROC [l: Level] RETURNS [Technology]; LevelKey: PROC [l: Level] 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], level: Level _ combined, marked: [0..markNum) _ 0, specificRef: REF ANY _ NIL, properties: Properties _ NIL -- see warning ]; CellPtr: TYPE = REF CellRecord; CellRecord: TYPE = RECORD [ contents: ApplicationList _ NIL, name: Rope.ROPE _ NIL, key: Rope.ROPE _ NIL, simplifyOn: NAT _ LAST[NAT] ]; 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, orientation: Orientation, selected: BOOLEAN, 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 insideRect: RectProc, further: PRIVATE RefTab.Ref, technology: PRIVATE Technology, -- dont rely on it, it is often NIL objectType: ATOM, hasChildren: BOOL, -- if hasChildren then included in directory directoryProcs: REF _ NIL, wireTyped: BOOL, -- if wiretyped then insideRect.y corresponds length internalWrite: InternalWriteProc, internalRead: InternalReadProc, match: MatchProc_NIL, describe: DescribeProc_NIL ]; DrawProc: TYPE = PROC [aptr: ApplicationPtr, pos: DesignPosition, orient: Orientation, pr: REF DrawInformation]; HitInsideProc: TYPE = PROC [aptr: ApplicationPtr, hitRect: DesignRect] RETURNS [BOOL]; RectProc: TYPE = PROC [ob: ObPtr] RETURNS [DesignRect]; InternalWriteProc: TYPE = PROC [me: ObPtr]; InternalReadProc: TYPE = PROC [] RETURNS [ObPtr]; DescribeProc: TYPE = PROC [me: ObPtr] RETURNS [Rope.ROPE]; MatchProc: TYPE = PROC [me: ObPtr, r: DesignRect, level: Level, prim: BOOL, horz: BOOL] RETURNS [BOOL]; 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 usedLevels: LIST OF Level, -- without constant levels 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 [ worldClip: DesignRect, -- in doubt is larger than device minimalSize: Number, -- if xyzx2) OR (y1>y2) means that the Rect is empty. --all 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. -- 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 -- levels --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. --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 --[Implementors of technologies: look further rules in CDTechnology] --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). --calls proc which may use context; mode and color are set to level's need --call is suppressed if level does not need drawing; this is default. --on recursive calls, the context may or may not include previous transformations --for conveniance; usefull null procedures and default values --DrawRef's may also be created differently, if state of redrawing --gets proper initialization Ê 8˜Jšœ)™)Jšœ%™%Jšœ9™9J˜šÏk ˜ Jšœ œ$˜2Jšœœ ˜Jšœœ ˜Jšœœ˜Jšœœœ˜Jšœœ˜J˜—šÏnœœ œ˜Jšœ™—Jš˜J˜J˜Jšœ ™ ˜Jšœ"™"—Jšœœœ˜Jšœ œœ˜'šœœœ˜-JšœQ™QJ™?JšœW™WJ˜Jšœ™—Jšœœ ˜Jšœœ ˜ Jšœ œ˜J˜šœ˜Jšœ5™5J™—J˜šœ œ˜!JšœC™CJšœB™BJšœ™—J˜J˜Jšœ ™ J˜JšÏbœœ6œœ˜NJšœ œ`˜oJ˜Jšœ ™ J˜šœ œ˜!JšœI™IJšœ ™ Jšœ,™,J˜—J˜Jšœ ™ J˜Jšœ œ˜šœœ˜JšœÏc?˜UJšœ œ ˜FJšœ œ ˜F—J˜šžœœ%œœ ˜IJšœ(™(JšœK™KJšœ#™#J˜—Jšž œœœœ ˜BJšžœœ œ˜6Jšžœœ œœ˜)J˜J˜Jšœ™J˜Jšœ œ˜Jšœœœ˜#šœœœ˜!Jšœœœ ˜5J˜)J˜Jšœ˜Jšœ œœœ˜Jšœœ ˜,J˜JšœK™KJšœQ™QJšœI™IJ˜—Jšœ œœ ˜šœ œœ˜Jšœœ˜ Jšœ œ˜Jšœ œœ˜Jšœ œœœ˜J˜J˜—Jšœ œœ ˜Jš œ œœ œœ˜0J˜Jš œœœœœ˜3Jšœœœ ˜'šœ œœ˜J˜ J˜J˜Jšœ œ˜Jšœœ˜J˜J˜—šœ œœ #˜@J˜J˜J˜Jšœ E˜`J˜Jšœ œ ˜Jšœ œ #˜DJšœ œ˜šœ œ ,˜?Jšœœœ˜—Jšœ œ 4˜EJ˜!J˜Jšœœ˜Jšœ˜J˜J˜—šœ œœFœ˜pJšœE™E—Jš œœœ-œœ˜YJšœ œœ œ˜7Jšœœœ ˜+Jšœœœœ ˜1Jš œœœ œœ˜:Jšœ œœ#œ œœœœ˜gJ˜šžœœœœ˜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šœœ >˜SJšœœ %˜HJšœœœ˜%Jšœ#œœ ˜PJšœ™Jšœœ˜)Jšœœ -˜IJ˜Jšœ 1˜KJšœ œ˜J˜Jšœ: œ™MJšœ=™=—Jšœœœ˜+Jšœœ˜J˜Jšœ œœ˜%šœœ˜J˜—Jšœœœ'˜AJšœ œœ˜6Jšœœœ2˜NJ˜š œœœœœ˜-Jšœœœ˜Jšœ'˜'Jšœ&˜&J˜Jšœ˜—Jšœ œœ˜5šž œœ/˜BJšœJ™JJšœE™EJšœR™R—J˜šžœœ2œœ ˜cJšœ=™=JšœB™BJ™J˜—Jšœ˜J˜—…—/´