-- Copyright (C) 1986 by Xerox Corporation.  All rights reserved.
-- Stub file  was translated on August 25, 1986 5:43:09 pm PDT by Lupine of February 22, 1986 5:15:54 pm PST
-- Source interface VoiceRopeServer came from file VoiceRopeServer.bcd, which was created on August 25, 1986 4:34:28 pm PDT with version stamp 54#122#37523225122 from source of August 25, 1986 4:34:23 pm PDT.

-- The RPC stub modules for VoiceRopeServer are:
--   VoiceRopeServerRpcControl.mesa;
--   VoiceRopeServerRpcClientImpl.mesa;
--   VoiceRopeServerRpcBinderImpl.mesa;
--   VoiceRopeServerRpcServerImpl.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,
  Thrush,
  VoiceRopeServer,
  VoiceRopeServerRpcControl 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]--;


VoiceRopeServerRpcServerImpl: MONITOR
  IMPORTS VoiceRopeServer, RpcPrivate: RPCLupine, Lupine: LupineRuntime,
      Atom, Rope
  EXPORTS VoiceRopeServerRpcControl
  SHARES  VoiceRopeServer, VoiceRopeServerRpcControl, Rope
  = BEGIN OPEN VoiceRopeServer, RpcControl: VoiceRopeServerRpcControl,
      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 "VoiceRopeServer~54#122#37523225122",
        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

      END;  -- Catch public signals.


    -- Call public procedures (still in dispatcher).

    SELECT LOOPHOLE[pkt.data[0], RpcControl.ProcedureIndex] FROM
      Record => RETURN[
        RecordStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      Play => RETURN[
        PlayStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      Stop => RETURN[
        StopStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      Retain => RETURN[
        RetainStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      Forget => RETURN[
        ForgetStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      GetByInterest => RETURN[
        GetByInterestStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      Cat => RETURN[
        CatStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      Substr => RETURN[
        SubstrStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      Replace => RETURN[
        ReplaceStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      Length => RETURN[
        LengthStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
            localConversation: localConversation]];
      DescribeRope => RETURN[
        DescribeRopeStub[pkt: pkt, callLength: callLength, lastPkt:
            lastPkt, localConversation: localConversation]];
      ENDCASE => RETURN[Lupine.DispatchingError[]];

    END;  -- ServerDispatcher


-- Public procedure dispatcher stubs.

  RecordStub: --PROCEDURE [shhh: Thrush.SHHH, credentials: Thrush.Credentials,
      -- serviceID: RefID.ID, intID: CARD, queueIt: BOOL]
    -- RETURNS [nb: Thrush.NB, voiceRope: VoiceRope]-- RpcPrivate.Dispatcher
        =
    INLINE BEGIN
    nb: Thrush.NB;
    voiceRope: VoiceRope;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, credentials (1):
        Thrush.Credentials, serviceID (9): RefID.ID, intID (11): CARD,
        queueIt (13): BOOL];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 14;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [nb, voiceRope] ←
      Record[localConversation, argPkt.credentials, argPkt.serviceID,
          argPkt.intID, argPkt.queueIt];
    pktLength ← 0;
    BEGIN  -- Marshal nb: Thrush.NB to pkt.data[pktLength].
      pktLength ← Lupine.MarshalAtom[nb, pkt, pktLength];
      END;  -- Marshal nb.
    BEGIN  -- Marshal voiceRope: VoiceRope to pkt.data[pktLength].
      pktLength ← MarshalVoiceRope[voiceRope, pkt, pktLength];
      END;  -- Marshal voiceRope.
    RETURN[returnLength: pktLength];
    END;  -- RecordStub.

  PlayStub: --PROCEDURE [shhh: Thrush.SHHH, voiceRope: VoiceRope, credentials:
      -- Thrush.Credentials, serviceID: RefID.ID, intID: CARD, queueIt:
      -- BOOL]
    -- RETURNS [nb: Thrush.NB]-- RpcPrivate.Dispatcher =
    INLINE BEGIN
    voiceRope: VoiceRope;
    credentials: Thrush.Credentials;
    serviceID: RefID.ID;
    intID: CARD;
    queueIt: BOOL;
    nb: Thrush.NB;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, credentials (1):
        Thrush.Credentials, serviceID (9): RefID.ID, intID (11): CARD,
        queueIt (13): BOOL];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 14;
    BEGIN  -- OnePkt.
    onePkt: BOOLEAN = lastPkt;
    IF ~onePkt THEN BEGIN  -- Must move statics from pkt now.
      [credentials: credentials, serviceID: serviceID, intID: intID,
          queueIt: queueIt] ← argPkt↑;
      END;
    BEGIN  -- Unmarshal voiceRope: VoiceRope from pkt.data[pktLength].
      [voiceRope, pktLength] ← UnmarshalVoiceRope[pkt, pktLength];
      END;  -- Unmarshal voiceRope.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    IF onePkt
      THEN [nb] ← Play[localConversation, voiceRope, argPkt.credentials,
          argPkt.serviceID, argPkt.intID, argPkt.queueIt]
      ELSE [nb] ← Play[localConversation, voiceRope, credentials, serviceID,
          intID, queueIt];
    END;  -- OnePkt.
    pktLength ← 0;
    BEGIN  -- Marshal nb: Thrush.NB to pkt.data[pktLength].
      pktLength ← Lupine.MarshalAtom[nb, pkt, pktLength];
      END;  -- Marshal nb.
    RETURN[returnLength: pktLength];
    END;  -- PlayStub.

  StopStub: --PROCEDURE [shhh: Thrush.SHHH, credentials: Thrush.Credentials,
      -- serviceID: RefID.ID]
    -- RETURNS [nb: Thrush.NB]-- RpcPrivate.Dispatcher =
    INLINE BEGIN
    nb: Thrush.NB;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, credentials (1):
        Thrush.Credentials, serviceID (9): RefID.ID];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 11;
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [nb] ← Stop[localConversation, argPkt.credentials, argPkt.serviceID];
    pktLength ← 0;
    BEGIN  -- Marshal nb: Thrush.NB to pkt.data[pktLength].
      pktLength ← Lupine.MarshalAtom[nb, pkt, pktLength];
      END;  -- Marshal nb.
    RETURN[returnLength: pktLength];
    END;  -- StopStub.

  RetainStub: --PROCEDURE [shhh: Thrush.SHHH, vr: VoiceRope, class:
      -- InterestClass, refID: Rope.ROPE, other: Rope.ROPE]
    -- RETURNS [nb: Thrush.NB]-- RpcPrivate.Dispatcher =
    INLINE BEGIN
    vr: VoiceRope;
    class: InterestClass;
    refID: Rope.ROPE;
    other: Rope.ROPE;
    nb: Thrush.NB;
    pktLength: RpcPrivate.DataLength ← 1;
    BEGIN  -- Unmarshal vr: VoiceRope from pkt.data[pktLength].
      [vr, pktLength] ← UnmarshalVoiceRope[pkt, pktLength];
      END;  -- Unmarshal vr.
    BEGIN  -- Unmarshal class: InterestClass from pkt.data[pktLength].
      [class, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE];
      END;  -- Unmarshal class.
    BEGIN  -- Unmarshal refID: Rope.ROPE from pkt.data[pktLength].
      [refID, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE];
      END;  -- Unmarshal refID.
    BEGIN  -- Unmarshal other: Rope.ROPE from pkt.data[pktLength].
      [other, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE];
      END;  -- Unmarshal other.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [nb] ← Retain[localConversation, vr, class, refID, other];
    pktLength ← 0;
    BEGIN  -- Marshal nb: Thrush.NB to pkt.data[pktLength].
      pktLength ← Lupine.MarshalAtom[nb, pkt, pktLength];
      END;  -- Marshal nb.
    RETURN[returnLength: pktLength];
    END;  -- RetainStub.

  ForgetStub: --PROCEDURE [shhh: Thrush.SHHH, vr: VoiceRope, class:
      -- InterestClass, refID: Rope.ROPE]
    -- RETURNS [nb: Thrush.NB]-- RpcPrivate.Dispatcher =
    INLINE BEGIN
    vr: VoiceRope;
    class: InterestClass;
    refID: Rope.ROPE;
    nb: Thrush.NB;
    pktLength: RpcPrivate.DataLength ← 1;
    BEGIN  -- Unmarshal vr: VoiceRope from pkt.data[pktLength].
      [vr, pktLength] ← UnmarshalVoiceRope[pkt, pktLength];
      END;  -- Unmarshal vr.
    BEGIN  -- Unmarshal class: InterestClass from pkt.data[pktLength].
      [class, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE];
      END;  -- Unmarshal class.
    BEGIN  -- Unmarshal refID: Rope.ROPE from pkt.data[pktLength].
      [refID, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE];
      END;  -- Unmarshal refID.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [nb] ← Forget[localConversation, vr, class, refID];
    pktLength ← 0;
    BEGIN  -- Marshal nb: Thrush.NB to pkt.data[pktLength].
      pktLength ← Lupine.MarshalAtom[nb, pkt, pktLength];
      END;  -- Marshal nb.
    RETURN[returnLength: pktLength];
    END;  -- ForgetStub.

  GetByInterestStub: --PROCEDURE [shhh: Thrush.SHHH, class: InterestClass,
      -- refID: Rope.ROPE]
    -- RETURNS [nb: Thrush.NB, voiceRope: VoiceRope]-- RpcPrivate.Dispatcher
        =
    INLINE BEGIN
    class: InterestClass;
    refID: Rope.ROPE;
    nb: Thrush.NB;
    voiceRope: VoiceRope;
    pktLength: RpcPrivate.DataLength ← 1;
    BEGIN  -- Unmarshal class: InterestClass from pkt.data[pktLength].
      [class, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE];
      END;  -- Unmarshal class.
    BEGIN  -- Unmarshal refID: Rope.ROPE from pkt.data[pktLength].
      [refID, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE];
      END;  -- Unmarshal refID.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [nb, voiceRope] ←
      GetByInterest[localConversation, class, refID];
    pktLength ← 0;
    BEGIN  -- Marshal nb: Thrush.NB to pkt.data[pktLength].
      pktLength ← Lupine.MarshalAtom[nb, pkt, pktLength];
      END;  -- Marshal nb.
    BEGIN  -- Marshal voiceRope: VoiceRope to pkt.data[pktLength].
      pktLength ← MarshalVoiceRope[voiceRope, pkt, pktLength];
      END;  -- Marshal voiceRope.
    RETURN[returnLength: pktLength];
    END;  -- GetByInterestStub.

  CatStub: --PROCEDURE [shhh: Thrush.SHHH, vr1: VoiceRope, vr2: VoiceRope,
      -- vr3: VoiceRope, vr4: VoiceRope, vr5: VoiceRope]
    -- RETURNS [nb: Thrush.NB, new: VoiceRope]-- RpcPrivate.Dispatcher
        =
    INLINE BEGIN
    vr1: VoiceRope;
    vr2: VoiceRope;
    vr3: VoiceRope;
    vr4: VoiceRope;
    vr5: VoiceRope;
    nb: Thrush.NB;
    new: VoiceRope;
    pktLength: RpcPrivate.DataLength ← 1;
    BEGIN  -- Unmarshal vr1: VoiceRope from pkt.data[pktLength].
      [vr1, pktLength] ← UnmarshalVoiceRope[pkt, pktLength];
      END;  -- Unmarshal vr1.
    BEGIN  -- Unmarshal vr2: VoiceRope from pkt.data[pktLength].
      [vr2, pktLength] ← UnmarshalVoiceRope[pkt, pktLength];
      END;  -- Unmarshal vr2.
    BEGIN  -- Unmarshal vr3: VoiceRope from pkt.data[pktLength].
      [vr3, pktLength] ← UnmarshalVoiceRope[pkt, pktLength];
      END;  -- Unmarshal vr3.
    BEGIN  -- Unmarshal vr4: VoiceRope from pkt.data[pktLength].
      [vr4, pktLength] ← UnmarshalVoiceRope[pkt, pktLength];
      END;  -- Unmarshal vr4.
    BEGIN  -- Unmarshal vr5: VoiceRope from pkt.data[pktLength].
      [vr5, pktLength] ← UnmarshalVoiceRope[pkt, pktLength];
      END;  -- Unmarshal vr5.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    [nb, new] ←
      Cat[localConversation, vr1, vr2, vr3, vr4, vr5];
    pktLength ← 0;
    BEGIN  -- Marshal nb: Thrush.NB to pkt.data[pktLength].
      pktLength ← Lupine.MarshalAtom[nb, pkt, pktLength];
      END;  -- Marshal nb.
    BEGIN  -- Marshal new: VoiceRope to pkt.data[pktLength].
      pktLength ← MarshalVoiceRope[new, pkt, pktLength];
      END;  -- Marshal new.
    RETURN[returnLength: pktLength];
    END;  -- CatStub.

  SubstrStub: --PROCEDURE [shhh: Thrush.SHHH, vr: VoiceRope, start:
      -- INT, len: INT]
    -- RETURNS [nb: Thrush.NB, new: VoiceRope]-- RpcPrivate.Dispatcher
        =
    INLINE BEGIN
    vr: VoiceRope;
    start: INT;
    len: INT;
    nb: Thrush.NB;
    new: VoiceRope;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, start (1): INT, len
        (3): INT];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 5;
    BEGIN  -- OnePkt.
    onePkt: BOOLEAN = lastPkt;
    IF ~onePkt THEN BEGIN  -- Must move statics from pkt now.
      [start: start, len: len] ← argPkt↑;
      END;
    BEGIN  -- Unmarshal vr: VoiceRope from pkt.data[pktLength].
      [vr, pktLength] ← UnmarshalVoiceRope[pkt, pktLength];
      END;  -- Unmarshal vr.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    IF onePkt
      THEN [nb, new] ←
          Substr[localConversation, vr, argPkt.start, argPkt.len]
      ELSE [nb, new] ←
          Substr[localConversation, vr, start, len];
    END;  -- OnePkt.
    pktLength ← 0;
    BEGIN  -- Marshal nb: Thrush.NB to pkt.data[pktLength].
      pktLength ← Lupine.MarshalAtom[nb, pkt, pktLength];
      END;  -- Marshal nb.
    BEGIN  -- Marshal new: VoiceRope to pkt.data[pktLength].
      pktLength ← MarshalVoiceRope[new, pkt, pktLength];
      END;  -- Marshal new.
    RETURN[returnLength: pktLength];
    END;  -- SubstrStub.

  ReplaceStub: --PROCEDURE [shhh: Thrush.SHHH, vr: VoiceRope, start:
      -- INT, len: INT, with: VoiceRope]
    -- RETURNS [nb: Thrush.NB, new: VoiceRope]-- RpcPrivate.Dispatcher
        =
    INLINE BEGIN
    vr: VoiceRope;
    start: INT;
    len: INT;
    with: VoiceRope;
    nb: Thrush.NB;
    new: VoiceRope;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, start (1): INT, len
        (3): INT];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 5;
    BEGIN  -- OnePkt.
    onePkt: BOOLEAN = lastPkt;
    IF ~onePkt THEN BEGIN  -- Must move statics from pkt now.
      [start: start, len: len] ← argPkt↑;
      END;
    BEGIN  -- Unmarshal vr: VoiceRope from pkt.data[pktLength].
      [vr, pktLength] ← UnmarshalVoiceRope[pkt, pktLength];
      END;  -- Unmarshal vr.
    BEGIN  -- Unmarshal with: VoiceRope from pkt.data[pktLength].
      [with, pktLength] ← UnmarshalVoiceRope[pkt, pktLength];
      END;  -- Unmarshal with.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    IF onePkt
      THEN [nb, new] ←
          Replace[localConversation, vr, argPkt.start, argPkt.len,
              with]
      ELSE [nb, new] ←
          Replace[localConversation, vr, start, len, with];
    END;  -- OnePkt.
    pktLength ← 0;
    BEGIN  -- Marshal nb: Thrush.NB to pkt.data[pktLength].
      pktLength ← Lupine.MarshalAtom[nb, pkt, pktLength];
      END;  -- Marshal nb.
    BEGIN  -- Marshal new: VoiceRope to pkt.data[pktLength].
      pktLength ← MarshalVoiceRope[new, pkt, pktLength];
      END;  -- Marshal new.
    RETURN[returnLength: pktLength];
    END;  -- ReplaceStub.

  LengthStub: --PROCEDURE [shhh: Thrush.SHHH, vr: VoiceRope] RETURNS
      -- [nb: Thrush.NB, len: INT]-- RpcPrivate.Dispatcher =
    INLINE BEGIN
    vr: VoiceRope;
    nb: Thrush.NB;
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        len (0): INT];
    resPkt: LONG POINTER TO ResultOverlay;
    pktLength: RpcPrivate.DataLength ← 1;
    BEGIN  -- Unmarshal vr: VoiceRope from pkt.data[pktLength].
      [vr, pktLength] ← UnmarshalVoiceRope[pkt, pktLength];
      END;  -- Unmarshal vr.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    resPkt ← @pkt.data[0];
    [nb, resPkt.len] ←
      Length[localConversation, vr];
    pktLength ← 2;
    BEGIN  -- Marshal nb: Thrush.NB to pkt.data[pktLength].
      pktLength ← Lupine.MarshalAtom[nb, pkt, pktLength];
      END;  -- Marshal nb.
    RETURN[returnLength: pktLength];
    END;  -- LengthStub.

  DescribeRopeStub: --PROCEDURE [shhh: Thrush.SHHH, vr: VoiceRope,
      -- minSilence: INT]
    -- RETURNS [nb: Thrush.NB, length: INT, noise: IntervalSpecs]--
        RpcPrivate.Dispatcher =
    INLINE BEGIN
    vr: VoiceRope;
    minSilence: INT;
    nb: Thrush.NB;
    noise: IntervalSpecs;
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex, minSilence (1): INT];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        length (0): INT];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: LONG POINTER TO ResultOverlay;
    pktLength: RpcPrivate.DataLength ← 3;
    BEGIN  -- OnePkt.
    onePkt: BOOLEAN = lastPkt;
    IF ~onePkt THEN BEGIN  -- Must move statics from pkt now.
      [minSilence: minSilence] ← argPkt↑;
      END;
    BEGIN  -- Unmarshal vr: VoiceRope from pkt.data[pktLength].
      [vr, pktLength] ← UnmarshalVoiceRope[pkt, pktLength];
      END;  -- Unmarshal vr.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    resPkt ← @pkt.data[0];
    IF onePkt
      THEN [nb, resPkt.length, noise] ←
          DescribeRope[localConversation, vr, argPkt.minSilence]
      ELSE [nb, resPkt.length, noise] ←
          DescribeRope[localConversation, vr, minSilence];
    END;  -- OnePkt.
    pktLength ← 2;
    BEGIN  -- Marshal nb: Thrush.NB to pkt.data[pktLength].
      pktLength ← Lupine.MarshalAtom[nb, pkt, pktLength];
      END;  -- Marshal nb.
    BEGIN  -- Marshal noise: IntervalSpecs to pkt.data[pktLength].
      thisNode1: IntervalSpecs;
      listLength: Lupine.ListHeader ← 0;
      FOR thisNode1 ← noise, 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 ← noise, thisNode1.rest UNTIL thisNode1 = NIL DO
        BEGIN  -- Marshal thisNode1.first: Interval to pkt.data[pktLength].
          pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
              dataAdr: @thisNode1.first, dataLength: SIZE[Interval], alwaysOnePkt:
              FALSE];
          END;  -- Marshal thisNode1.first.
        ENDLOOP;  -- FOR thisNode1.
      END;  -- Marshal noise.
    RETURN[returnLength: pktLength];
    END;  -- DescribeRopeStub.


-- Marshall/Unmarshal procedures.
UnmarshalVoiceRope: PROC[pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength]
  RETURNS[value: VoiceRopeServer.VoiceRope, pktLength: RpcPrivate.DataLength]
      = BEGIN
  pktLength ← pktLength0; {
  isNIL: Lupine.NilHeader;
  IF pktLength+1 > RpcPrivate.maxDataLength
    THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength];
  isNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
  IF isNIL
    THEN value ← NIL
    ELSE BEGIN
      value ← (paramZones.gc.NEW[VoiceRopeServer.VoiceRopeInterval]);
      BEGIN  -- Unmarshal value↑: VoiceRopeServer.VoiceRopeInterval
          -- from pkt.data[pktLength].
        pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
            dataAdr: LOOPHOLE[value], dataLength: SIZE[VoiceRopeServer.VoiceRopeInterval],
            alwaysOnePkt: FALSE];
        -- Restore garbled REFs to NIL following copy.
        BEGIN OPEN record: value↑;
        LOOPHOLE[record.ropeID, LONG POINTER] ← NIL;
        END;  -- OPEN record: value↑.
        BEGIN OPEN record: value↑;
        BEGIN  -- Unmarshal record.ropeID: Rope.ROPE from pkt.data[pktLength].
          [record.ropeID, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength,
              FALSE];
          END;  -- Unmarshal record.ropeID.
        END;  -- OPEN record: value↑.
        END;  -- Unmarshal value↑.
      END;  -- IF isNIL.
  };END;

MarshalVoiceRope: PROC[value: VoiceRopeServer.VoiceRope, pkt: RpcPrivate.RPCPkt,
    pktLength0: RpcPrivate.DataLength]
  RETURNS[pktLength: RpcPrivate.DataLength] = BEGIN
  pktLength ← pktLength0; {
  IF pktLength+1 > RpcPrivate.maxDataLength
    THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength];
  pkt.data[pktLength] ← value=NIL;  pktLength ← pktLength+1;
  IF value # NIL THEN
    BEGIN  -- Marshal value↑: VoiceRopeServer.VoiceRopeInterval to
        -- pkt.data[pktLength].
      pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
          dataAdr: LOOPHOLE[value], dataLength: SIZE[VoiceRopeServer.VoiceRopeInterval],
          alwaysOnePkt: FALSE];
      BEGIN OPEN record: value↑;
      BEGIN  -- Marshal record.ropeID: Rope.ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[record.ropeID, pkt, pktLength,
            FALSE];
        END;  -- Marshal record.ropeID.
      END;  -- OPEN record: value↑.
      END;  -- Marshal value↑.
  };END;



-- No module initialization.

END.  -- VoiceRopeServerRpcServerImpl.