-- Copyright (C) 1985 by Xerox Corporation. All rights reserved. -- Stub file was translated on May 24, 1985 11:17:59 am PDT by Lupine of May 22, 1985 8:12:39 am PDT -- Source interface MazeWarPlayer came from file MazeWarPlayer.bcd, which was created on May 9, 1985 4:33:24 pm PDT with version stamp 356#202#31457543646 from source of May 9, 1985 4:31:39 pm PDT. -- The RPC stub modules for MazeWarPlayer are: -- MazeWarPlayerRpcControl.mesa; -- MazeWarPlayerRpcClientImpl.mesa; -- MazeWarPlayerRpcBinderImpl.mesa; -- MazeWarPlayerRpcServerImpl.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 MazeWarFinder, Rope, MazeWarPlayer, MazeWarPlayerRpcControl 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]--; MazeWarPlayerRpcServerImpl: MONITOR IMPORTS MazeWarPlayer, RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, Rope EXPORTS MazeWarPlayerRpcControl SHARES MazeWarPlayer, MazeWarPlayerRpcControl, Rope = BEGIN OPEN MazeWarPlayer, RpcControl: MazeWarPlayerRpcControl, 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 "MazeWarPlayer~356#202#31457543646", 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 StupidFuckingWarnings --SIGNAL [atom: ATOM]-- => BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.SignalIndex ← StupidFuckingWarnings]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength ← 1; lastPkt: BOOLEAN; RpcPrivate.StartSignal[signalPkt: pkt]; argPkt.transferIndex ← StupidFuckingWarnings; BEGIN -- Marshal atom: ATOM to pkt.data[pktLength]. pNameOfAtom: Rope.Text = Atom.GetPName[atom: atom]; IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength]; pkt.data[pktLength] ← pNameOfAtom=NIL; pktLength ← pktLength+1; IF pNameOfAtom # NIL THEN BEGIN textRope: Rope.Text = Rope.InlineFlatten[r: pNameOfAtom]; 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 pNameOfAtom # NIL. END; -- Marshal atom. [returnLength: , lastPkt: lastPkt] ← RpcPrivate.Call[ pkt: pkt, callLength: pktLength, maxReturnLength: 0]; Lupine.CheckPktLength[pkt: pkt, pktLength: 0]; RESUME[]; END; -- StupidFuckingWarnings. END; -- Catch public signals. -- Call public procedures (still in dispatcher). SELECT LOOPHOLE[pkt.data[0], RpcControl.ProcedureIndex] FROM KnowPlayer => RETURN[ KnowPlayerStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; GetState => RETURN[ GetStateStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; RemovePlayer => RETURN[ RemovePlayerStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; TakeStatus => RETURN[ TakeStatusStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; Shoot => RETURN[ ShootStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt, localConversation: localConversation]]; ENDCASE => RETURN[Lupine.DispatchingError[]]; END; -- ServerDispatcher -- Public procedure dispatcher stubs. KnowPlayerStub: --PROCEDURE [bp: BasicPlayer]-- RpcPrivate.Dispatcher = INLINE BEGIN bp: BasicPlayer; pktLength: RpcPrivate.DataLength ← 1; BEGIN -- Unmarshal bp: BasicPlayer from pkt.data[pktLength]. pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength, dataAdr: @bp, dataLength: SIZE[BasicPlayer], alwaysOnePkt: FALSE]; -- Restore garbled REFs to NIL following copy. BEGIN OPEN record: bp; LOOPHOLE[record.instance, LONG POINTER] ← NIL; END; -- OPEN record: bp. BEGIN OPEN record: bp; BEGIN -- Unmarshal record.instance: 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 record.instance ← NIL ELSE BEGIN ropeLength: Lupine.RopeHeader; textRope: Rope.Text; ropeLength ← pkt.data[pktLength]; pktLength ← pktLength+1; IF ropeLength > LAST[NAT] THEN Lupine.UnmarshalingError; record.instance ← textRope ← Rope.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 record.instance. END; -- OPEN record: bp. END; -- Unmarshal bp. Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength]; KnowPlayer[bp]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- KnowPlayerStub. GetStateStub: --PROCEDURE RETURNS [id: PlayerId, name: ROPE, pics: -- ROPE, maze: ROPE, row: INTEGER, col: INTEGER, score: INTEGER, -- angle: Angle]-- RpcPrivate.Dispatcher = INLINE BEGIN name: ROPE; pics: ROPE; maze: ROPE; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ id (0): PlayerId, row (1): INTEGER, col (2): INTEGER, score (3): INTEGER, angle (4): Angle]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 1]; [resPkt.id, name, pics, maze, resPkt.row, resPkt.col, resPkt.score, resPkt.angle] ← GetState[]; pktLength ← 5; BEGIN -- Marshal name: 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 = Rope.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. BEGIN -- Marshal pics: ROPE to pkt.data[pktLength]. IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength]; pkt.data[pktLength] ← pics=NIL; pktLength ← pktLength+1; IF pics # NIL THEN BEGIN textRope: Rope.Text = Rope.InlineFlatten[r: pics]; 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 pics # NIL. END; -- Marshal pics. BEGIN -- Marshal maze: ROPE to pkt.data[pktLength]. IF pktLength+2 > RpcPrivate.maxDataLength THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength]; pkt.data[pktLength] ← maze=NIL; pktLength ← pktLength+1; IF maze # NIL THEN BEGIN textRope: Rope.Text = Rope.InlineFlatten[r: maze]; 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 maze # NIL. END; -- Marshal maze. RETURN[returnLength: pktLength]; END; -- GetStateStub. RemovePlayerStub: --PROCEDURE [id: PlayerId]-- RpcPrivate.Dispatcher = INLINE BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, id (1): PlayerId]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 2]; RemovePlayer[argPkt.id]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- RemovePlayerStub. TakeStatusStub: --PROCEDURE [id: PlayerId, row: INTEGER, col: INTEGER, -- score: INTEGER, angle: Angle, shot: BOOLEAN]-- RpcPrivate.Dispatcher = INLINE BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, id (1): PlayerId, row (2): INTEGER, col (3): INTEGER, score (4): INTEGER, angle (5): Angle, shot (6): BOOLEAN]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 7]; TakeStatus[argPkt.id, argPkt.row, argPkt.col, argPkt.score, argPkt.angle, argPkt.shot]; pktLength ← 0; RETURN[returnLength: pktLength]; END; -- TakeStatusStub. ShootStub: --PROCEDURE [shooterId: PlayerId, row: INTEGER, col: INTEGER, -- drow: INTEGER, dcol: INTEGER] -- RETURNS [shot: BOOLEAN]-- RpcPrivate.Dispatcher = INLINE BEGIN ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [ transferIndex (0): RpcControl.ProcedureIndex, shooterId (1): PlayerId, row (2): INTEGER, col (3): INTEGER, drow (4): INTEGER, dcol (5): INTEGER]; ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [ shot (0): BOOLEAN]; argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0]; resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0]; pktLength: RpcPrivate.DataLength; Lupine.CheckPktLength[pkt: pkt, pktLength: 6]; [resPkt.shot] ← Shoot[argPkt.shooterId, argPkt.row, argPkt.col, argPkt.drow, argPkt.dcol]; pktLength ← 1; RETURN[returnLength: pktLength]; END; -- ShootStub. -- No module initialization. END. -- MazeWarPlayerRpcServerImpl.