-- Copyright (C) 1987 by Xerox Corporation. All rights reserved. -- Stub file was translated on March 26, 1987 5:07:07 pm PST by Lupine of January 22, 1987 5:37:32 pm PST -- Source interface OldAlpineTransaction came from file OldAlpineTransaction.bcd, which was created on March 26, 1987 5:06:58 pm PST with version stamp 301#256#27357460457 from source of January 6, 1987 2:16:32 pm PST. -- The RPC stub modules for OldAlpineTransaction are: -- OldAlpineTransactionRpcControl.mesa; -- OldAlpineTransactionRpcClientImpl.mesa; -- OldAlpineTransactionRpcBinderImpl.mesa; -- OldAlpineTransactionRpcServerImpl.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 = TRUE -- Warn about short POINTER ("MDS") allocations = TRUE -- Maximum number of dynamic heap NEWs = 50, MDS NEWs = 50 -- Acceptable parameter protocols = VersionRange[1..1]. DIRECTORY OldAlpineEnvironment, OldAlpineTransaction, OldAlpineTransactionRpcControl 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, MarshalAtom, MarshalRope, NilHeader, ProtocolError, -- RopeHeader, RpcPktDoubleWord, RuntimeError, SequenceHeader, SHORT, -- StartNextPkt, StringHeader, StubPktDoubleWord, TranslationError, -- UnmarshalingError, UnmarshalingExprError, UnmarshalAtom, UnmarshalRope, -- WordsForChars]--, Atom --USING SOME OF [GetPName, MakeAtom]--, Rope --USING SOME OF [InlineFlatten, Length, NewText, Text]--; OldAlpineTransactionRpcServerImpl: MONITOR IMPORTS OldAlpineTransaction, RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, Rope EXPORTS OldAlpineTransactionRpcControl SHARES OldAlpineTransaction, OldAlpineTransactionRpcControl, Rope = BEGIN OPEN OldAlpineTransaction, RpcControl: OldAlpineTransactionRpcControl, 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 "OldAlpineTransaction~301#256#27357460457", 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: OldAlpineEnvironment.UnknownType]-- => BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.SignalIndex ← Unknown, what (1): OldAlpineEnvironment.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: OldAlpineEnvironment.OperationFailure]-- => BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.SignalIndex ← OperationFailed, why (1): OldAlpineEnvironment.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. -- OldAlpineTransactionRpcServerImpl.