-- Stub file was translated on August 21, 1984 7:08:37 pm PDT by Lupine of December 20, 1983 1:22:57 pm PST
-- Source interface MazeWarFinder came from file MazeWarFinder.bcd, which was created on August 21, 1984 7:04:26 pm PDT with version stamp 234#307#11100325147 from source of August 21, 1984 7:02:22 pm PDT.
-- The RPC stub modules for MazeWarFinder are:
-- MazeWarFinderRpcControl.mesa;
-- MazeWarFinderRpcClientImpl.mesa;
-- MazeWarFinderRpcBinderImpl.mesa;
-- MazeWarFinderRpcServerImpl.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
Rope,
MazeWarFinder,
MazeWarFinderRpcControl 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, 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]--;
MazeWarFinderRpcClientImpl: MONITOR
IMPORTS RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, Rope
EXPORTS MazeWarFinder, MazeWarFinderRpcControl
SHARES MazeWarFinder, MazeWarFinderRpcControl, Rope
= BEGIN OPEN MazeWarFinder, RpcControl: MazeWarFinderRpcControl,
RpcPublic: RPC;
-- Standard remote binding routines.
bound: BOOLEAN ← FALSE;
myInterface: RpcPrivate.ImportHandle;
paramZones: RpcPublic.Zones ← RpcPublic.standardZones;
ImportInterface: PUBLIC ENTRY SAFE PROCEDURE [
interfaceName: RpcPublic.InterfaceName,
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.ImportInterface [
interface: [
type: IF ~IsNull[interfaceName.type]
THEN interfaceName.type ELSE "MazeWarFinder~234#307#11100325147",
instance: interfaceName.instance,
version: interfaceName.version ],
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;
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.
ListPlayers: PUBLIC PROCEDURE RETURNS [players: BasicPlayerList]
=
BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex ← ListPlayers];
pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+254] OF WORD;
pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 1;
lastPkt: BOOLEAN;
RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
argPkt.transferIndex ← ListPlayers;
[returnLength: , lastPkt: lastPkt] ←
RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
maxReturnLength: 254, signalHandler: ClientDispatcher];
pktLength ← 0;
BEGIN -- Unmarshal players: BasicPlayerList from pkt.data[pktLength].
lastNode: BasicPlayerList ← (players ← NIL);
listLength: Lupine.ListHeader;
IF pktLength+2 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength:
pktLength];
listLength ← Lupine.StubPktDoubleWord[pkt, pktLength]↑;
pktLength ← pktLength + 2;
WHILE listLength > 0 DO
thisNode1: BasicPlayerList = paramZones.gc.CONS[--DefaultValue--,NIL];
BEGIN -- Unmarshal thisNode1.first: BasicPlayer from pkt.data[pktLength].
pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
dataAdr: @thisNode1.first, dataLength: SIZE[BasicPlayer],
alwaysOnePkt: FALSE];
-- Restore garbled REFs to NIL following copy.
BEGIN OPEN record: thisNode1.first;
LOOPHOLE[record.instance, LONG POINTER] ← NIL;
END; -- OPEN record: thisNode1.first.
BEGIN OPEN record: thisNode1.first;
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: thisNode1.first.
END; -- Unmarshal thisNode1.first.
IF lastNode # NIL
THEN lastNode ← (lastNode.rest ← thisNode1)
ELSE lastNode ← (players ← thisNode1);
listLength ← listLength - 1;
ENDLOOP; -- WHILE listLength > 0.
END; -- Unmarshal players.
Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
RETURN[players];
END; -- ListPlayers.
TakePlayer: PUBLIC PROCEDURE [bp: BasicPlayer] =
BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex ← TakePlayer];
pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+254] OF WORD;
pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 1;
lastPkt: BOOLEAN;
RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
argPkt.transferIndex ← TakePlayer;
BEGIN -- Marshal bp: BasicPlayer to pkt.data[pktLength].
pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
dataAdr: @bp, dataLength: SIZE[BasicPlayer], alwaysOnePkt: FALSE];
BEGIN OPEN record: bp;
BEGIN -- Marshal record.instance: Rope.ROPE to pkt.data[pktLength].
IF pktLength+2 > RpcPrivate.maxDataLength
THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength:
pktLength];
pkt.data[pktLength] ← record.instance=NIL; pktLength ← pktLength+1;
IF record.instance # NIL
THEN BEGIN
textRope: Rope.Text = Rope.InlineFlatten[r: record.instance];
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 record.instance # NIL.
END; -- Marshal record.instance.
END; -- OPEN record: bp.
END; -- Marshal bp.
[returnLength: , lastPkt: lastPkt] ←
RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
maxReturnLength: 0, signalHandler: ClientDispatcher];
Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
RETURN[];
END; -- TakePlayer.
GetFinderID: PUBLIC PROCEDURE RETURNS [bp: BasicPlayer] =
BEGIN
ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
transferIndex (0): RpcControl.ProcedureIndex ← GetFinderID];
pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+254] OF WORD;
pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
pktLength: RpcPrivate.DataLength ← 1;
lastPkt: BOOLEAN;
RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
argPkt.transferIndex ← GetFinderID;
[returnLength: , lastPkt: lastPkt] ←
RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
maxReturnLength: 254, signalHandler: ClientDispatcher];
pktLength ← 0;
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];
RETURN[bp];
END; -- GetFinderID.
-- Remote public signals and errors.
StupidFuckingWarnings: PUBLIC SIGNAL [atom: ATOM] = CODE;
-- 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
StupidFuckingWarnings => RETURN[
StupidFuckingWarningsStub[pkt: pkt, callLength: callLength,
lastPkt: lastPkt, localConversation: localConversation]];
ENDCASE => RETURN[Lupine.DispatchingError[]];
END; -- ClientDispatcher
-- Public signal and error dispatcher stubs.
StupidFuckingWarningsStub: --SIGNAL [atom: ATOM]-- RpcPrivate.Dispatcher
=
INLINE BEGIN
atom: ATOM;
pktLength: RpcPrivate.DataLength ← 1;
BEGIN -- Unmarshal atom: ATOM from pkt.data[pktLength].
pNameOfAtom: Rope.ROPE;
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 pNameOfAtom ← NIL
ELSE BEGIN
ropeLength: Lupine.RopeHeader;
textRope: Rope.Text;
ropeLength ← pkt.data[pktLength]; pktLength ← pktLength+1;
IF ropeLength > LAST[NAT]
THEN Lupine.UnmarshalingError;
pNameOfAtom ← 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.
atom ← Atom.MakeAtom[--pName:-- pNameOfAtom];
END; -- Unmarshal atom.
Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
SIGNAL StupidFuckingWarnings[atom];
pktLength ← 0;
RETURN[returnLength: pktLength];
END; -- StupidFuckingWarningsStub.
-- No module initialization.
END. -- MazeWarFinderRpcClientImpl.