-- Copyright (C) 1986 by Xerox Corporation.  All rights reserved.
-- Stub file  was translated on May 9, 1986 7:49:25 am PDT by Lupine of May 23, 1985 8:38:08 am PDT
-- Source interface ComputeServerController came from file ComputeServerController.bcd, which was created on May 9, 1986 7:48:13 am PDT with version stamp 337#276#17756447420 from source of May 9, 1986 7:47:01 am PDT.

-- The RPC stub modules for ComputeServerController are:
--   ComputeServerControllerRpcControl.mesa;
--   ComputeServerControllerRpcClientImpl.mesa;
--   ComputeServerControllerRpcBinderImpl.mesa;
--   ComputeServerControllerRpcServerImpl.mesa.

-- The parameters for this translation are:
--   Target language = Cedar
--   Default parameter passing = VALUE
--   Deallocate server heap arguments = TRUE
--   Inline RpcServerImpl dispatcher stubs = FALSE
--   Declare signals = FALSE
--   Warn about short POINTER ("MDS") allocations = TRUE
--   Maximum number of dynamic heap NEWs = 50, MDS NEWs = 50
--   Acceptable parameter protocols = VersionRange[1..1].


DIRECTORY
  BasicTime,
  ComputeServer,
  PrincOps,
  Pup,
  Rope,
  RPC,
  ComputeServerController,
  ComputeServerControllerRpcControl USING [InterfaceRecord, InterMdsCallsOnly,
      LupineProtocolVersion, ProcedureIndex, SignalIndex],
  RPCLupine --USING SOME OF [Alloc, Call, DataLength, DeAlloc, Dispatcher,
      -- GetPkt, 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, MarshalAtom, MarshalRope, NilHeader, ProtocolError,
      -- RopeHeader, RpcPktDoubleWord, RuntimeError, SequenceHeader, SHORT,
      -- StartNextPkt, StringHeader, StubPktDoubleWord, TranslationError,
      -- UnmarshalingError, UnmarshalingExprError, UnmarshalAtom, UnmarshalRope,
      -- WordsForChars]--,
  Atom --USING SOME OF [GetPName, MakeAtom]--,
  PrincOpsUtils --USING SOME OF [Enter, Exit]--,
  VM --USING SOME OF [AddressForPageNumber, PageCount, PageNumber,
      -- PageNumberForAddress, PagesForWords]--;


ComputeServerControllerRpcClientImpl: MONITOR
  IMPORTS ComputeServerController, RpcPrivate: RPCLupine, Lupine: LupineRuntime,
      Atom, PrincOpsUtils, Rope
  EXPORTS ComputeServerControllerRpcControl
  SHARES  ComputeServerController, ComputeServerControllerRpcControl,
      Rope
  = BEGIN OPEN ComputeServerController, RpcControl: ComputeServerControllerRpcControl,
      RpcPublic: RPC;


-- Standard remote binding routines.


  ImportInterface: PUBLIC ENTRY SAFE PROCEDURE [
        interface: RpcControl.InterfaceRecord,
        interfaceName: RpcPublic.InterfaceName,
        parameterStorage: RpcPublic.Zones ] =
    TRUSTED BEGIN ENABLE UNWIND => NULL;
    IsNull: PROCEDURE [string: Rope.ROPE] RETURNS [BOOLEAN] =
      INLINE {RETURN[string.Length[] = 0]};
        interface↑ ← [clientStubFindService: clientStubFindService,
            clientStubFindServiceWithQueueing: clientStubFindServiceWithQueueing,
            clientStubNewStats: clientStubNewStats, clientStubBestServerStats:
            clientStubBestServerStats, clientStubNoticeNewPackage: clientStubNoticeNewPackage,
            clientStubRemoveOldPackage: clientStubRemoveOldPackage, clientStubGetSomeInfo:
            clientStubGetSomeInfo, clientStubCommandUnavailable: clientStubCommandUnavailable,
            clientStubExtraCommandAvailable: clientStubExtraCommandAvailable,
            clientStubMightAcceptQueuedCommand: clientStubMightAcceptQueuedCommand,
            clientStubGenericToController: clientStubGenericToController];
    interface.myInterface ← RpcPrivate.ImportInterface [
      interface: [
        type: IF ~IsNull[interfaceName.type]
          THEN interfaceName.type ELSE "ComputeServerController~337#276#17756447420",
        instance: interfaceName.instance,
        version: interfaceName.version ],
      localOnly: RpcControl.InterMdsCallsOnly,
      stubProtocol: RpcControl.LupineProtocolVersion ];
    interface.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 ];
    interface.bound ← TRUE;
    END;



-- Remote public procedure stubs.

  clientStubFindService: PUBLIC SAFE PROCEDURE [interface: RpcControl.InterfaceRecord,
      service: Rope.ROPE, userName: RPC.ShortROPE] RETURNS [found: BOOL,
      instance: RPC.ShortROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← FindService];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        found (0): BOOL];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+254]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface];
      argPkt.transferIndex ← FindService;
      BEGIN  -- Marshal service: Rope.ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[service, pkt, pktLength, FALSE];
        END;  -- Marshal service.
      BEGIN  -- Marshal userName: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[userName, pkt, pktLength, TRUE];
        END;  -- Marshal userName.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 35, signalHandler: ClientDispatcher];
      pktLength ← 1;
      [found: found] ← resPkt↑;
      BEGIN  -- Unmarshal instance: RPC.ShortROPE from pkt.data[pktLength].
        [instance, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength,
            TRUE];
        END;  -- Unmarshal instance.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[found, instance];
      END;  -- UNWIND.
    END;  -- FindService.

  clientStubFindServiceWithQueueing: PUBLIC SAFE PROCEDURE [interface:
      RpcControl.InterfaceRecord, service: Rope.ROPE, userName: RPC.ShortROPE,
      version: RPC.ShortROPE, timeToWait: INT, clientMachineName: RPC.ShortROPE,
      streamPupAddress: Pup.Address, needListener: BOOL]
    RETURNS [found: ATOM, instance: RPC.ShortROPE, serverPupAddress:
        Pup.Address, errMsg: Rope.ROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← FindServiceWithQueueing,
        timeToWait (1): INT, streamPupAddress (3): Pup.Address, needListener
        (6): BOOL];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        serverPupAddress (0): Pup.Address];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+254]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 7;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface];
      argPkt↑ ← [timeToWait: timeToWait, streamPupAddress: streamPupAddress,
          needListener: needListener];
      BEGIN  -- Marshal service: Rope.ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[service, pkt, pktLength, FALSE];
        END;  -- Marshal service.
      BEGIN  -- Marshal userName: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[userName, pkt, pktLength, TRUE];
        END;  -- Marshal userName.
      BEGIN  -- Marshal version: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[version, pkt, pktLength, TRUE];
        END;  -- Marshal version.
      BEGIN  -- Marshal clientMachineName: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[clientMachineName, pkt, pktLength,
            TRUE];
        END;  -- Marshal clientMachineName.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 254, signalHandler: ClientDispatcher];
      pktLength ← 3;
      BEGIN  -- OnePkt.
        -- Move statics from pkt now.
        [serverPupAddress: serverPupAddress] ← resPkt↑;
      BEGIN  -- Unmarshal found: ATOM from pkt.data[pktLength].
        [found, pktLength] ← Lupine.UnmarshalAtom[pkt, pktLength];
        END;  -- Unmarshal found.
      BEGIN  -- Unmarshal instance: RPC.ShortROPE from pkt.data[pktLength].
        [instance, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength,
            TRUE];
        END;  -- Unmarshal instance.
      BEGIN  -- Unmarshal errMsg: Rope.ROPE from pkt.data[pktLength].
        [errMsg, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength,
            FALSE];
        END;  -- Unmarshal errMsg.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RETURN[found, instance, serverPupAddress, errMsg];
      END;  -- OnePkt.
      END;  -- UNWIND.
    END;  -- FindServiceWithQueueing.

  clientStubNewStats: PUBLIC SAFE PROCEDURE [interface: RpcControl.InterfaceRecord,
      serverMachineName: RPC.ShortROPE, serverMachinePupAddress: RPC.ShortROPE,
      serverUP: BOOL, firstCall: BOOL, machineType: PrincOps.MachineType,
      mainMemory: CARDINAL, numberCPUs: CARDINAL, diskPartionSize: INT,
      freePagesOnDisk: INT, freeboard: INT, freeGFI: CARDINAL, freeMDS:
      CARDINAL, freeVM: CARDINAL, oldestLRUFileDate: BasicTime.GMT, CPULoad:
      REAL, nonBackgroundCPULoad: REAL, reclamationRate: REAL, freeProcesses:
      CARDINAL, userName: RPC.ShortROPE, currentRequests: LIST OF ComputeServer.Request,
      aveBackgroundLoad: REAL]
    RETURNS [terminateService: BOOL, newPackage: BOOL, queueingCommands:
        LIST OF Rope.ROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← NewStats, serverUP
        (1): BOOL, firstCall (2): BOOL, machineType (3): PrincOps.MachineType,
        mainMemory (4): CARDINAL, numberCPUs (5): CARDINAL, diskPartionSize
        (6): INT, freePagesOnDisk (8): INT, freeboard (10): INT, freeGFI
        (12): CARDINAL, freeMDS (13): CARDINAL, freeVM (14): CARDINAL,
        oldestLRUFileDate (15): BasicTime.GMT, CPULoad (17): REAL, nonBackgroundCPULoad
        (19): REAL, reclamationRate (21): REAL, freeProcesses (23): CARDINAL,
        aveBackgroundLoad (24): REAL];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        terminateService (0): BOOL, newPackage (1): BOOL];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+254]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 26;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface];
      argPkt↑ ← [serverUP: serverUP, firstCall: firstCall, machineType:
          machineType, mainMemory: mainMemory, numberCPUs: numberCPUs,
          diskPartionSize: diskPartionSize, freePagesOnDisk: freePagesOnDisk,
          freeboard: freeboard, freeGFI: freeGFI, freeMDS: freeMDS, freeVM:
          freeVM, oldestLRUFileDate: oldestLRUFileDate, CPULoad: CPULoad,
          nonBackgroundCPULoad: nonBackgroundCPULoad, reclamationRate:
          reclamationRate, freeProcesses: freeProcesses, aveBackgroundLoad:
          aveBackgroundLoad];
      BEGIN  -- Marshal serverMachineName: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[serverMachineName, pkt, pktLength,
            TRUE];
        END;  -- Marshal serverMachineName.
      BEGIN  -- Marshal serverMachinePupAddress: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[serverMachinePupAddress, pkt,
            pktLength, TRUE];
        END;  -- Marshal serverMachinePupAddress.
      BEGIN  -- Marshal userName: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[userName, pkt, pktLength, TRUE];
        END;  -- Marshal userName.
      BEGIN  -- Marshal currentRequests: LIST OF ComputeServer.Request
          -- to pkt.data[pktLength].
        thisNode1: LIST OF ComputeServer.Request;
        listLength: Lupine.ListHeader ← 0;
        FOR thisNode1 ← currentRequests, thisNode1.rest UNTIL thisNode1
            = NIL DO
          listLength ← listLength + 1;  ENDLOOP;
        IF pktLength+2 > RpcPrivate.maxDataLength
          THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength:
              pktLength];
        Lupine.RpcPktDoubleWord[pkt, pktLength]↑ ← listLength;
        pktLength ← pktLength + 2;
        FOR thisNode1 ← currentRequests, thisNode1.rest UNTIL thisNode1
            = NIL DO
          BEGIN  -- Marshal thisNode1.first: ComputeServer.Request
              -- to pkt.data[pktLength].
            pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
                dataAdr: @thisNode1.first, dataLength: SIZE[ComputeServer.Request],
                alwaysOnePkt: FALSE];
            BEGIN OPEN record: thisNode1.first;
            BEGIN  -- Marshal record.service: Rope.ROPE to pkt.data[pktLength].
              pktLength ← Lupine.MarshalRope[record.service, pkt, pktLength,
                  FALSE];
              END;  -- Marshal record.service.
            BEGIN  -- Marshal record.userName: RPC.ShortROPE to pkt.data[pktLength].
              pktLength ← Lupine.MarshalRope[record.userName, pkt,
                  pktLength, TRUE];
              END;  -- Marshal record.userName.
            END;  -- OPEN record: thisNode1.first.
            END;  -- Marshal thisNode1.first.
          ENDLOOP;  -- FOR thisNode1.
        END;  -- Marshal currentRequests.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 254, signalHandler: ClientDispatcher];
      pktLength ← 2;
      BEGIN  -- OnePkt.
        -- Move statics from pkt now.
        [terminateService: terminateService, newPackage: newPackage]
            ← resPkt↑;
      BEGIN  -- Unmarshal queueingCommands: LIST OF Rope.ROPE from
          -- pkt.data[pktLength].
        lastNode: LIST OF Rope.ROPE ← (queueingCommands ← NIL);
        listLength: Lupine.ListHeader;
        IF pktLength+2 > RpcPrivate.maxDataLength
          THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength:
              pktLength];
        listLength ← Lupine.RpcPktDoubleWord[pkt, pktLength]↑;
        pktLength ← pktLength + 2;
        WHILE listLength > 0 DO
          thisNode1: LIST OF Rope.ROPE = interface.paramZones.gc.CONS[--DefaultValue--,NIL];
          BEGIN  -- Unmarshal thisNode1.first: Rope.ROPE from pkt.data[pktLength].
            [thisNode1.first, pktLength] ← Lupine.UnmarshalRope[pkt,
                pktLength, FALSE];
            END;  -- Unmarshal thisNode1.first.
          IF lastNode # NIL
            THEN lastNode ← (lastNode.rest ← thisNode1)
            ELSE lastNode ← (queueingCommands ← thisNode1);
          listLength ← listLength - 1;
          ENDLOOP;  -- WHILE listLength > 0.
        END;  -- Unmarshal queueingCommands.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RETURN[terminateService, newPackage, queueingCommands];
      END;  -- OnePkt.
      END;  -- UNWIND.
    END;  -- NewStats.

  clientStubBestServerStats: PUBLIC SAFE PROCEDURE [interface: RpcControl.InterfaceRecord]RETURNS
      [instance: RPC.ShortROPE, FOM: REAL] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← BestServerStats];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        FOM (0): REAL];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+36]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+36];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface];
      argPkt.transferIndex ← BestServerStats;
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 36, signalHandler: ClientDispatcher];
      pktLength ← 2;
      [FOM: FOM] ← resPkt↑;
      BEGIN  -- Unmarshal instance: RPC.ShortROPE from pkt.data[pktLength].
        [instance, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength,
            TRUE];
        END;  -- Unmarshal instance.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+36];
      RETURN[instance, FOM];
      END;  -- UNWIND.
    END;  -- BestServerStats.

  clientStubNoticeNewPackage: PUBLIC SAFE PROCEDURE [interface: RpcControl.InterfaceRecord,
      package: RPC.ShortROPE] RETURNS [error: BOOL, tryDifferentController:
      BOOL, msg: Rope.ROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← NoticeNewPackage];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        error (0): BOOL, tryDifferentController (1): BOOL];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+254]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface];
      argPkt.transferIndex ← NoticeNewPackage;
      BEGIN  -- Marshal package: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[package, pkt, pktLength, TRUE];
        END;  -- Marshal package.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 254, signalHandler: ClientDispatcher];
      pktLength ← 2;
      BEGIN  -- OnePkt.
        -- Move statics from pkt now.
        [error: error, tryDifferentController: tryDifferentController]
            ← resPkt↑;
      BEGIN  -- Unmarshal msg: Rope.ROPE from pkt.data[pktLength].
        [msg, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE];
        END;  -- Unmarshal msg.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RETURN[error, tryDifferentController, msg];
      END;  -- OnePkt.
      END;  -- UNWIND.
    END;  -- NoticeNewPackage.

  clientStubRemoveOldPackage: PUBLIC SAFE PROCEDURE [interface: RpcControl.InterfaceRecord,
      package: RPC.ShortROPE] RETURNS [error: BOOL, tryDifferentController:
      BOOL, msg: Rope.ROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← RemoveOldPackage];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        error (0): BOOL, tryDifferentController (1): BOOL];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+254]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface];
      argPkt.transferIndex ← RemoveOldPackage;
      BEGIN  -- Marshal package: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[package, pkt, pktLength, TRUE];
        END;  -- Marshal package.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 254, signalHandler: ClientDispatcher];
      pktLength ← 2;
      BEGIN  -- OnePkt.
        -- Move statics from pkt now.
        [error: error, tryDifferentController: tryDifferentController]
            ← resPkt↑;
      BEGIN  -- Unmarshal msg: Rope.ROPE from pkt.data[pktLength].
        [msg, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE];
        END;  -- Unmarshal msg.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RETURN[error, tryDifferentController, msg];
      END;  -- OnePkt.
      END;  -- UNWIND.
    END;  -- RemoveOldPackage.

  clientStubGetSomeInfo: PUBLIC SAFE PROCEDURE [interface: RpcControl.InterfaceRecord]RETURNS
      [error: BOOL, tryDifferentController: BOOL, msg: Rope.ROPE, serverList:
      LIST OF Rope.ROPE, bestFOM: REAL] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GetSomeInfo];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        error (0): BOOL, tryDifferentController (1): BOOL, bestFOM (2):
        REAL];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+254]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface];
      argPkt.transferIndex ← GetSomeInfo;
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 254, signalHandler: ClientDispatcher];
      pktLength ← 4;
      BEGIN  -- OnePkt.
        -- Move statics from pkt now.
        [error: error, tryDifferentController: tryDifferentController,
            bestFOM: bestFOM] ← resPkt↑;
      BEGIN  -- Unmarshal msg: Rope.ROPE from pkt.data[pktLength].
        [msg, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE];
        END;  -- Unmarshal msg.
      BEGIN  -- Unmarshal serverList: LIST OF Rope.ROPE from pkt.data[pktLength].
        lastNode: LIST OF Rope.ROPE ← (serverList ← NIL);
        listLength: Lupine.ListHeader;
        IF pktLength+2 > RpcPrivate.maxDataLength
          THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength:
              pktLength];
        listLength ← Lupine.RpcPktDoubleWord[pkt, pktLength]↑;
        pktLength ← pktLength + 2;
        WHILE listLength > 0 DO
          thisNode1: LIST OF Rope.ROPE = interface.paramZones.gc.CONS[--DefaultValue--,NIL];
          BEGIN  -- Unmarshal thisNode1.first: Rope.ROPE from pkt.data[pktLength].
            [thisNode1.first, pktLength] ← Lupine.UnmarshalRope[pkt,
                pktLength, FALSE];
            END;  -- Unmarshal thisNode1.first.
          IF lastNode # NIL
            THEN lastNode ← (lastNode.rest ← thisNode1)
            ELSE lastNode ← (serverList ← thisNode1);
          listLength ← listLength - 1;
          ENDLOOP;  -- WHILE listLength > 0.
        END;  -- Unmarshal serverList.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
RETURN[error, tryDifferentController, msg, serverList, bestFOM];
      END;  -- OnePkt.
      END;  -- UNWIND.
    END;  -- GetSomeInfo.

  clientStubCommandUnavailable: PUBLIC SAFE PROCEDURE [interface: RpcControl.InterfaceRecord,
      serverMachineName: RPC.ShortROPE, commandName: Rope.ROPE, version:
      RPC.ShortROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← CommandUnavailable];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+254]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface];
      argPkt.transferIndex ← CommandUnavailable;
      BEGIN  -- Marshal serverMachineName: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[serverMachineName, pkt, pktLength,
            TRUE];
        END;  -- Marshal serverMachineName.
      BEGIN  -- Marshal commandName: Rope.ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[commandName, pkt, pktLength,
            FALSE];
        END;  -- Marshal commandName.
      BEGIN  -- Marshal version: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[version, pkt, pktLength, TRUE];
        END;  -- Marshal version.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 0, signalHandler: ClientDispatcher];
      Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[];
      END;  -- UNWIND.
    END;  -- CommandUnavailable.

  clientStubExtraCommandAvailable: PUBLIC SAFE PROCEDURE [interface:
      RpcControl.InterfaceRecord, serverMachineName: RPC.ShortROPE, commandName:
      Rope.ROPE, version: RPC.ShortROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← ExtraCommandAvailable];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+254]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface];
      argPkt.transferIndex ← ExtraCommandAvailable;
      BEGIN  -- Marshal serverMachineName: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[serverMachineName, pkt, pktLength,
            TRUE];
        END;  -- Marshal serverMachineName.
      BEGIN  -- Marshal commandName: Rope.ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[commandName, pkt, pktLength,
            FALSE];
        END;  -- Marshal commandName.
      BEGIN  -- Marshal version: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[version, pkt, pktLength, TRUE];
        END;  -- Marshal version.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 0, signalHandler: ClientDispatcher];
      Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[];
      END;  -- UNWIND.
    END;  -- ExtraCommandAvailable.

  clientStubMightAcceptQueuedCommand: PUBLIC SAFE PROCEDURE [interface:
      RpcControl.InterfaceRecord, serverMachineAddress: RPC.ShortROPE,
      commandName: Rope.ROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← MightAcceptQueuedCommand];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+254]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface];
      argPkt.transferIndex ← MightAcceptQueuedCommand;
      BEGIN  -- Marshal serverMachineAddress: RPC.ShortROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[serverMachineAddress, pkt, pktLength,
            TRUE];
        END;  -- Marshal serverMachineAddress.
      BEGIN  -- Marshal commandName: Rope.ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[commandName, pkt, pktLength,
            FALSE];
        END;  -- Marshal commandName.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 0, signalHandler: ClientDispatcher];
      Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[];
      END;  -- UNWIND.
    END;  -- MightAcceptQueuedCommand.

  clientStubGenericToController: PUBLIC SAFE PROCEDURE [interface:
      RpcControl.InterfaceRecord, requestCode: ATOM, requestString: Rope.ROPE]
      RETURNS [resultCode: ATOM, resultString: Rope.ROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GenericToController];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+254]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface];
      argPkt.transferIndex ← GenericToController;
      BEGIN  -- Marshal requestCode: ATOM to pkt.data[pktLength].
        pktLength ← Lupine.MarshalAtom[requestCode, pkt, pktLength];
        END;  -- Marshal requestCode.
      BEGIN  -- Marshal requestString: Rope.ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[requestString, pkt, pktLength,
            FALSE];
        END;  -- Marshal requestString.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 254, signalHandler: ClientDispatcher];
      pktLength ← 0;
      BEGIN  -- Unmarshal resultCode: ATOM from pkt.data[pktLength].
        [resultCode, pktLength] ← Lupine.UnmarshalAtom[pkt, pktLength];
        END;  -- Unmarshal resultCode.
      BEGIN  -- Unmarshal resultString: Rope.ROPE from pkt.data[pktLength].
        [resultString, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength,
            FALSE];
        END;  -- Unmarshal resultString.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[resultCode, resultString];
      END;  -- UNWIND.
    END;  -- GenericToController.


--Remote public signals and errors are imported from the interface.


-- 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.


-- Marshall/Unmarshal procedures.


-- No module initialization.

END.  -- ComputeServerControllerRpcClientImpl.