DIRECTORY BasicTime, CD, Rope, SymTab; CDImports: CEDAR DEFINITIONS = BEGIN IsImport: PROC [ob: CD.Object] RETURNS [BOOL] = INLINE { RETURN [ISTYPE[ob.specific, ImportSpecific] AND ob.class=importsClass] }; importsClass: READONLY CD.ObjectClass; --refered record readonly too ImportSpecific: TYPE = REF ImportRep; ImportRep: TYPE = RECORD [ --consider all fields READONLY boundOb: CD.Object _ NIL, -- NIL if not yet bound boundDesign: CD.Design _ NIL, ir: CD.Rect _ [0, 0, -1, -1], objectName: Rope.ROPE _ NIL, designName: Rope.ROPE _ NIL ]; BoolOrInteractive: TYPE = {true, false, interactive}; FetchImport: PROC [into: CD.Design, objectName, importeeName: Rope.ROPE] RETURNS [ob: CD.Object]; CreateImportFromCache: PROC [into: CD.Design, objectName, importeeName: Rope.ROPE, load: BOOL_FALSE] RETURNS [ob: CD.Object]; CreateImportWithoutSource: PROC [into: CD.Design, objectName, importeeName: Rope.ROPE, ir, bbox: CD.Rect, exact: BoolOrInteractive_false] RETURNS [ob: CD.Object]; CreateImportWithSource: PROC [into: CD.Design, objectName: Rope.ROPE, source: CD.Design, exact: BOOL_FALSE] RETURNS [ob: CD.Object]; HasUnloadedImports: PROC [design: CD.Design_NIL, object: CD.Object_NIL, recurse: BOOL_TRUE] RETURNS [yes: BOOL_FALSE, where: LIST OF CD.Object_NIL]; MergeInImports: PROC [into: CD.Design, importeeName: Rope.ROPE]; LocalCopy: PROC [into: CD.Design, import: CD.Object] RETURNS [CD.Object]; LoadAndBindAll: PROC [into: CD.Design, allowConflicts: BoolOrInteractive_true, forceBind: BOOL_FALSE] RETURNS [done: BOOL]; LoadAndBindDesign: PROC [into: CD.Design, importeeName: Rope.ROPE, allowConflicts: BoolOrInteractive_true, forceBind: BOOL_FALSE, useCache: BOOL_FALSE, fileName: Rope.ROPE_NIL, forceFile: BOOL_FALSE] RETURNS [done: BOOL]; ReBindObject: PROC [design: CD.Design, ob: CD.Object, importee: CD.Design, allowSizeConflicts: BoolOrInteractive _ true] RETURNS [ok: BOOL]; OccursInDrawing: PROC [x: CD.Object, in: CD.Object] RETURNS [BOOL]; CacheList: TYPE = PRIVATE REF CacheListRec; CacheListRec: TYPE = RECORD [list: LIST OF Cache]; -- READONLY to clients Cache: TYPE = PRIVATE REF CacheRec; CacheRec: TYPE = RECORD[ -- READONLY to clients importeeName: Rope.ROPE _ NIL, importee: CD.Design _ NIL, objects: SymTab.Ref _ NIL, --objects do not need to be included in importee ! data: REF _ NIL ]; GetCacheList: PRIVATE PROC [design: CD.Design] RETURNS [CacheList]; GetCache: PRIVATE PROC [into: CD.Design, importeeName: Rope.ROPE, createIfNotFound: BoolOrInteractive_false] RETURNS [Cache]; DoCacheDesign: PRIVATE PROC [into: CD.Design, importee: CD.Design]; FindCachedDesign: PRIVATE PROC [designName: Rope.ROPE, fileName: Rope.ROPE_NIL, createdTime: BasicTime.GMT _ BasicTime.nullGMT, checkUnloadedImps: BOOL_FALSE] RETURNS [found: CD.Design_NIL]; END. CDImports.mesa (part of ChipNDale) Copyright c 1984, 1987 by Xerox Corporation. All rights reserved. Created by Christian Jacobi, March 20, 1984 5:50:51 pm PST Last edited by: Christian Jacobi, March 4, 1987 4:36:50 pm PST Objects which reference Objects in other designs are called imports. Imports are mutable! It is possible to re-bind Imports to a different source object. Warning: don't make circular imports. --creation and caching of imports -- Designs have a cache for imported designs and imported objects -- Caching is done by checking the cache without enumerating instances --Returns an import object if object found in cache or NIL if none found. --Creates an import object; NIL if not done. --load: load and cache design first if not already cached. --If object not cached, requires design importeeName to be loaded (to know size of ob) --Might return a cached object. Returned object is included in cache. --Creates an import object; NIL if not done. --Design importeeName need not be loaded nor will it be loaded. --exact: in case a cached object is found but data is wrong a new object is created. --Might return a cached object. Returned object is included in cache. --Creates an import object; NIL if not done. --exact: in case a cached object is found but source is wrong a new object is created --Design might or might not be included in cache. Returned object is included in cache. --operation with imports -- Checks both, whether design or object has unloaded imports. -- recurse: check whether imports depend on unloaded imports recursively -- yes: whether some unloaded import is found -- where: nesting where some unloaded import is found; #NIL if ~yes --Includes all the imported and loaded objects from design importeeName (including --their transitive closure; but not indirect imports) into the design "into". --Makes a local copy of an import object; Children are copied over or replaced by imports. --import is an import object from any source imported into into --[Repeated LocalCopy might produce less good caching than calling MergeInImports] --Binds and caches all imported objects in into. --allowConflicts: If conflicts are disabled, objects with size conflict will not be bound. --forceBind: If objects are already bound, but to different source: Re-bind it. --Takes designs from cache, unless not found then read file. --Procedure talks to TerminalIO. --Binds and caches all imported objects from design importeeName in into. --allowConflicts: If conflicts are disabled, objects with size conflict will not be bound. --forceBind: If objects are already bound, but to different source: Re-bind it. --useCache: Take design from cache instead of reading in file. --fileName: Optional; used in case a file is accessed. --forceFile: Loads new file into design cache, even if already cached. --Procedure talks to TerminalIO. --Redo binding of an import object --design: design where import object ob is included --importee: design from where remote object shall be used --Cache is not involved. --Recursivity test --Check whether drawing of "in" would draw "x" The following cacheing procedures and types are hints only. Found cached objects must be validated before use; not a client function. --describes all the caching for imports of a design -- Returns the caches considered for imports into design. -- Consider the list and its entries READONLY. -- Returns a cache for a particular import. -- Consider the returned record READONLY -- NIL if not found and not created. -- Caches a design. -- importee must be readonly. -- Tries hard to find a cached design and returns it, or NIL if not found. -- Expect the cached design to be readonly. -- fileName: checks that cached design really comes from this file. -- checkUnloadedImps: returns cached design only if it has no indirect unloaded imports. Κ˜codešœ$™$Kšœ Οmœ7™BKšœ7Οkœ™;Kšœ>™>K˜—šž ˜ Kšœ žœ˜—K˜KšΟn œžœž œ˜Kšž˜K˜™DK™K™TK™%K™—K˜š Ÿœžœžœ žœžœžœ˜8Kšžœžœžœ˜FK˜—K˜KšœžœžœΟc˜DK˜Kšœžœžœ ˜%šœ žœžœ ˜9Kšœ žœ žœ ˜2Kšœ žœ žœ˜Kšœžœ˜Kšœžœžœ˜Kšœžœž˜Kšœ˜K˜—Kšœžœ˜5K™K™Kš !™!Kš A™AK™GK˜š Ÿ œžœžœ(žœžœžœ ˜aKšœΟbœ%™I—K˜šŸœžœžœ(žœžœžœžœžœ ˜}Kš ,™,Kš :™:Kš !Πbc /™VK™F—K˜šŸœžœžœ(žœ žœ'žœžœ ˜’Kš ,™,Kš ?™?Kš U™UKš F™F—K˜šŸœžœžœžœ žœžœžœžœžœ ˜„Kš ,™,Kš V™VKš X™X—K˜K˜K˜K˜Kš ™K˜šŸœžœ žœžœ žœžœ žœžœžœžœžœ žœžœžœžœ˜”Kš >™>Kš H™HKš -™-KšœC™C—K˜šŸœžœžœžœ˜@Kš T™TKš M™M—K˜š Ÿ œžœžœžœ žœžœ ˜IKš Z™ZKš ?™?Kš R™R—K˜šŸœžœžœ<žœžœžœžœ˜{Kš 2™2Kš \™\Kš O™OKš <™™>Kš 6™6Kš œ  ;™FKš  ™ —K˜šŸ œžœ žœ žœžœ7žœžœ˜ŒKš "™"Kš 3™3Kš 9™9Kš ™—K˜š Ÿœžœžœ žœ žœžœ˜DKš ™Kš .™.K˜—K™™;K™J—K˜Kšœ žœžœžœ˜-š œžœžœžœžœ  ˜KKš 3™3K˜—Kšœžœžœžœ ˜#šœ žœžœ ˜/Kšœžœžœ˜ Kšœ žœ žœ˜Kšœžœ 2˜MKšœžœž˜Kšœ˜—K˜š Ÿ œžœžœ žœ žœ ˜CKš 9™9Kš .™.K˜—š Ÿœžœžœžœžœ-žœ ˜}Kš +™+Kš (™(Kš $™$—K˜š Ÿ œžœžœžœžœ ˜CKš ™Kš œ ™—K˜šŸœžœžœžœžœžœžœ)žœžœžœ žœžœ˜ΎKš J™JKš +™+Kš C™CKšœX™X—K˜Kšžœ˜K˜—…—