-- Copyright (C) 1987 by Xerox Corporation.  All rights reserved.
-- Stub file  was translated on February 4, 1987 10:47:04 pm PST by Lupine of February 22, 1986 5:15:54 pm PST
-- Source interface SynthesizerServer came from file SynthesizerServer.bcd, which was created on February 4, 1987 10:46:05 pm PST with version stamp 130#262#12070567032 from source of October 24, 1986 5:53:45 pm PDT.

-- The RPC stub modules for SynthesizerServer are:
--   SynthesizerServerRpcControl.mesa;
--   SynthesizerServerRpcClientImpl.mesa;
--   SynthesizerServerRpcBinderImpl.mesa;
--   SynthesizerServerRpcServerImpl.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
  RefID,
  Rope,
  Synthesizer,
  Thrush,
  SynthesizerServer,
  SynthesizerServerRpcControl USING [InterfaceRecord, InterMdsCallsOnly,
      LupineProtocolVersion, ProcedureIndex, SignalIndex],
  RPC --USING SOME OF [InterfaceName, standardZones, Zones]--,
  RPCLupine --USING SOME OF [Alloc, Call, DataLength, DeAlloc, Dispatcher,
      -- GetPkt, GetStubPkt, ImportHandle, ImportInterface, maxDataLength,
      -- maxPrincipalLength, maxShortStringLength, pktOverhead, ReceiveExtraPkt,
      -- SendPrelimPkt, StartCall, StartSignal, StubPkt, UnimportInterface]--,
  RPCLupineExtras --USING SOME OF [ImportInterfaceWithHost, noHost,
      -- RPCHost]--,
  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]--;


SynthesizerServerRpcClientImpl: MONITOR
  IMPORTS RpcPrivate: RPCLupine, RpcPrivateExtras: RPCLupineExtras,
      Lupine: LupineRuntime, Atom, PrincOpsUtils, Rope
  EXPORTS SynthesizerServerRpcControl
  SHARES  SynthesizerServer, SynthesizerServerRpcControl, Rope
  = BEGIN OPEN SynthesizerServer, RpcControl: SynthesizerServerRpcControl,
      RpcPublic: RPC;


-- Standard remote binding routines.


  ImportInterface: PUBLIC ENTRY SAFE PROCEDURE [
        interface: RpcControl.InterfaceRecord,
        interfaceName: RpcPublic.InterfaceName,
        parameterStorage: RpcPublic.Zones,
        hostHint: RpcPrivateExtras.RPCHost←RpcPrivateExtras.noHost
            ] =
    TRUSTED BEGIN ENABLE UNWIND => NULL;
    IsNull: PROCEDURE [string: Rope.ROPE] RETURNS [BOOLEAN] =
      INLINE {RETURN[string.Length[] = 0]};
        interface↑ ← [clientStubTextToSpeech: clientStubTextToSpeech,
            clientStubStopSpeech: clientStubStopSpeech, clientStubGetSynthesizerSpecifications:
            clientStubGetSynthesizerSpecifications];
    interface.myInterface ← RpcPrivateExtras.ImportInterfaceWithHost
        [
      interface: [
        type: IF ~IsNull[interfaceName.type]
          THEN interfaceName.type ELSE "SynthesizerServer~130#262#12070567032",
        instance: interfaceName.instance,
        version: interfaceName.version ],
      localOnly: RpcControl.InterMdsCallsOnly,
      stubProtocol: RpcControl.LupineProtocolVersion,
      hostHint: hostHint ];
    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.

  clientStubTextToSpeech: PUBLIC SAFE PROCEDURE [interface: RpcControl.InterfaceRecord,
      shhh: Thrush.SHHH, credentials: Thrush.Credentials, serviceID: RefID.ID,
      textToSpeak: Rope.ROPE, actionID: Synthesizer.ActionID, filter: BOOL,
      queueIt: BOOL]
    RETURNS [nb: Thrush.NB] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← TextToSpeech, credentials
        (1): Thrush.Credentials, serviceID (9): RefID.ID, actionID (11):
        Synthesizer.ActionID, filter (13): BOOL, queueIt (14): BOOL];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+254]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 15;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface,
          localConversation: shhh];
      argPkt↑ ← [credentials: credentials, serviceID: serviceID, actionID:
          actionID, filter: filter, queueIt: queueIt];
      BEGIN  -- Marshal textToSpeak: Rope.ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[textToSpeak, pkt, pktLength,
            FALSE];
        END;  -- Marshal textToSpeak.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 254, signalHandler: ClientDispatcher];
      pktLength ← 0;
      BEGIN  -- Unmarshal nb: Thrush.NB from pkt.data[pktLength].
        [nb, pktLength] ← Lupine.UnmarshalAtom[pkt, pktLength];
        END;  -- Unmarshal nb.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[nb];
      END;  -- UNWIND.
    END;  -- TextToSpeech.

  clientStubStopSpeech: PUBLIC SAFE PROCEDURE [interface: RpcControl.InterfaceRecord,
      shhh: Thrush.SHHH, credentials: Thrush.Credentials, serviceID: RefID.ID,
      reset: BOOL]
    RETURNS [nb: Thrush.NB] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← StopSpeech, credentials
        (1): Thrush.Credentials, serviceID (9): RefID.ID, reset (11): BOOL];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+254]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 12;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface,
          localConversation: shhh];
      argPkt↑ ← [credentials: credentials, serviceID: serviceID, reset:
          reset];
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 254, signalHandler: ClientDispatcher];
      pktLength ← 0;
      BEGIN  -- Unmarshal nb: Thrush.NB from pkt.data[pktLength].
        [nb, pktLength] ← Lupine.UnmarshalAtom[pkt, pktLength];
        END;  -- Unmarshal nb.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[nb];
      END;  -- UNWIND.
    END;  -- StopSpeech.

  clientStubGetSynthesizerSpecifications: PUBLIC SAFE PROCEDURE [interface:
      RpcControl.InterfaceRecord, shhh: Thrush.SHHH, serviceID: RefID.ID]
      RETURNS [nb: Thrush.NB, synthesizerModel: ATOM, synthesizerVersion:
      ATOM] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GetSynthesizerSpecifications,
        serviceID (1): RefID.ID];
    pkt: RpcPrivate.RPCPkt = RpcPrivate.GetPkt[space: RpcPrivate.Alloc[RpcPrivate.pktOverhead+254]];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: interface.myInterface,
          localConversation: shhh];
      argPkt↑ ← [serviceID: serviceID];
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 254, signalHandler: ClientDispatcher];
      pktLength ← 0;
      BEGIN  -- Unmarshal nb: Thrush.NB from pkt.data[pktLength].
        [nb, pktLength] ← Lupine.UnmarshalAtom[pkt, pktLength];
        END;  -- Unmarshal nb.
      BEGIN  -- Unmarshal synthesizerModel: ATOM from pkt.data[pktLength].
        [synthesizerModel, pktLength] ← Lupine.UnmarshalAtom[pkt, pktLength];
        END;  -- Unmarshal synthesizerModel.
      BEGIN  -- Unmarshal synthesizerVersion: ATOM from pkt.data[pktLength].
        [synthesizerVersion, pktLength] ← Lupine.UnmarshalAtom[pkt,
            pktLength];
        END;  -- Unmarshal synthesizerVersion.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[nb, synthesizerModel, synthesizerVersion];
      END;  -- UNWIND.
    END;  -- GetSynthesizerSpecifications.


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


-- Marshall/Unmarshal procedures.


-- No module initialization.

END.  -- SynthesizerServerRpcClientImpl.