<> <> <> <> DIRECTORY CD, Rope; CDImports: CEDAR DEFINITIONS = BEGIN <<-- no design is allowed to make circular imports>> IsImport: PROC [ob: CD.ObPtr] RETURNS [BOOL] = INLINE { RETURN [ISTYPE[ob.specificRef, ReferencePtr]] }; ReferencePtr: TYPE = REF ReferenceRep; ReferenceRep: TYPE = RECORD [ boundApp: CD.ApplicationPtr _ NIL, -- NIL if not yet bound ir: CD.DesignRect _ [0, 0, -1, -1], objectName: Rope.ROPE _ NIL, designName: Rope.ROPE _ NIL ]; ImportList: TYPE = RECORD [list: LIST OF REF Import]; -- describes all the imports of a design Import: TYPE = RECORD[ -- describes imports of one particular importee-design importee: CD.Design _ NIL, -- NIL means not yet bound importeeName: Rope.ROPE _ NIL, referenceList: LIST OF CD.ObPtr _ NIL -- all references must be accessible, <<-- to allow later binding.>> ]; BoolOrInteractive: TYPE = {true, false, interactive}; GetReference: PROC [design: CD.Design, objectName, importeeName: Rope.ROPE] RETURNS [ob: CD.ObPtr]; <<--importeeName must already be imported and object objectName must exist>> <<--Returns nil if not done.>> <<--Multiple creation may return same object.>> GetImportList: PROC [design: CD.Design] RETURNS [REF ImportList]; <<-- consider the list READONLY>> GetImport: PROC [design: CD.Design, importeeName: Rope.ROPE, createIfNotFound: BoolOrInteractive_false] RETURNS [REF Import]; <<-- consider the returned record READONLY>> DoImport: PROC [design: CD.Design, importee: CD.Design, allowOverload, allowConflicts: BoolOrInteractive_true] RETURNS [done: BOOL]; <<--You give up control of importee, which should not have any viewer.>> <<--Caller knows importee.name, which is the import which will be bound.>> <<--Procedure talks to TerminalIO.>> MergeInImport: PROC [design: CD.Design, importeeName: Rope.ROPE]; <<--Includes all the imported and bound objects from importeeName (including >> <<--their transitive closure; but not indirect imports) into design.>> <<>> HasUnloadedImports: PROC [d: CD.Design] RETURNS [BOOL]; END.