-- Stub file TankMasterRpcClientImpl.mesa was translated on 16-Mar-83 -- 9:07:25 PST by Lupine of 18-Feb-83 11:25:52 PST. -- Source interface TankMaster came from file TankMaster.bcd, which -- was created on 16-Mar-83 9:07:11 PST with version stamp 176#227#36526563207 -- from source of 16-Mar-83 9:06:51 PST. -- The RPC stub modules for TankMaster are: -- TankMasterRpcControl.mesa; -- TankMasterRpcClientImpl.mesa; -- TankMasterRpcBinderImpl.mesa; -- TankMasterRpcServerImpl.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 PupTypes, Rope, TankMaster, TankMasterRpcControl 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], RopeInline --USING SOME OF [InlineFlatten, NewText]--, SafeStorage USING [GetSystemZone], UnsafeStorage USING [GetSystemUZone]; TankMasterRpcClientImpl: MONITOR IMPORTS RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, ConvertUnsafe, Heap, RopeInline, SafeStorage, UnsafeStorage EXPORTS TankMaster, TankMasterRpcControl SHARES TankMaster, TankMasterRpcControl, Rope = BEGIN OPEN TankMaster, RpcControl: TankMasterRpcControl, 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 "TankMaster~176#227#36526563207"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. AddPlayer: PUBLIC PROCEDURE [name: Rope.ROPE, address: Machine] RETURNS [--ok:-- BOOLEAN, --id:-- CARDINAL] = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← AddPlayer, address (1): Machine]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ ok (0): BOOLEAN, id (1): CARDINAL]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+254] 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]; argPkt↑ ← [address: address]; BEGIN -- Marshal name: Rope.ROPE to pkt.data[pktLength]. IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength]; pkt.data[pktLength] ← name=NIL; pktLength ← pktLength+1; IF name # NIL THEN BEGIN textRope: Rope.Text = RopeInline.InlineFlatten[r: name]; 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: FALSE]; END; -- IF name # NIL. END; -- Marshal name. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 2, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 2]; RETURN[resPkt.ok, resPkt.id]; END; -- AddPlayer. RemovePlayer: PUBLIC PROCEDURE [id: CARDINAL] = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← RemovePlayer, id (1): CARDINAL]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+2] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 2; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt↑ ← [id: id]; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- RemovePlayer. GetPlayer: PUBLIC PROCEDURE [id: CARDINAL] RETURNS [name: Rope.ROPE, address: Machine, score: INTEGER] = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← GetPlayer, id (1): CARDINAL]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ address (0): Machine, score (1): INTEGER]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+254] 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]; argPkt↑ ← [id: id]; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 254, signalHandler: ClientDispatcher]; pktLength ← 2; BEGIN -- OnePkt. onePkt: BOOLEAN = lastPkt; IF ~onePkt THEN BEGIN -- Must move statics from pkt now. [address: address, score: score] ← resPkt↑; END; BEGIN -- Unmarshal name: Rope.ROPE from pkt.data[pktLength]. ropeIsNIL: Lupine.NilHeader; IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength]; ropeIsNIL ← pkt.data[pktLength]; pktLength ← pktLength+1; IF ropeIsNIL THEN name ← NIL ELSE BEGIN ropeLength: Lupine.RopeHeader; textRope: Rope.Text; ropeLength ← pkt.data[pktLength]; pktLength ← pktLength+1; IF ropeLength > LAST[NAT] THEN Lupine.UnmarshalingError; name ← textRope ← RopeInline.NewText[size: ropeLength]; pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[ropeLength], alwaysOnePkt: FALSE]; END; -- IF ropeIsNIL. END; -- Unmarshal name. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; IF onePkt THEN RETURN[name, resPkt.address, resPkt.score] ELSE RETURN[name, address, score]; END; -- OnePkt. END; -- GetPlayer. Update: PUBLIC PROCEDURE [id: CARDINAL, tank: Tank, torp: Torp] RETURNS [--anonP1id2562562:-- WorldStateRec] = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← Update, id (1): CARDINAL, tank (2): Tank, torp (5): Torp]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ anonP1id2562562 (0): WorldStateRec]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+57] 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 ← 8; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt↑ ← [id: id, tank: tank, torp: torp]; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 57, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 57]; RETURN[resPkt.anonP1id2562562]; END; -- Update. ScoreHit: PUBLIC PROCEDURE [torp: CARDINAL, target: CARDINAL] = BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex ← ScoreHit, torp (1): CARDINAL, target (2): CARDINAL]; pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+3] OF WORD; pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer]; argPkt: POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 3; lastPkt: BOOLEAN; RpcPrivate.StartCall[callPkt: pkt, interface: myInterface]; argPkt↑ ← [torp: torp, target: target]; [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0, signalHandler: ClientDispatcher]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RETURN[]; END; -- ScoreHit. -- Remote public signals and errors. -- 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 ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ClientDispatcher -- Public signal and error dispatcher stubs. -- No module initialization. END. -- TankMasterRpcClientImpl.