-- CT.Mesa, last edit March 22, 1983 2:08 pm

			DIRECTORY
			Buttons: TYPE USING[Button],
			CedarLinkerOps: TYPE USING[Pending],
			CompilerOps: TYPE USING[LetterSwitches],
			Containers: TYPE USING[Container],
			CTLoad: TYPE USING[LoadInfoSeq, InterfaceSeq],
  		File: TYPE USING[Capability, nullCapability],
			FileParms: TYPE USING[ActualId, nullActual, nullSymbolSpace, SymbolSpace],
			IO: TYPE USING[Handle],
			MBQueue: TYPE USING[Queue],
			PilotLoadStateFormat: TYPE USING [ConfigIndex, NullConfig],
			Rope: TYPE USING[ROPE, Text],
			Space: TYPE USING [Handle],
			TimeStamp: TYPE USING[Null, Stamp],
			ViewerClasses: TYPE USING[Viewer];
			
			
CT: CEDAR DEFINITIONS = {

ModuleList: TYPE = LIST OF MI;
MI: TYPE = REF MIRecord;
MIRecord: TYPE = RECORD[
	srcFileName: Rope.Text ← NIL,		-- if NIL then only load
	srcCreate: LONG CARDINAL ← 0,
	srcCap: File.Capability ← File.nullCapability,
	switches: CompilerOps.LetterSwitches ← NULL,
	explicitSortSwitch: BOOL ← FALSE,
	controlModule: BOOL ← FALSE,
	exportedInterface: BOOL ← FALSE,
	definitions: BOOL ← FALSE,
	--
	bcdFileName: Rope.Text ← NIL,
	bcdCap: File.Capability ← File.nullCapability,
	bcdVers: TimeStamp.Stamp ← TimeStamp.Null,
	bcdValid: BOOL ← TRUE,		-- this bcd is ok
	possiblyBad: BOOL ← FALSE,	-- file we depend on changed
	dependencyBad: BOOL ← FALSE, -- file we depend on failed to compile
	loadInfoSeq: CTLoad.LoadInfoSeq ← NIL,
	dependedBy: LIST OF Rope.Text	-- modules that depend on this one
	];
	
Global: TYPE = REF GlobalRecord;
GlobalRecord: TYPE = RECORD[
	-- viewers data
	container: Containers.Container ← NIL, 
	msgout: IO.Handle ← NIL,
	dout: IO.Handle ← NIL,		-- for debugging purposes
	ttyin: IO.Handle ← NIL,
	ttyout: IO.Handle ← NIL,
	-- fields
	compileButton: Buttons.Button ← NIL,
	compileViewer: ViewerClasses.Viewer ← NIL,
	confirmButton: Buttons.Button ← NIL,
	confirmViewer: ViewerClasses.Viewer ← NIL,
	attachEditorButton: Buttons.Button ← NIL,
	attachEditorLabel: ViewerClasses.Viewer ← NIL,
	-- other objects
	q: MBQueue.Queue ← NIL,
	noticeList: LIST OF Rope.Text ← NIL,	-- files that have been noticed
	confirmCompiles: BOOL ← FALSE,
	attachEditor: BOOL ← TRUE,
	moduleList: ModuleList ← NIL,
	moduleExports: LIST OF CTLoad.InterfaceSeq ← NIL,
	outsideImports: LIST OF OutsideImports ← NIL,
	compiledOk: BOOL ← FALSE,
	loadedOk: BOOL ← FALSE,
	bcdTabList: LIST OF BcdTab ← NIL,
	fakebcdspace: Space.Handle,	-- the bcdbase for a fake config
	fakeBcdFileName: Rope.Text ← NIL,	-- name of backing file
	configindex: PilotLoadStateFormat.ConfigIndex ← PilotLoadStateFormat.NullConfig,
	frameInterfaces: LIST OF REF FrameListRecord ← NIL,
	attachEditorRef: REF ANY ← NIL,
	toBeProcessed: LIST OF CedarLinkerOps.Pending
	];
	
OutsideImports: TYPE = REF OutsideImportsRecord;
OutsideImportsRecord: TYPE = RECORD[
	name: Rope.Text ← NIL,
	bcdVers: TimeStamp.Stamp ← TimeStamp.Null,
	interfaceseq: CTLoad.InterfaceSeq ← NIL
	];
	
BcdTab: TYPE = REF BcdTabRecord;
BcdTabRecord: TYPE = RECORD[
	bcdFileName: Rope.Text ← NIL,
	bcdCap: File.Capability ← File.nullCapability,
	bcdVers: TimeStamp.Stamp ← TimeStamp.Null,
	bcdActual: FileParms.ActualId ← FileParms.nullActual,
	symbolSpace: FileParms.SymbolSpace ← FileParms.nullSymbolSpace
	];

FrameListRecord: TYPE = RECORD[
	name: Rope.Text ← NIL,
	version: TimeStamp.Stamp ← TimeStamp.Null,
	interfaceseq: CTLoad.InterfaceSeq ← NIL
	];
	-- exported by CTCompImpl
DetermineCompilation: PROC[gToUse: Global, modRepl: BOOL] RETURNS[errors: BOOL];

GenUniqueBcdName: PROC[bcdFileName: Rope.Text] RETURNS[newName: Rope.Text];

AppendExtension: PROC[name: Rope.ROPE, ext: LONG STRING]
	RETURNS[r: Rope.Text];
	
SetPossiblyBadAndValid: PROC[MI];

-- exported by CTLDriverImpl
	
LoadBcdsAndResolveImports: PROC[g: Global, tryreplacement: BOOL] RETURNS[errors: BOOL];

StartAllControlBcds: PROC[g: Global];

UnLoad: PROC[g: Global, unloadthebcd: BOOL];

}.