CDImports.mesa (part of Chipndale)
Copyright © 1984 by Xerox Corporation. All rights reserved.
by Christian Jacobi March 20, 1984 5:50:51 pm PST
last edited Christian Jacobi August 15, 1984 12:02:21 pm PDT
DIRECTORY
CD, Rope;
CDImports: CEDAR DEFINITIONS =
BEGIN
-- no design is allowed to make circular imports
ReferencePtr: TYPE = REF ReferenceRep;
ReferenceRep: TYPE = RECORD [
boundApp: CD.ApplicationPtr ← NIL, -- NIL if not yet bound
objectName: Rope.ROPE,
designName: Rope.ROPE
];
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,
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.
END.