CDImports.mesa (part of ChipNDale)
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, March 20, 1984 5:50:51 pm PST
Last edited by: Christian Jacobi, October 16, 1986 12:42:57 pm PDT
DIRECTORY
CD, Rope;
CDImports: CEDAR DEFINITIONS =
BEGIN
Objects which reference Objects in other designs are called imports.
No circular imports.
IsImport: PROC [ob: CD.Object] RETURNS [BOOL] = INLINE {
RETURN [ISTYPE[ob.specific, ImportSpecific]]
};
importsClass: PRIVATE READONLY CD.ObjectClass;
ImportSpecific: TYPE = REF ImportRep;
ImportRep: TYPE = RECORD [ --consider READONLY
boundInstance: CD.Instance ← NIL, -- NIL if not yet bound; clients should only use ob
ir: CD.Rect ← [0, 0, -1, -1],
objectName: Rope.ROPENIL,
designName: Rope.ROPENIL
];
ImportList: TYPE = REF ImportListRec;
ImportListRec: TYPE = RECORD [list: LIST OF ImportEntry];
--describes all the imports of a design
ImportEntry: TYPE = REF ImportEntryRec;
ImportEntryRec: TYPE = RECORD[ -- READONLY to clients
importeeName: Rope.ROPENIL,
loaded: BOOLFALSE, --a readonly version of the design is loaded
d: PRIVATE CD.Design ← NIL,
implData: PRIVATE REF
];
-- describes imports of one particular importee-design
BoolOrInteractive: TYPE = {true, false, interactive};
CreateImport: PROC [into: CD.Design, objectName, importeeName: Rope.ROPE] RETURNS [ob: CD.Object];
--Creates an import object; NIL if not done.
--Design importeeName must be loaded. (to know size of object!)
--Multiple creation may return the same object.
TrustedCreateImport: PROC [into: CD.Design, objectName, importeeName: Rope.ROPE, ir, bbox: CD.Rect] RETURNS [ob: CD.Object];
--Creates an import object; NIL if not done
--Design importeeName need not be loaded nor will it be loaded.
--Created object might fail to have required interest or bbox rect.
--Multiple creation may return the same object.
Load: PROC [into: CD.Design, importeeName: Rope.ROPE, overload, allowConflicts: BoolOrInteractive←true] RETURNS [done: BOOL];
--Load or Reloads an imported design importeeName.
--Creates an import entry into the import list if necessary.
--(importeeName is fetched using CDRemote's FetchDesign)
--Procedure talks to TerminalIO.
--overload: allows reloading if importeeName is already loaded.
--allowConflicts; If conflicts are disabled, objects with (size) conflict will not be loaded.
-- indirect imports
MergeInImports: PROC [into: CD.Design, importeeName: Rope.ROPE];
--Includes all the imported and loaded objects from design importeeName (including
--their transitive closure; but not indirect imports) into the design "into".
GetImportList: PROC [design: CD.Design] RETURNS [ImportList];
-- Returns the import list of the design.
-- Consider the list and its entries READONLY.
GetImportEntry: PROC [into: CD.Design, importeeName: Rope.ROPE, createIfNotFound: BoolOrInteractive�lse] RETURNS [ImportEntry];
-- Returns an entry of the import list.
-- Consider the returned record READONLY
-- NIL if not found and not created
HasUnloadedImports: PROC [design: CD.Design] RETURNS [BOOL];
-- Returns "design has imports or imported objects wich are not yet loaded".
END.