-- ProcBcds.Mesa, last edit 18-Mar-82 14:08:05
-- Pilot 6.0/ Mesa 7.0

DIRECTORY
  BcdDefs: TYPE USING [Base, BCD, VersionStamp],
  BcdOps: TYPE USING [NameString],
  File: TYPE USING [Capability, nullCapability],
  FileParms: TYPE USING [SymbolSpace],
  IFSFile: TYPE USING [FileHandle],
  Space: TYPE USING [Handle];

ProcBcds: DEFINITIONS = {

-- these are procedures the user provides 
-- usually as parameters to PrintDepends
RelCode: TYPE = {imports, exports, otherdepends, symbolsfile, canignore,
	defstype, sourcefile};

-- ProcBcds.PrintDepends calls ProcMod and then ProcDep 
-- as many times as needed
-- sourcefile ends in either a .config or .mesa
-- uns is usually a DBTuples.Tuple
ProcMod: TYPE = PROC[sourcefile, smodulename: STRING, 
	bcdvers, sourcevers, creatorvers: BcdDefs.VersionStamp,
	isdefns, isconfig, iscodebound, istablecompiled,
	altoCode, boundsChecks, cedarSwitch, crossJump, linksInCode, nilChecks, sortByUsage: BOOL,
	symbolSpace: FileParms.SymbolSpace, rtVersionID: CARDINAL]
	RETURNS[uns: UNSPECIFIED];
-- uns is passed thru from ProcMod result
-- the user generates uns, we call procDep with it
-- filename normally has ".bcd" at the end
ProcDep: TYPE = PROC[relcode: RelCode, smodulename, filename: STRING, 
	bcdvers: BcdDefs.VersionStamp, uns: UNSPECIFIED];


Innards: TYPE = POINTER TO InnardsObject;
InnardsObject: TYPE = RECORD[
 	cap:	File.Capability ← File.nullCapability,
 	fh: 	IFSFile.FileHandle ← NIL,
	bcdheaderspace:	Space.Handle,	
	bcd: 	LONG POINTER TO BcdDefs.BCD ← NIL,
	upperLimit: CARDINAL ← NULL,	-- this is # words available
	tb: 	BcdDefs.Base ← NULL,
	ssb: 	BcdOps.NameString ← NULL,
	evb: 	BcdDefs.Base ← NULL,
	spb: 	BcdDefs.Base ← NULL,
	fpb: 	BcdDefs.Base ← NULL,
	ctb: 	BcdDefs.Base ← NULL,
	mtb: 	BcdDefs.Base ← NULL,
	itb: 	BcdDefs.Base ← NULL,
	etb: 	BcdDefs.Base ← NULL,
	sgb: 	BcdDefs.Base ← NULL,
	ftb: 	BcdDefs.Base ← NULL,
	ntb: 	BcdDefs.Base ← NULL
	];
  
-- this procedure takes a file name and calls the three procedure
-- variables that are its last arguments on file "sfn"
-- you must do an InstallAddressesBcd[] first
-- I will call procMod.
-- Then I will call procDep for each dependency for both Defs and Impls.
-- if print is TRUE, it will print out the number of imports and exports
-- if calltwice is TRUE, it will call ProcMod twice to help with
--		clustering in the database
PrintDepends: PROC[innards: Innards, procMod: ProcMod, procDep: ProcDep,
	print, calltwice, less: BOOL, bcdfilename: LONG STRING]	
	RETURNS[success, isconfig, isdefns: BOOL, 
		nimp, nexp, ntype: CARDINAL];


-- defined in ProcBcdsImpl

-- the way this works is that you call ReadInSegmentsBcd
-- with innards.cap filled in with the cap of a local file
-- or call it with the fh of a remote file

-- uses innards.cap or innards.fh, sets innards.bcdheaderspace and .bcd
ReadInSegmentsBcd: PROC[innards: Innards];

-- raised by ReadInSegmentsBcd
InvalidBcd: SIGNAL;	-- invalid bcd version ID

-- uses innards.bcd, set other bases
InstallAddressesBcd: PROC[innards: Innards];

-- uses innards.bcdheaderspace
-- does NOT close fh
UnstallBcd: PROC [innards: Innards];

-- innards.cap and space initted from ReadInSegmentsBcd
-- called by DescribeBcdImpl
PrintSymbolsFile: PROC[innards: Innards, procDep: ProcDep, 
	uns: UNSPECIFIED, print, allsyms, less: BOOL, bcdfilename: LONG STRING] 
	RETURNS[success: BOOL, ntype: CARDINAL];

GetModuleName: PROC[innards: ProcBcds.Innards, interfacename: STRING] 
	RETURNS[success: BOOL];

-- uses heuristics
IsRealTime: PROC[stamp: LONG CARDINAL] RETURNS[isrealtime: BOOL];

}.