-- File [Ivy]<Nelson>Lupine>LupineManager.mesa.
-- Last edited by BZM on  2-May-82 22:48:33.


DIRECTORY
  File USING [Capability, nullCapability];


LupineManager: DEFINITIONS = BEGIN


-- These string definitions are used for easy SDD compatibility.

  String: TYPE = LONG STRING ← StringNIL | NULL;
  StringNIL: String = NIL;  -- Explicit nonNIL constant needed for INLINEs.


-- TranslateRemoteInterface is the procedural access to Lupine.
-- It is not reentrant, and is monitored to enforce serial access.
-- If interfaceBcdCapability is specified, then it is used in
--  preference to interfaceBcdFilename.  But interfaceBcdFilename
--  must always be specified for error reporting.
-- All errors are reported through the errorHandler procedure.

  TranslateRemoteInterface: PROCEDURE [
  	interfaceBcdFilename: String,
  	interfaceBcdCapability: File.Capability ← File.nullCapability,
  	errorHandler: ErrorHandlerProc,
	options: Options←StandardOptions,
	desiredLineLength: LONG INTEGER ← 82 ];

  Options: TYPE = RECORD [
	targetLanguage: Language ← Cedar,
	defaultParamPassing: ParamPassingMethod ← Value,
	freeServerArguments: BOOLEAN ← TRUE,
	inlineServerDispatcherStubs: BOOLEAN ← TRUE,
	maxHeapAllocations, maxMdsAllocations: LONG INTEGER ← 50 ];

  StandardOptions: Options = [];

  Language: TYPE = {Cedar, Mesa};
  ParamPassingMethod: TYPE = {Var, Value, Result, Handle, InterMds};

 
-- ErrorHandlerProc is called so that clients can see and act on each
-- translation error.  The problemCausingText argument usually contains the
-- the source text in which the error was located (e.g., bad file name,
-- invalid procedure name, unmarshalable type).  Even when problemCausingText
-- is NIL, however, the generated stub files contain full error descriptions
-- as comments.  If type=abort, abortTranslation is always forced to be TRUE.
-- The outputFileName and outputFilePosition arguments tell where the error
-- occurred.  For errors found before code generation starts, outputFileName=NIL.
-- ErrorHandlerProc must behave since a monitor lock is held during the call.  

  ErrorHandlerProc: TYPE = --INTERNAL-- PROCEDURE [
	type: ErrorType,
	code: ErrorCode,
	codeExplanation: String,
	outputFileName: String←StringNIL,
	outputFileCharPosition: LONG INTEGER,
	problemCausingText: String←StringNIL ]
    RETURNS [abortTranslation: BOOLEAN←FALSE];

  ErrorType: TYPE = {abort, error, warning};

  ErrorCode: TYPE = {
	AnonymousIdentifier,
	BadBcdFileFormat, BadBcdFileVersion,
	ComputedSequence, ComputedVariant,
	EmbeddedRESULT,
	EmptyArray,
	HandleREF,
	ImproperPassingMethod, ImproperReadonlyRESULT, ImproperRESULTResult,
	InterfaceVariables,
	InvalidHandle,
	NoSuchFile,
	NotInterfaceModule,
	ProbablePointerRecursion,
	SequenceInsideVariant,
	ShortInterMdsPointers,
	TransferParameter,
	UnimplementedMarshaling,
	Unknown,
	UnsupportedTransfers };

  END.  -- LupineManager.