CDImports.mesa (part of ChipNDale)
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, March 20, 1984 5:50:51 pm PST
last edited Christian Jacobi, April 11, 1985 1:02:08 pm PST
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.ROPENIL,
designName: Rope.ROPENIL
];
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�lse] 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.