-- Stub file AlpineTransactionRpcClientImpl.mesa was translated on -- 7-Jun-83 12:00:22 PDT by Lupine of 18-Feb-83 11:25:52 PST. -- edited by kolling on June 7, 1983 11:48 am. -- Source interface AlpineTransaction came from file AlpineTransaction.bcd, -- which was created on 7-Jun-83 12:00:08 PDT with version stamp 117#174#6244074703 -- from source of 2-Apr-83 13:52:07 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; -- 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 [InterfaceName, standardZones, Zones], RPCLupine --USING SOME OF [Call, DataLength, Dispatcher, GetStubPkt, -- ImportHandle, ImportInterface, maxDataLength, maxPrincipalLength, -- maxShortStringLength, pktOverhead, ReceiveExtraPkt, SendPrelimPkt, -- StartCall, StartSignal, StubPkt, UnimportInterface]--, LupineRuntime --USING SOME OF [BindingError, CheckPktLength, CopyFromPkt, -- CopyFromMultiplePkts, CopyToPkt, CopyToMultiplePkts, 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]--, ConvertUnsafe USING [AppendRope], Heap USING [systemMDSZone], Rope --USING SOME OF [Text]--, RopeInline --USING SOME OF [InlineFlatten, NewText]--, SafeStorage USING [GetSystemZone], UnsafeStorage USING [GetSystemUZone]; AlpineTransactionRpcClientImpl: MONITOR IMPORTS AlpineTransaction, RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, ConvertUnsafe, Heap, RopeInline, SafeStorage, UnsafeStorage EXPORTS AlpineTransaction, AlpineTransactionRpcControl SHARES AlpineTransaction, AlpineTransactionRpcControl, Rope = BEGIN OPEN AlpineTransaction, RpcControl: AlpineTransactionRpcControl, RpcPublic: RPC; -- Standard remote binding routines. bound: BOOLEAN ← FALSE; myInterface: RpcPrivate.ImportHandle ← NULL; paramZones: RpcPublic.Zones ← RpcPublic.standardZones; ImportInterface: PUBLIC ENTRY SAFE PROCEDURE [ interfaceName: RpcPublic.InterfaceName, parameterStorage: RpcPublic.Zones ] = TRUSTED BEGIN ENABLE UNWIND => NULL; IsNull: PROCEDURE [string: LONG STRING] RETURNS [BOOLEAN] = INLINE {RETURN[ string=NIL OR string.length=0 ]}; IF bound THEN Lupine.BindingError; BEGIN type: STRING = [RpcPrivate.maxShortStringLength]; instance: STRING = [RpcPrivate.maxShortStringLength]; ConvertUnsafe.AppendRope[to: type, from: interfaceName.type]; ConvertUnsafe.AppendRope[to: instance, from: interfaceName.instance]; myInterface ← RpcPrivate.ImportInterface [ interface: [ type: IF ~IsNull[type] THEN type ELSE "AlpineTransaction~117#174#6244074703"L, instance: instance, version: interfaceName.version ], localOnly: RpcControl.InterMdsCallsOnly, stubProtocol: RpcControl.LupineProtocolVersion ]; END; paramZones ← [ gc: IF parameterStorage.gc # NIL THEN parameterStorage.gc ELSE SafeStorage.GetSystemZone[], heap: IF parameterStorage.heap # NIL THEN parameterStorage.heap ELSE UnsafeStorage.GetSystemUZone[], mds: IF parameterStorage.mds # NIL THEN parameterStorage.mds ELSE Heap.systemMDSZone ]; bound ← TRUE; END; UnimportInterface: PUBLIC ENTRY SAFE PROCEDURE = TRUSTED BEGIN ENABLE UNWIND => NULL; IF ~bound THEN Lupine.BindingError; myInterface ← RpcPrivate.UnimportInterface[myInterface]; paramZones ← RpcPublic.standardZones; bound ← FALSE; END; -- Remote public procedure stubs. Create: PUBLIC PROCEDURE [conversation: Conversation, createLocalWorker: BOOL] RETURNS [--transID:-- TransID] = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← Create, createLocalWorker (1): BOOL]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ transID (0): TransID]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+9] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 2; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: conversation]; argPkt↑ ← [createLocalWorker: createLocalWorker]; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 9, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 9]; RETURN[resPkt.transID]; END; -- Create. CreateWorker: PUBLIC PROCEDURE [conversation: Conversation, transID: TransID, coordinator: FileStore] = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← CreateWorker, transID (1): TransID]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+44] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 10; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: conversation]; argPkt↑ ← [transID: transID]; BEGIN -- Marshal coordinator: FileStore to pkt.data[pktLength]. pkt.data[pktLength] ← coordinator=NIL; pktLength ← pktLength+1; IF coordinator # NIL THEN BEGIN textRope: Rope.Text = RopeInline.InlineFlatten[r: coordinator]; IF textRope.length > RpcPrivate.maxShortStringLength THEN Lupine.MarshalingError; pkt.data[pktLength] ← textRope.length; pktLength ← pktLength+1; pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[textRope.length], alwaysOnePkt: TRUE]; END; -- IF coordinator # NIL. END; -- Marshal coordinator. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- CreateWorker. AssertAlpineWheel: PUBLIC PROCEDURE [conversation: Conversation, transID: TransID, enable: BOOL] = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← AssertAlpineWheel, transID (1): TransID, enable (10): BOOL]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+11] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 11; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: conversation]; argPkt↑ ← [transID: transID, enable: enable]; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- AssertAlpineWheel. Finish: PUBLIC PROCEDURE [conversation: Conversation, transID: TransID, requestedOutcome: RequestedOutcome, continue: BOOL] RETURNS [--outcome:-- Outcome, --newTrans:-- TransID] = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← Finish, transID (1): TransID, requestedOutcome (10): RequestedOutcome, continue (11): BOOL]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ outcome (0): Outcome, newTrans (1): TransID]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+12] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 12; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation: conversation]; argPkt↑ ← [transID: transID, requestedOutcome: requestedOutcome, continue: continue]; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 10, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 10]; RETURN[resPkt.outcome, resPkt.newTrans]; END; -- Finish. -- Public signal and error dispatcher. ClientDispatcher: --PROCEDURE [pkt: RPCPkt, callLength: DataLength, -- lastPkt: BOOLEAN, localConversation: Conversation] RETURNS [returnLength: -- DataLength]-- RpcPrivate.Dispatcher = BEGIN SELECT LOOPHOLE[pkt.data[0], RpcControl.SignalIndex] FROM Unknown => RETURN[ UnknownStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; OperationFailed => RETURN[ OperationFailedStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ClientDispatcher -- Public signal and error dispatcher stubs. UnknownStub: --ERROR [what: AlpineEnvironment.UnknownType]-- RpcPrivate.Dispatcher = INLINE BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.SignalIndex, what (1): AlpineEnvironment.UnknownType]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; Lupine.CheckPktLength[pkt: pkt, pktLength: 2]; ERROR AlpineTransaction.Unknown[argPkt.what]; END; -- UnknownStub. OperationFailedStub: --ERROR [why: AlpineEnvironment.OperationFailure]-- RpcPrivate.Dispatcher = INLINE BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.SignalIndex, why (1): AlpineEnvironment.OperationFailure]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; Lupine.CheckPktLength[pkt: pkt, pktLength: 2]; ERROR AlpineTransaction.OperationFailed[argPkt.why]; END; -- OperationFailedStub. -- No module initialization. END. -- AlpineTransactionRpcClientImpl.