-- File [Ivy]<Nelson>Lupine>LupineDeclare.mesa.
-- Last edited by BZM on 10-May-82 18:41:34.

-- LupineDeclare is exported by modules LupineDeclare*Impl.


DIRECTORY
  LupineManagerPrivate USING [Language, Nest, Options, String, StringNIL],
  LupineSymbolTable USING [SymbolHandle, TypeHandle];


LupineDeclare: DEFINITIONS =
  BEGIN OPEN LupineManagerPrivate, ST: LupineSymbolTable;


-- General symbol and type routines:

  TransferName: PROCEDURE [transfer: ST.SymbolHandle, nameString: String]
    RETURNS[name: String];

  WriteTransferName: PROCEDURE [transfer: ST.SymbolHandle];

  ParameterName: PROCEDURE [
	parameter: ST.SymbolHandle,
	parameterNumber: INTEGER, 
	nameString: String]
    RETURNS [name: String];

  WriteParameterName: PROCEDURE [
	parameter: ST.SymbolHandle,
	parameterNumber: INTEGER];

  WriteSymbolName: PROCEDURE [symbol: ST.SymbolHandle];

  WriteSymbolType: PROCEDURE [symbol: ST.SymbolHandle];

  WriteTypeName: PROCEDURE [type: ST.TypeHandle, includeReadonly: BOOLEAN←TRUE];


-- Directory and interface manipulation routines:

  DirectoryItem: TYPE = RECORD [
  	module: String,
	usingAll, usingSome: String←StringNIL,  -- Use just one, not both.
	openName: String←StringNIL,
	usedIn: PACKED ARRAY InterfaceUse OF FalseBoolean←ALL[FALSE],
	forLanguage: PACKED ARRAY Language OF FalseBoolean←ALL[TRUE] ];

  InterfaceUse: TYPE = {imports, exports, shares, beginOpen};
  FalseBoolean: TYPE = BOOLEAN ← FALSE;
  DirectoryList: TYPE = LONG DESCRIPTOR FOR READONLY ARRAY OF DirectoryItem;
  EmptyDirectoryList: DirectoryList = NIL;
  ModuleNameList: TYPE = LONG DESCRIPTOR FOR READONLY ARRAY OF String;

  Directory: PROCEDURE [
	includeInterfaceDirectory: BOOLEAN←TRUE,
	extraDirectories: DirectoryList←EmptyDirectoryList,
	options: Options,
	nest: Nest←0 ];

  ModuleHead: PROCEDURE [
	moduleNames: ModuleNameList,
	moduleType: String,
	interfaceList: DirectoryList←EmptyDirectoryList,
	options: Options,
	nest: Nest←0 ];

  InterfaceList: PROCEDURE [
	use: InterfaceUse,
  	targetSystem: Language,
	interfaceList: DirectoryList,
	beginText, endText: String←StringNIL,
	nest: Nest ];


-- Binding code generation routines:

  ImportExport: TYPE = {import, export};

  BindingInterface: PROCEDURE [options: Options];

  BindingRoutinesStandard: PROCEDURE [kind: ImportExport, options: Options];

  BindingRoutinesDynamic: PROCEDURE [kind: ImportExport, options: Options];

  BindingRoutinesPrivate: PROCEDURE [kind: ImportExport, options: Options];




-- Other code generation routines:

  ProcedureIndex: PROCEDURE [nest: Nest←1];

  SignalIndex: PROCEDURE [nest: Nest←1];


  DispatcherType: TYPE = {client, server, callback, none};

  DispatcherHead: PROCEDURE [type: DispatcherType, nest: Nest];

  DispatcherSelect: PROCEDURE [type: DispatcherType, nest: Nest];

  DispatcherTail: PROCEDURE [type: DispatcherType, nest: Nest];


-- Stub code generation routines:

  TransferDeclaration: TYPE = {inInterface, inRoutine};
  TransferSite: TYPE = {caller, callee};
  PktSite: TYPE = {stubFrame, rpcRuntime};

  ProcedureStub: PROCEDURE [
	transfer: ST.SymbolHandle,
	transferType: ST.TypeHandle,
	transferDeclaration: TransferDeclaration,
	signalDispatcherType: DispatcherType,
	options: Options,
	nest: Nest ];

  DispatcherStubArm: PROCEDURE [
	transfer: ST.SymbolHandle,
	transferType: ST.TypeHandle,
	transferDeclaration: TransferDeclaration,
	options: Options,
	nest: Nest ];

  DispatcherStubBody: PROCEDURE [
	transfer: ST.SymbolHandle,
	transferType: ST.TypeHandle,
	transferDeclaration: TransferDeclaration,
	inlineBody: BOOLEAN,
	options: Options,
	nest: Nest ];

  SignalCode: PROCEDURE [
	transfer: ST.SymbolHandle,
	transferType: ST.TypeHandle,
	transferDeclaration: TransferDeclaration,
	options: Options,
	nest: Nest ];

  SignalCatchStub: PROCEDURE [
	transfer: ST.SymbolHandle,
	transferType: ST.TypeHandle,
	transferDeclaration: TransferDeclaration,
	signalDispatcherType: DispatcherType ← none,
	options: Options,
	nest: Nest ];

  END.  -- LupineDeclare.