-- Stub file was translated on February 1, 1984 5:24:47 pm PST by Lupine of December 20, 1983 1:22:57 pm PST
-- Source interface AlpineTransaction came from file AlpineTransaction.bcd, which was created on February 1, 1984 5:24:43 pm PST with version stamp 151#23#12372766723 from source of April 2, 1983 1:52:07 pm PST.
-- The RPC stub modules for AlpineTransaction are:
-- AlpineTransactionRpcControl.mesa;
-- AlpineTransactionRpcClientImpl.mesa;
-- AlpineTransactionRpcBinderImpl.mesa;
-- AlpineTransactionRpcServerImpl.mesa.
-- The parameters for this translation are:
-- Target language = Cedar
-- Default parameter passing = VALUE
-- Deallocate server heap arguments = TRUE
-- Inline RpcServerImpl dispatcher stubs = TRUE
-- Declare signals = FALSE
-- Warn about short POINTER ("MDS") allocations = TRUE
-- Maximum number of dynamic heap NEWs = 50, MDS NEWs = 50
-- Acceptable parameter protocols = VersionRange[1..1].
DIRECTORY
AlpineEnvironment,
AlpineTransaction,
AlpineTransactionRpcControl USING [InterMdsCallsOnly, LupineProtocolVersion,
ProcedureIndex, SignalIndex],
RPC USING [EncryptionKey, InterfaceName, Principal, standardZones,
Zones],
RPCLupine --USING SOME OF [Call, DataLength, Dispatcher, ExportHandle,
-- ExportInterface, GetStubPkt, maxDataLength, maxPrincipalLength,
-- maxShortStringLength, pktOverhead, ReceiveExtraPkt, SendPrelimPkt,
-- StartCall, StartSignal, StubPkt, UnexportInterface]--,
LupineRuntime --USING SOME OF [BindingError, CheckPktLength, CopyFromPkt,
-- CopyFromMultiplePkts, CopyToPkt, CopyToMultiplePkts, defaultZones,
-- DispatchingError, FinishThisPkt, ListHeader, MarshalingError,
-- MarshalingExprError, NilHeader, ProtocolError, RopeHeader, RpcPktDoubleWord,
-- RuntimeError, SequenceHeader, SHORT, StartNextPkt, StringHeader,
-- StubPktDoubleWord, TranslationError, UnmarshalingError, UnmarshalingExprError,
-- WordsForChars]--,
Atom --USING SOME OF [GetPName, MakeAtom]--,
Rope --USING SOME OF [InlineFlatten, Length, NewText, Text]--;
AlpineTransactionRpcServerImpl: MONITOR
IMPORTS AlpineTransaction, RpcPrivate: RPCLupine, Lupine: LupineRuntime,
Atom, Rope
EXPORTS AlpineTransactionRpcControl
SHARES AlpineTransaction, AlpineTransactionRpcControl, Rope
= BEGIN OPEN AlpineTransaction, RpcControl: AlpineTransactionRpcControl,
RpcPublic: RPC;
-- Standard remote binding routines.
bound: BOOLEAN ← FALSE;
myInterface: RpcPrivate.ExportHandle;
paramZones: RpcPublic.Zones ← RpcPublic.standardZones;
ExportInterface: PUBLIC ENTRY SAFE PROCEDURE [
interfaceName: RpcPublic.InterfaceName,
user: RpcPublic.Principal,
password: RpcPublic.EncryptionKey,
parameterStorage: RpcPublic.Zones ] =
TRUSTED BEGIN ENABLE UNWIND => NULL;
IsNull: PROCEDURE [string: Rope.ROPE] RETURNS [BOOLEAN] =
INLINE {RETURN[string.Length[] = 0]};
IF bound THEN Lupine.BindingError;
myInterface ← RpcPrivate.ExportInterface [
interface: [
type: IF ~IsNull[interfaceName.type]
THEN interfaceName.type ELSE "AlpineTransaction~151#23#12372766723",
instance: interfaceName.instance,
version: interfaceName.version ],
user: user, password: password,
dispatcher: ServerDispatcher,
localOnly: RpcControl.InterMdsCallsOnly,
stubProtocol: RpcControl.LupineProtocolVersion ];
paramZones ← [
gc: IF parameterStorage.gc # NIL
THEN parameterStorage.gc ELSE Lupine.defaultZones.gc,
heap: IF parameterStorage.heap # NIL
THEN parameterStorage.heap ELSE Lupine.defaultZones.heap,
mds: IF parameterStorage.mds # NIL
THEN parameterStorage.mds ELSE Lupine.defaultZones.mds ];
bound ← TRUE;
END;
UnexportInterface: PUBLIC ENTRY SAFE PROCEDURE =
TRUSTED BEGIN ENABLE UNWIND => NULL;
IF ~bound THEN Lupine.BindingError;
myInterface ← RpcPrivate.UnexportInterface[myInterface];
paramZones ← RpcPublic.standardZones;
bound ← FALSE;
END;
-- Public procedure dispatcher and public signal and error catcher.
ServerDispatcher: --PROCEDURE [pkt: RPCPkt, callLength: DataLength,
-- lastPkt: BOOLEAN, localConversation: Conversation] RETURNS [returnLength:
-- DataLength]-- RpcPrivate.Dispatcher =
BEGIN
-- Catch public signals.
ENABLE BEGIN
Unknown --ERROR [what: AlpineEnvironment.UnknownType]-- =>
BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.SignalIndex ← Unknown, what (1):
AlpineEnvironment.UnknownType];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 2;
lastPkt: BOOLEAN;
RpcPrivate.StartSignal[signalPkt: pkt];
argPkt↑ ← [what: what];
[returnLength: , lastPkt: lastPkt] ←
RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
maxReturnLength: 0];
Lupine.RuntimeError; -- Impossible to RESUME an ERROR.
END; -- Unknown.
OperationFailed --ERROR [why: AlpineEnvironment.OperationFailure]--
=>
BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.SignalIndex ← OperationFailed,
why (1): AlpineEnvironment.OperationFailure];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 2;
lastPkt: BOOLEAN;
RpcPrivate.StartSignal[signalPkt: pkt];
argPkt↑ ← [why: why];
[returnLength: , lastPkt: lastPkt] ←
RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
maxReturnLength: 0];
Lupine.RuntimeError; -- Impossible to RESUME an ERROR.
END; -- OperationFailed.
END; -- Catch public signals.
-- Call public procedures (still in dispatcher).
SELECT LOOPHOLE[pkt.data[0], RpcControl.ProcedureIndex] FROM
Create => RETURN[
CreateStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
localConversation: localConversation]];
CreateWorker => RETURN[
CreateWorkerStub[pkt: pkt, callLength: callLength, lastPkt:
lastPkt, localConversation: localConversation]];
AssertAlpineWheel => RETURN[
AssertAlpineWheelStub[pkt: pkt, callLength: callLength, lastPkt:
lastPkt, localConversation: localConversation]];
Finish => RETURN[
FinishStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
localConversation: localConversation]];
ENDCASE => RETURN[Lupine.DispatchingError[]];
END; -- ServerDispatcher
-- Public procedure dispatcher stubs.
CreateStub: --PROCEDURE [conversation: Conversation, createLocalWorker:
-- BOOL] RETURNS [transID: TransID]-- RpcPrivate.Dispatcher =
INLINE BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex, createLocalWorker
(1): BOOL];
ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
transID (0): TransID];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 2;
Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
[resPkt.transID] ← Create[localConversation, argPkt.createLocalWorker];
pktLength ← 9;
RETURN[returnLength: pktLength];
END; -- CreateStub.
CreateWorkerStub: --PROCEDURE [conversation: Conversation, transID:
-- TransID, coordinator: FileStore]-- RpcPrivate.Dispatcher =
INLINE BEGIN
coordinator: FileStore;
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex, transID (1): TransID];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 10;
BEGIN -- Unmarshal coordinator: FileStore from pkt.data[pktLength].
ropeIsNIL: Lupine.NilHeader;
ropeIsNIL ← pkt.data[pktLength]; pktLength ← pktLength+1;
IF ropeIsNIL
THEN coordinator ← NIL
ELSE BEGIN
ropeLength: Lupine.RopeHeader;
textRope: Rope.Text;
ropeLength ← pkt.data[pktLength]; pktLength ← pktLength+1;
IF ropeLength > RpcPrivate.maxShortStringLength
THEN Lupine.UnmarshalingError;
coordinator ← textRope ← Rope.NewText[size: ropeLength];
pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength],
alwaysOnePkt: TRUE];
END; -- IF ropeIsNIL.
END; -- Unmarshal coordinator.
Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
CreateWorker[localConversation, argPkt.transID, coordinator];
pktLength ← 0;
RETURN[returnLength: pktLength];
END; -- CreateWorkerStub.
AssertAlpineWheelStub: --PROCEDURE [conversation: Conversation, transID:
-- TransID, enable: BOOL]-- RpcPrivate.Dispatcher =
INLINE BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex, transID (1): TransID,
enable (10): BOOL];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 11;
Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
AssertAlpineWheel[localConversation, argPkt.transID, argPkt.enable];
pktLength ← 0;
RETURN[returnLength: pktLength];
END; -- AssertAlpineWheelStub.
FinishStub: --PROCEDURE [conversation: Conversation, transID: TransID,
-- requestedOutcome: RequestedOutcome, continue: BOOL]
-- RETURNS [outcome: Outcome, newTrans: TransID]-- RpcPrivate.Dispatcher
=
INLINE BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex, transID (1): TransID,
requestedOutcome (10): RequestedOutcome, continue (11): BOOL];
ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
outcome (0): Outcome, newTrans (1): TransID];
argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 12;
Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
[resPkt.outcome, resPkt.newTrans] ←
Finish[localConversation, argPkt.transID, argPkt.requestedOutcome,
argPkt.continue];
pktLength ← 10;
RETURN[returnLength: pktLength];
END; -- FinishStub.
-- No module initialization.
END. -- AlpineTransactionRpcServerImpl.