-- Copyright (C) 1986 by Xerox Corporation.  All rights reserved.
-- Stub file  was translated on May 9, 1986 11:49:50 am PDT by Lupine of February 22, 1986 5:15:54 pm PST
-- Source interface NamesGV came from file NamesGV.bcd, which was created on May 9, 1986 11:49:40 am PDT with version stamp 102#247#2124664617 from source of April 29, 1986 6:28:22 pm PDT.

-- The RPC stub modules for NamesGV are:
--   NamesGVRpcControl.mesa;
--   NamesGVRpcClientImpl.mesa;
--   NamesGVRpcBinderImpl.mesa;
--   NamesGVRpcServerImpl.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
  GVBasics,
  Rope,
  RPC,
  VoiceUtils,
  NamesGV,
  NamesGVRpcControl 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]--,
  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]--;


NamesGVRpcClientImpl: MONITOR
  IMPORTS RpcPrivate: RPCLupine, RpcPrivateExtras: RPCLupineExtras,
      Lupine: LupineRuntime, Atom, PrincOpsUtils, Rope
  EXPORTS NamesGV, NamesGVRpcControl
  SHARES  NamesGV, NamesGVRpcControl, Rope
  = BEGIN OPEN NamesGV, RpcControl: NamesGVRpcControl, 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,
        hostHint: RpcPrivateExtras.RPCHost←RpcPrivateExtras.noHost
            ] =
    TRUSTED BEGIN ENABLE UNWIND => NULL;
    IsNull: PROCEDURE [string: Rope.ROPE] RETURNS [BOOLEAN] =
      INLINE {RETURN[string.Length[] = 0]};
        myInterface ← RpcPrivateExtras.ImportInterfaceWithHost [
      interface: [
        type: IF ~IsNull[interfaceName.type]
          THEN interfaceName.type ELSE "NamesGV~102#247#2124664617",
        instance: interfaceName.instance,
        version: interfaceName.version ],
      localOnly: RpcControl.InterMdsCallsOnly,
      stubProtocol: RpcControl.LupineProtocolVersion,
      hostHint: hostHint ];
    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.

  GVGetAttribute: PUBLIC SAFE PROCEDURE [rName: ROPE, attribute: ATOM,
      default: ROPE]
    RETURNS [value: ROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVGetAttribute];
    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: myInterface];
      argPkt.transferIndex ← GVGetAttribute;
      BEGIN  -- Marshal rName: ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[rName, pkt, pktLength, FALSE];
        END;  -- Marshal rName.
      BEGIN  -- Marshal attribute: ATOM to pkt.data[pktLength].
        pktLength ← Lupine.MarshalAtom[attribute, pkt, pktLength];
        END;  -- Marshal attribute.
      BEGIN  -- Marshal default: ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[default, pkt, pktLength, FALSE];
        END;  -- Marshal default.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 254, signalHandler: ClientDispatcher];
      pktLength ← 0;
      BEGIN  -- Unmarshal value: ROPE from pkt.data[pktLength].
        [value, pktLength] ← Lupine.UnmarshalRope[pkt, pktLength, FALSE];
        END;  -- Unmarshal value.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[value];
      END;  -- UNWIND.
    END;  -- GVGetAttribute.

  GVSetAttribute: PUBLIC SAFE PROCEDURE [rName: ROPE, attribute: ATOM,
      value: ROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVSetAttribute];
    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: myInterface];
      argPkt.transferIndex ← GVSetAttribute;
      BEGIN  -- Marshal rName: ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[rName, pkt, pktLength, FALSE];
        END;  -- Marshal rName.
      BEGIN  -- Marshal attribute: ATOM to pkt.data[pktLength].
        pktLength ← Lupine.MarshalAtom[attribute, pkt, pktLength];
        END;  -- Marshal attribute.
      BEGIN  -- Marshal value: ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[value, pkt, pktLength, FALSE];
        END;  -- Marshal value.
      [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;  -- GVSetAttribute.

  GVGetAttributeSeq: PUBLIC SAFE PROCEDURE [rName: ROPE, attribute:
      ATOM] RETURNS [value: AttributeSeq] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVGetAttributeSeq];
    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: myInterface];
      argPkt.transferIndex ← GVGetAttributeSeq;
      BEGIN  -- Marshal rName: ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[rName, pkt, pktLength, FALSE];
        END;  -- Marshal rName.
      BEGIN  -- Marshal attribute: ATOM to pkt.data[pktLength].
        pktLength ← Lupine.MarshalAtom[attribute, pkt, pktLength];
        END;  -- Marshal attribute.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 254, signalHandler: ClientDispatcher];
      pktLength ← 0;
      BEGIN  -- Unmarshal value: AttributeSeq from pkt.data[pktLength].
        [value, pktLength] ← UnmarshalAttributeSeq[pkt, pktLength];
        END;  -- Unmarshal value.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[value];
      END;  -- UNWIND.
    END;  -- GVGetAttributeSeq.

  GVSetAttributeSeq: PUBLIC SAFE PROCEDURE [rName: ROPE, attribute:
      ATOM, value: AttributeSeq] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVSetAttributeSeq];
    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: myInterface];
      argPkt.transferIndex ← GVSetAttributeSeq;
      BEGIN  -- Marshal rName: ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[rName, pkt, pktLength, FALSE];
        END;  -- Marshal rName.
      BEGIN  -- Marshal attribute: ATOM to pkt.data[pktLength].
        pktLength ← Lupine.MarshalAtom[attribute, pkt, pktLength];
        END;  -- Marshal attribute.
      BEGIN  -- Marshal value: AttributeSeq to pkt.data[pktLength].
        pktLength ← MarshalAttributeSeq[value, pkt, pktLength];
        END;  -- Marshal value.
      [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;  -- GVSetAttributeSeq.

  GVGetAttributes: PUBLIC SAFE PROCEDURE [rName: ROPE] RETURNS [value:
      AttributeSeq] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVGetAttributes];
    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: myInterface];
      argPkt.transferIndex ← GVGetAttributes;
      BEGIN  -- Marshal rName: ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[rName, pkt, pktLength, FALSE];
        END;  -- Marshal rName.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 254, signalHandler: ClientDispatcher];
      pktLength ← 0;
      BEGIN  -- Unmarshal value: AttributeSeq from pkt.data[pktLength].
        [value, pktLength] ← UnmarshalAttributeSeq[pkt, pktLength];
        END;  -- Unmarshal value.
      Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[value];
      END;  -- UNWIND.
    END;  -- GVGetAttributes.

  GVAuthenticate: PUBLIC SAFE PROCEDURE [rName: ROPE, key: RPC.EncryptionKey]
      RETURNS [authenticity: Authenticity] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVAuthenticate,
        key (1): RPC.EncryptionKey];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        authenticity (0): Authenticity];
    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 ← 5;
    lastPkt: BOOLEAN;
    BEGIN ENABLE UNWIND => RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
      argPkt↑ ← [key: key];
      BEGIN  -- Marshal rName: ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[rName, pkt, pktLength, FALSE];
        END;  -- Marshal rName.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 1, signalHandler: ClientDispatcher];
      [authenticity: authenticity] ← resPkt↑;
      Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[authenticity];
      END;  -- UNWIND.
    END;  -- GVAuthenticate.

  GVIsAuthenticated: PUBLIC SAFE PROCEDURE [rName: ROPE] RETURNS [authenticity:
      Authenticity] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVIsAuthenticated];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        authenticity (0): Authenticity];
    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: myInterface];
      argPkt.transferIndex ← GVIsAuthenticated;
      BEGIN  -- Marshal rName: ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[rName, pkt, pktLength, FALSE];
        END;  -- Marshal rName.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 1, signalHandler: ClientDispatcher];
      [authenticity: authenticity] ← resPkt↑;
      Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[authenticity];
      END;  -- UNWIND.
    END;  -- GVIsAuthenticated.

  GVUpdate: PUBLIC SAFE PROCEDURE [rName: ROPE] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVUpdate];
    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: myInterface];
      argPkt.transferIndex ← GVUpdate;
      BEGIN  -- Marshal rName: ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[rName, pkt, pktLength, FALSE];
        END;  -- Marshal rName.
      [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;  -- GVUpdate.

  GVUpdateAll: PUBLIC SAFE PROCEDURE =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVUpdateAll];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+1] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
    argPkt.transferIndex ← GVUpdateAll;
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- GVUpdateAll.

  GVWait: PUBLIC SAFE PROCEDURE =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVWait];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+1] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
    argPkt.transferIndex ← GVWait;
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- GVWait.

  GVFlushCache: PUBLIC SAFE PROCEDURE =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVFlushCache];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+1] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
    argPkt.transferIndex ← GVFlushCache;
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- GVFlushCache.

  GVSaveCache: PUBLIC SAFE PROCEDURE =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVSaveCache];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+1] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
    argPkt.transferIndex ← GVSaveCache;
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- GVSaveCache.

  GVRestoreCache: PUBLIC SAFE PROCEDURE =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVRestoreCache];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+1] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 1;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
    argPkt.transferIndex ← GVRestoreCache;
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- GVRestoreCache.

  GVHostFromInstance: PUBLIC SAFE PROCEDURE [instance: Rope.ROPE] RETURNS
      [anonP1id1788424: VoiceUtils.NetAddress] =
    TRUSTED BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← GVHostFromInstance];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        anonP1id1788424 (0): VoiceUtils.NetAddress];
    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: myInterface];
      argPkt.transferIndex ← GVHostFromInstance;
      BEGIN  -- Marshal instance: Rope.ROPE to pkt.data[pktLength].
        pktLength ← Lupine.MarshalRope[instance, pkt, pktLength, FALSE];
        END;  -- Marshal instance.
      [returnLength: , lastPkt: lastPkt] ←
        RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
            maxReturnLength: 3, signalHandler: ClientDispatcher];
      [anonP1id1788424: anonP1id1788424] ← resPkt↑;
      Lupine.CheckPktLength[pkt: pkt, pktLength: 3];
      RpcPrivate.DeAlloc[LOOPHOLE[pkt], RpcPrivate.pktOverhead+254];
      RETURN[anonP1id1788424];
      END;  -- UNWIND.
    END;  -- GVHostFromInstance.


-- 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.
UnmarshalAttributeSeq: PROC[pkt: RpcPrivate.RPCPkt, pktLength0: RpcPrivate.DataLength]
  RETURNS[value: NamesGV.AttributeSeq, pktLength: RpcPrivate.DataLength]
      = BEGIN
  pktLength ← pktLength0; {
  BEGIN  -- Unmarshal value↑: NamesGV.AttributeSeqRec from pkt.data[pktLength].
    recordIsNIL: Lupine.NilHeader;
    IF pktLength+3 > RpcPrivate.maxDataLength
      THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength: pktLength];
    recordIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
    IF recordIsNIL
      THEN value ← NIL
      ELSE BEGIN
        seqLength: Lupine.SequenceHeader;
        seqLength ← Lupine.RpcPktDoubleWord[pkt, pktLength]↑;
        pktLength ← pktLength + 2;
        value ← (paramZones.gc.NEW[NamesGV.AttributeSeqRec[Lupine.SHORT[seqLength]]]);
        pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
            dataAdr: LOOPHOLE[value], dataLength: SIZE[NamesGV.AttributeSeqRec[LENGTH[DESCRIPTOR[value↑]]]],
            alwaysOnePkt: FALSE];
        -- Restore garbled REFs to NIL following copy.
        BEGIN OPEN record: value↑;
        FOR element2: CARDINAL IN [FIRST[CARDINAL]..FIRST[CARDINAL]+LENGTH[DESCRIPTOR[record.s]])
            DO
          BEGIN OPEN record: record.s[element2];
          LOOPHOLE[record.attributeName, LONG POINTER] ← NIL;
          LOOPHOLE[record.attributeValue, LONG POINTER] ← NIL;
          END;  -- OPEN record: record.s[element2].
          ENDLOOP;  -- FOR element2.
        END;  -- OPEN record: value↑.
        BEGIN OPEN record: value↑;
        BEGIN  -- Unmarshal record.s: SEQUENCE maxLength: CARDINAL
            -- OF NamesGV.AttributeSeqValue from pkt.data[pktLength].
          -- The sequence's length was carried by its record.
          FOR element3: CARDINAL IN [FIRST[CARDINAL]..FIRST[CARDINAL]+LENGTH[DESCRIPTOR[record.s]])
              DO
            BEGIN  -- Unmarshal record.s[element3]: NamesGV.AttributeSeqValue
                -- from pkt.data[pktLength].
              BEGIN OPEN record: record.s[element3];
              BEGIN  -- Unmarshal record.attributeName: ATOM from pkt.data[pktLength].
                [record.attributeName, pktLength] ← Lupine.UnmarshalAtom[pkt,
                    pktLength];
                END;  -- Unmarshal record.attributeName.
              BEGIN  -- Unmarshal record.attributeValue: NamesGV.ROPE
                  -- from pkt.data[pktLength].
                [record.attributeValue, pktLength] ← Lupine.UnmarshalRope[pkt,
                    pktLength, FALSE];
                END;  -- Unmarshal record.attributeValue.
              END;  -- OPEN record: record.s[element3].
              END;  -- Unmarshal record.s[element3].
            ENDLOOP;  -- FOR element3.
          END;  -- Unmarshal record.s.
        END;  -- OPEN record: value↑.
        END;  -- IF recordIsNIL.
    END;  -- Unmarshal value↑.
  };END;

MarshalAttributeSeq: PROC[value: NamesGV.AttributeSeq, pkt: RpcPrivate.RPCPkt,
    pktLength0: RpcPrivate.DataLength]
  RETURNS[pktLength: RpcPrivate.DataLength] = BEGIN
  pktLength ← pktLength0; {
  BEGIN  -- Marshal value↑: NamesGV.AttributeSeqRec to pkt.data[pktLength].
    IF pktLength+3 > RpcPrivate.maxDataLength
      THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength];
    pkt.data[pktLength] ← value=NIL;  pktLength ← pktLength+1;
    IF value # NIL THEN BEGIN
      -- Record has a sequence, put its length up front.
      Lupine.RpcPktDoubleWord[pkt, pktLength]↑ ← LENGTH[DESCRIPTOR[value↑]];
      pktLength ← pktLength + 2;
      pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
          dataAdr: LOOPHOLE[value], dataLength: SIZE[NamesGV.AttributeSeqRec[LENGTH[DESCRIPTOR[value↑]]]],
          alwaysOnePkt: FALSE];
      BEGIN OPEN record: value↑;
      BEGIN  -- Marshal record.s: SEQUENCE maxLength: CARDINAL OF NamesGV.AttributeSeqValue
          -- to pkt.data[pktLength].
        -- The sequence's length was carried by its record.
        FOR element3: CARDINAL IN [FIRST[CARDINAL]..FIRST[CARDINAL]+LENGTH[DESCRIPTOR[record.s]])
            DO
          BEGIN  -- Marshal record.s[element3]: NamesGV.AttributeSeqValue
              -- to pkt.data[pktLength].
            BEGIN OPEN record: record.s[element3];
            BEGIN  -- Marshal record.attributeName: ATOM to pkt.data[pktLength].
              pktLength ← Lupine.MarshalAtom[record.attributeName,
                  pkt, pktLength];
              END;  -- Marshal record.attributeName.
            BEGIN  -- Marshal record.attributeValue: NamesGV.ROPE to
                -- pkt.data[pktLength].
              pktLength ← Lupine.MarshalRope[record.attributeValue,
                  pkt, pktLength, FALSE];
              END;  -- Marshal record.attributeValue.
            END;  -- OPEN record: record.s[element3].
            END;  -- Marshal record.s[element3].
          ENDLOOP;  -- FOR element3.
        END;  -- Marshal record.s.
      END;  -- OPEN record: value↑.
      END;  -- IF value # NIL.
    END;  -- Marshal value↑.
  };END;



-- No module initialization.

END.  -- NamesGVRpcClientImpl.