-- Stub file AlpineFileRpcClientImpl.mesa was translated on  3-May-83
    -- 12:39:10 PDT by Lupine of 18-Feb-83 11:25:52 PST.

-- Source interface AlpineFile came from file AlpineFile.bcd, which
    -- was created on  3-May-83 12:37:46 PDT with version stamp 203#142#13260474653
    -- from source of 18-Feb-83 17:40:55 PST.

-- The RPC stub modules for AlpineFile are:
    -- AlpineFileRpcControl.mesa;
    -- AlpineFileRpcClientImpl.mesa;
    -- AlpineFileRpcBinderImpl.mesa;
    -- AlpineFileRpcServerImpl.mesa.

-- The parameters for this translation are:
    -- Target language = Cedar;
    -- Default parameter passing = VALUE;
    -- Deallocate server heap arguments = TRUE;
    -- Inline RpcServerImpl dispatcher stubs = FALSE;
    -- Maximum number of dynamic heap NEWs = 50, MDS NEWs = 50;
    -- Acceptable parameter protocols = VersionRange[1,1].


DIRECTORY
  AlpineEnvironment,
  File,
  FileTypes,
  AlpineFile,
  AlpineFileRpcControl USING [InterMdsCallsOnly, LupineProtocolVersion,
      ProcedureIndex, SignalIndex],
  RPC USING [InterfaceName, standardZones, Zones],
  RPCLupine --USING SOME OF [Call, DataLength, Dispatcher, GetStubPkt,
      -- ImportHandle, ImportInterface, maxDataLength, maxPrincipalLength,
      -- maxShortStringLength, pktOverhead, ReceiveExtraPkt, SendPrelimPkt,
      -- StartCall, StartSignal, StubPkt, UnimportInterface]--,
  LupineRuntime --USING SOME OF [BindingError, CheckPktLength, CopyFromPkt,
      -- CopyFromMultiplePkts, CopyToPkt, CopyToMultiplePkts, DispatchingError,
      -- FinishThisPkt, ListHeader, MarshalingError, MarshalingExprError,
      -- NilHeader, ProtocolError, RopeHeader, RpcPktDoubleWord, RuntimeError,
      -- SequenceHeader, SHORT, StartNextPkt, StringHeader, StubPktDoubleWord,
      -- TranslationError, UnmarshalingError, UnmarshalingExprError, WordsForChars]--,
  Atom --USING SOME OF [GetPName, MakeAtom]--,
  ConvertUnsafe USING [AppendRope],
  Heap USING [systemMDSZone],
  Rope --USING SOME OF [Text]--,
  RopeInline --USING SOME OF [InlineFlatten, NewText]--,
  SafeStorage USING [GetSystemZone],
  UnsafeStorage USING [GetSystemUZone];


AlpineFileRpcClientImpl: MONITOR
  IMPORTS AlpineFile, RpcPrivate: RPCLupine, Lupine: LupineRuntime, Atom, ConvertUnsafe,
      Heap, RopeInline, SafeStorage, UnsafeStorage
  EXPORTS AlpineFile, AlpineFileRpcControl
  SHARES  AlpineFile, AlpineFileRpcControl, Rope
  = BEGIN OPEN AlpineFile, RpcControl: AlpineFileRpcControl, RpcPublic:
      RPC;


-- Standard remote binding routines.

  bound: BOOLEAN ← FALSE;
  myInterface: RpcPrivate.ImportHandle ← NULL;
  paramZones: RpcPublic.Zones ← RpcPublic.standardZones;

  ImportInterface: PUBLIC ENTRY SAFE PROCEDURE [
        interfaceName: RpcPublic.InterfaceName,
        parameterStorage: RpcPublic.Zones ] =
    TRUSTED BEGIN ENABLE UNWIND => NULL;
    IsNull: PROCEDURE [string: LONG STRING] RETURNS [BOOLEAN] =
      INLINE {RETURN[ string=NIL OR string.length=0 ]};
    IF bound THEN Lupine.BindingError;
    BEGIN
    type: STRING = [RpcPrivate.maxShortStringLength];
    instance: STRING = [RpcPrivate.maxShortStringLength];
    ConvertUnsafe.AppendRope[to: type, from: interfaceName.type];
    ConvertUnsafe.AppendRope[to: instance, from: interfaceName.instance];
    myInterface ← RpcPrivate.ImportInterface [
      interface: [
        type: IF ~IsNull[type]
          THEN type ELSE "AlpineFile~203#142#13260474653"L,
        instance: instance,
        version: interfaceName.version ],
      localOnly: RpcControl.InterMdsCallsOnly,
      stubProtocol: RpcControl.LupineProtocolVersion ];
    END;
    paramZones ← [
      gc: IF parameterStorage.gc # NIL
        THEN parameterStorage.gc ELSE SafeStorage.GetSystemZone[],
      heap: IF parameterStorage.heap # NIL
        THEN parameterStorage.heap ELSE UnsafeStorage.GetSystemUZone[],
      mds: IF parameterStorage.mds # NIL
        THEN parameterStorage.mds ELSE Heap.systemMDSZone ];
    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.

  Open: PUBLIC PROCEDURE [conversation: Conversation, transID: TransID,
      volumeID: VolumeID, fileID: FileID, access: AccessRights, lock: LockOption,
      recoveryOption: RecoveryOption, referencePattern: ReferencePattern]
    RETURNS [--openFileID:-- OpenFileID] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← Open, transID (1):
	TransID, volumeID (10): VolumeID, fileID (15): FileID, access (20):
	AccessRights, lock (21): LockOption, recoveryOption (22): RecoveryOption,
	referencePattern (23): ReferencePattern];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
	openFileID (0): OpenFileID];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+24] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 24;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [transID: transID, volumeID: volumeID, fileID: fileID,
	access: access, lock: lock, recoveryOption: recoveryOption, referencePattern:
	referencePattern];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 2, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    RETURN[resPkt.openFileID];
    END;  -- Open.

  Create: PUBLIC PROCEDURE [conversation: Conversation, transID: TransID,
      volumeID: VolOrVolGroupID, owner: OwnerName, initialSize: PageCount,
      type: File.Type, recoveryOption: RecoveryOption, referencePattern:
      ReferencePattern]
    RETURNS [--openFileID:-- OpenFileID] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← Create, transID
	(1): TransID, volumeID (10): VolOrVolGroupID, initialSize (15):
	PageCount, type (17): File.Type, recoveryOption (18): RecoveryOption,
	referencePattern (19): ReferencePattern];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
	openFileID (0): OpenFileID];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+54] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 20;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [transID: transID, volumeID: volumeID, initialSize: initialSize,
	type: type, recoveryOption: recoveryOption, referencePattern: referencePattern];
    BEGIN  -- Marshal owner: OwnerName to pkt.data[pktLength].
      pkt.data[pktLength] ← owner=NIL;  pktLength ← pktLength+1;
      IF owner # NIL
	THEN BEGIN
	  textRope: Rope.Text = RopeInline.InlineFlatten[r: owner];
	  IF textRope.length > RpcPrivate.maxShortStringLength
	    THEN Lupine.MarshalingError;
	  pkt.data[pktLength] ← textRope.length;  pktLength ← pktLength+1;
	  pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
	      dataAdr: BASE[DESCRIPTOR[textRope.text]], dataLength: Lupine.WordsForChars[textRope.length],
	      alwaysOnePkt: TRUE];
	  END;  -- IF owner # NIL.
      END;  -- Marshal owner.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 2, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    RETURN[resPkt.openFileID];
    END;  -- Create.

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

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

  GetVolumeID: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID] RETURNS [--volumeID:-- VolumeID] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← GetVolumeID, openFileID
	(1): OpenFileID];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
	volumeID (0): VolumeID];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+5] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 5, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 5];
    RETURN[resPkt.volumeID];
    END;  -- GetVolumeID.

  GetFileID: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID] RETURNS [--fileID:-- FileID] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← GetFileID, openFileID
	(1): OpenFileID];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
	fileID (0): FileID];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+5] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 5, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 5];
    RETURN[resPkt.fileID];
    END;  -- GetFileID.

  GetTransID: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID] RETURNS [--transID:-- TransID] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← GetTransID, openFileID
	(1): OpenFileID];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transID (0): TransID];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+9] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 9, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 9];
    RETURN[resPkt.transID];
    END;  -- GetTransID.

  GetAccessRights: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID] RETURNS [--access:-- AccessRights] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← GetAccessRights,
	openFileID (1): OpenFileID];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
	access (0): AccessRights];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+3] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 1, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
    RETURN[resPkt.access];
    END;  -- GetAccessRights.

  GetLockOption: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID] RETURNS [--lock:-- LockOption] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← GetLockOption, openFileID
	(1): OpenFileID];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
	lock (0): LockOption];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+3] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 1, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
    RETURN[resPkt.lock];
    END;  -- GetLockOption.

  SetLockOption: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID, lock: LockOption] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← SetLockOption, openFileID
	(1): OpenFileID, lock (3): LockOption];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+4] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 4;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID, lock: lock];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- SetLockOption.

  GetRecoveryOption: PUBLIC PROCEDURE [conversation: Conversation,
      openFileID: OpenFileID] RETURNS [--recoveryOption:-- RecoveryOption]
      =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← GetRecoveryOption,
	openFileID (1): OpenFileID];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
	recoveryOption (0): RecoveryOption];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+3] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 1, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
    RETURN[resPkt.recoveryOption];
    END;  -- GetRecoveryOption.

  GetReferencePattern: PUBLIC PROCEDURE [conversation: Conversation,
      openFileID: OpenFileID] RETURNS [--referencePattern:-- ReferencePattern]
      =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← GetReferencePattern,
	openFileID (1): OpenFileID];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
	referencePattern (0): ReferencePattern];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+3] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 3;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 1, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
    RETURN[resPkt.referencePattern];
    END;  -- GetReferencePattern.

  SetReferencePattern: PUBLIC PROCEDURE [conversation: Conversation,
      openFileID: OpenFileID, referencePattern: ReferencePattern] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← SetReferencePattern,
	openFileID (1): OpenFileID, referencePattern (3): ReferencePattern];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+4] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 4;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID, referencePattern: referencePattern];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- SetReferencePattern.

  ReadPages: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID, pageRun: PageRun, pageBuffer: RESULTPageBuffer, lock:
      LockOption] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← ReadPages, openFileID
	(1): OpenFileID, pageRun (3): PageRun, lock (6): LockOption];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+254] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 7;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID, pageRun: pageRun, lock: lock];
    BEGIN  -- Marshal pageBuffer: RESULTPageBuffer to pkt.data[pktLength].
      Lupine.StubPktDoubleWord[pkt, pktLength]↑ ← (IF BASE[pageBuffer]=NIL
	  THEN 0 ELSE LENGTH[pageBuffer]);
      pktLength ← pktLength + 2;
      IF BASE[pageBuffer] # NIL THEN
	NULL;  -- Call by result, send length only.
      END;  -- Marshal pageBuffer.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 254, signalHandler: ClientDispatcher];
    pktLength ← 0;
    BEGIN  -- Unmarshal pageBuffer: RESULTPageBuffer from pkt.data[pktLength].
      DescriptorType: TYPE = RECORD [SEQUENCE COMPUTED CARDINAL OF
	  WORD];
      descLength: Lupine.SequenceHeader;
      IF pktLength+2 > RpcPrivate.maxDataLength
	THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength:
	    pktLength];
      descLength ← Lupine.StubPktDoubleWord[pkt, pktLength]↑;
      pktLength ← pktLength + 2;
      IF descLength # (IF BASE[pageBuffer]=NIL THEN 0 ELSE LENGTH[pageBuffer])
	THEN Lupine.UnmarshalingError;
      NULL;  -- Call by var or result, use existing descriptor.
      pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
	  dataAdr: BASE[pageBuffer], dataLength: SIZE[WORD]*LENGTH[pageBuffer],
	  alwaysOnePkt: FALSE];
      END;  -- Unmarshal pageBuffer.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    RETURN[];
    END;  -- ReadPages.

  WritePages: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID, pageRun: PageRun, pageBuffer: VALUEPageBuffer, lock:
      LockOption] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← WritePages, openFileID
	(1): OpenFileID, pageRun (3): PageRun, lock (6): LockOption];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+254] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 7;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID, pageRun: pageRun, lock: lock];
    BEGIN  -- Marshal pageBuffer: VALUEPageBuffer to pkt.data[pktLength].
      IF pktLength+2 > RpcPrivate.maxDataLength
	THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength];
      Lupine.StubPktDoubleWord[pkt, pktLength]↑ ← (IF BASE[pageBuffer]=NIL
	  THEN 0 ELSE LENGTH[pageBuffer]);
      pktLength ← pktLength + 2;
      IF BASE[pageBuffer] # NIL THEN
	pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
	    dataAdr: BASE[pageBuffer], dataLength: SIZE[WORD]*LENGTH[pageBuffer],
	    alwaysOnePkt: FALSE];
      END;  -- Marshal pageBuffer.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- WritePages.

  LockPages: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID, pageRun: PageRun, lock: LockOption] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← LockPages, openFileID
	(1): OpenFileID, pageRun (3): PageRun, lock (6): LockOption];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+7] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 7;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID, pageRun: pageRun, lock: lock];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- LockPages.

  UnlockPages: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID, pageRun: PageRun] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← UnlockPages, openFileID
	(1): OpenFileID, pageRun (3): PageRun];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+6] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 6;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID, pageRun: pageRun];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- UnlockPages.

  ReadProperties: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID, desiredProperties: PropertySet, lock: LockOption]
    RETURNS [properties: LIST OF PropertyValuePair] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← ReadProperties,
	openFileID (1): OpenFileID, desiredProperties (3): PropertySet,
	lock (4): LockOption];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+254] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 5;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID, desiredProperties: desiredProperties,
	lock: lock];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 254, signalHandler: ClientDispatcher];
    pktLength ← 0;
    BEGIN  -- Unmarshal properties: LIST OF PropertyValuePair from
	-- pkt.data[pktLength].
      lastNode: LIST OF PropertyValuePair ← (properties ← NIL);
      listLength: Lupine.ListHeader;
      IF pktLength+2 > RpcPrivate.maxDataLength
	THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt, pktLength:
	    pktLength];
      listLength ← Lupine.StubPktDoubleWord[pkt, pktLength]↑;
      pktLength ← pktLength + 2;
      WHILE listLength > 0 DO
	thisNode1: LIST OF PropertyValuePair = paramZones.gc.CONS[--DefaultValue--,NIL];
	BEGIN  -- Unmarshal thisNode1.first: PropertyValuePair from
	    -- pkt.data[pktLength].
	  pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
	      dataAdr: @thisNode1.first, dataLength: SIZE[PropertyValuePair],
	      alwaysOnePkt: FALSE];
	  -- Restore garbled REFs to NIL following copy.
	  BEGIN OPEN record: thisNode1.first;
	  WITH variant: record SELECT FROM
	    modifyAccess =>
	      BEGIN OPEN record: variant;
	      LOOPHOLE[record.modifyAccess, LONG POINTER] ← NIL;
	      END;  -- OPEN record: variant.
	    owner =>
	      BEGIN OPEN record: variant;
	      LOOPHOLE[record.owner, LONG POINTER] ← NIL;
	      END;  -- OPEN record: variant.
	    readAccess =>
	      BEGIN OPEN record: variant;
	      LOOPHOLE[record.readAccess, LONG POINTER] ← NIL;
	      END;  -- OPEN record: variant.
	    stringName =>
	      BEGIN OPEN record: variant;
	      LOOPHOLE[record.stringName, LONG POINTER] ← NIL;
	      END;  -- OPEN record: variant.
	    ENDCASE => NULL;  -- WITH variant: record.
	  END;  -- OPEN record: thisNode1.first.
	  BEGIN OPEN record: thisNode1.first;
	  WITH variant: record SELECT FROM
	    modifyAccess =>
	      BEGIN  -- Unmarshal variant: RECORD [modifyAccess: AccessList]
		  -- from pkt.data[pktLength].
		BEGIN OPEN record: variant;
		BEGIN  -- Unmarshal record.modifyAccess: AccessList
		    -- from pkt.data[pktLength].
		  lastNode: AccessList ← (record.modifyAccess ← NIL);
		  listLength: Lupine.ListHeader;
		  IF pktLength+2 > RpcPrivate.maxDataLength
		    THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt,
			pktLength: pktLength];
		  listLength ← Lupine.StubPktDoubleWord[pkt, pktLength]↑;
		  pktLength ← pktLength + 2;
		  WHILE listLength > 0 DO
		    thisNode5: AccessList = paramZones.gc.CONS[--DefaultValue--,NIL];
		    BEGIN  -- Unmarshal thisNode5.first: Principal
			-- from pkt.data[pktLength].
		      ropeIsNIL: Lupine.NilHeader;
		      IF pktLength+2 > RpcPrivate.maxDataLength
			THEN pktLength ← Lupine.FinishThisPkt[pkt:
			    pkt, pktLength: pktLength];
		      ropeIsNIL ← pkt.data[pktLength];  pktLength ←
			  pktLength+1;
		      IF ropeIsNIL
			THEN thisNode5.first ← NIL
			ELSE BEGIN
			  ropeLength: Lupine.RopeHeader;
			  textRope: Rope.Text;
			  ropeLength ← pkt.data[pktLength];  pktLength
			      ← pktLength+1;
			  IF ropeLength > RpcPrivate.maxShortStringLength
			    THEN Lupine.UnmarshalingError;
			  thisNode5.first ← textRope ← RopeInline.NewText[size:
			      ropeLength];
			  pktLength ← Lupine.CopyFromPkt[pkt: pkt,
			      pktLength: pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]],
			      dataLength: Lupine.WordsForChars[ropeLength],
			      alwaysOnePkt: FALSE];
			  END;  -- IF ropeIsNIL.
		      END;  -- Unmarshal thisNode5.first.
		    IF lastNode # NIL
		      THEN lastNode ← (lastNode.rest ← thisNode5)
		      ELSE lastNode ← (record.modifyAccess ← thisNode5);
		    listLength ← listLength - 1;
		    ENDLOOP;  -- WHILE listLength > 0.
		  END;  -- Unmarshal record.modifyAccess.
		END;  -- OPEN record: variant.
		END;  -- Unmarshal variant.
	    owner =>
	      BEGIN  -- Unmarshal variant: RECORD [owner: OwnerName]
		  -- from pkt.data[pktLength].
		BEGIN OPEN record: variant;
		BEGIN  -- Unmarshal record.owner: OwnerName from pkt.data[pktLength].
		  ropeIsNIL: Lupine.NilHeader;
		  IF pktLength+2 > RpcPrivate.maxDataLength
		    THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt,
			pktLength: pktLength];
		  ropeIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
		  IF ropeIsNIL
		    THEN record.owner ← NIL
		    ELSE BEGIN
		      ropeLength: Lupine.RopeHeader;
		      textRope: Rope.Text;
		      ropeLength ← pkt.data[pktLength];  pktLength
			  ← pktLength+1;
		      IF ropeLength > RpcPrivate.maxShortStringLength
			THEN Lupine.UnmarshalingError;
		      record.owner ← textRope ← RopeInline.NewText[size:
			  ropeLength];
		      pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength:
			  pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]],
			  dataLength: Lupine.WordsForChars[ropeLength],
			  alwaysOnePkt: FALSE];
		      END;  -- IF ropeIsNIL.
		  END;  -- Unmarshal record.owner.
		END;  -- OPEN record: variant.
		END;  -- Unmarshal variant.
	    readAccess =>
	      BEGIN  -- Unmarshal variant: RECORD [readAccess: AccessList]
		  -- from pkt.data[pktLength].
		BEGIN OPEN record: variant;
		BEGIN  -- Unmarshal record.readAccess: AccessList from
		    -- pkt.data[pktLength].
		  lastNode: AccessList ← (record.readAccess ← NIL);
		  listLength: Lupine.ListHeader;
		  IF pktLength+2 > RpcPrivate.maxDataLength
		    THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt,
			pktLength: pktLength];
		  listLength ← Lupine.StubPktDoubleWord[pkt, pktLength]↑;
		  pktLength ← pktLength + 2;
		  WHILE listLength > 0 DO
		    thisNode5: AccessList = paramZones.gc.CONS[--DefaultValue--,NIL];
		    BEGIN  -- Unmarshal thisNode5.first: Principal
			-- from pkt.data[pktLength].
		      ropeIsNIL: Lupine.NilHeader;
		      IF pktLength+2 > RpcPrivate.maxDataLength
			THEN pktLength ← Lupine.FinishThisPkt[pkt:
			    pkt, pktLength: pktLength];
		      ropeIsNIL ← pkt.data[pktLength];  pktLength ←
			  pktLength+1;
		      IF ropeIsNIL
			THEN thisNode5.first ← NIL
			ELSE BEGIN
			  ropeLength: Lupine.RopeHeader;
			  textRope: Rope.Text;
			  ropeLength ← pkt.data[pktLength];  pktLength
			      ← pktLength+1;
			  IF ropeLength > RpcPrivate.maxShortStringLength
			    THEN Lupine.UnmarshalingError;
			  thisNode5.first ← textRope ← RopeInline.NewText[size:
			      ropeLength];
			  pktLength ← Lupine.CopyFromPkt[pkt: pkt,
			      pktLength: pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]],
			      dataLength: Lupine.WordsForChars[ropeLength],
			      alwaysOnePkt: FALSE];
			  END;  -- IF ropeIsNIL.
		      END;  -- Unmarshal thisNode5.first.
		    IF lastNode # NIL
		      THEN lastNode ← (lastNode.rest ← thisNode5)
		      ELSE lastNode ← (record.readAccess ← thisNode5);
		    listLength ← listLength - 1;
		    ENDLOOP;  -- WHILE listLength > 0.
		  END;  -- Unmarshal record.readAccess.
		END;  -- OPEN record: variant.
		END;  -- Unmarshal variant.
	    stringName =>
	      BEGIN  -- Unmarshal variant: RECORD [stringName: String]
		  -- from pkt.data[pktLength].
		BEGIN OPEN record: variant;
		BEGIN  -- Unmarshal record.stringName: String from
		    -- pkt.data[pktLength].
		  ropeIsNIL: Lupine.NilHeader;
		  IF pktLength+2 > RpcPrivate.maxDataLength
		    THEN pktLength ← Lupine.FinishThisPkt[pkt: pkt,
			pktLength: pktLength];
		  ropeIsNIL ← pkt.data[pktLength];  pktLength ← pktLength+1;
		  IF ropeIsNIL
		    THEN record.stringName ← NIL
		    ELSE BEGIN
		      ropeLength: Lupine.RopeHeader;
		      textRope: Rope.Text;
		      ropeLength ← pkt.data[pktLength];  pktLength
			  ← pktLength+1;
		      IF ropeLength > LAST[NAT]
			THEN Lupine.UnmarshalingError;
		      record.stringName ← textRope ← RopeInline.NewText[size:
			  ropeLength];
		      pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength:
			  pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]],
			  dataLength: Lupine.WordsForChars[ropeLength],
			  alwaysOnePkt: FALSE];
		      END;  -- IF ropeIsNIL.
		  END;  -- Unmarshal record.stringName.
		END;  -- OPEN record: variant.
		END;  -- Unmarshal variant.
	    ENDCASE => NULL;  -- WITH variant: record.
	  END;  -- OPEN record: thisNode1.first.
	  END;  -- Unmarshal thisNode1.first.
	IF lastNode # NIL
	  THEN lastNode ← (lastNode.rest ← thisNode1)
	  ELSE lastNode ← (properties ← thisNode1);
	listLength ← listLength - 1;
	ENDLOOP;  -- WHILE listLength > 0.
      END;  -- Unmarshal properties.
    Lupine.CheckPktLength[pkt: pkt, pktLength: pktLength];
    RETURN[properties];
    END;  -- ReadProperties.

  WriteProperties: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID, properties: LIST OF PropertyValuePair, lock: LockOption]
      =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← WriteProperties,
	openFileID (1): OpenFileID, lock (3): LockOption];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+254] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 4;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID, lock: lock];
    BEGIN  -- Marshal properties: LIST OF PropertyValuePair to pkt.data[pktLength].
      thisNode1: LIST OF PropertyValuePair;
      listLength: Lupine.ListHeader ← 0;
      FOR thisNode1 ← properties, thisNode1.rest UNTIL thisNode1 =
	  NIL DO
	listLength ← listLength + 1;  ENDLOOP;
      IF pktLength+2 > RpcPrivate.maxDataLength
	THEN pktLength ← Lupine.StartNextPkt[pkt: pkt, pktLength: pktLength];
      Lupine.StubPktDoubleWord[pkt, pktLength]↑ ← listLength;
      pktLength ← pktLength + 2;
      FOR thisNode1 ← properties, thisNode1.rest UNTIL thisNode1 =
	  NIL DO
	BEGIN  -- Marshal thisNode1.first: PropertyValuePair to pkt.data[pktLength].
	  pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength: pktLength,
	      dataAdr: @thisNode1.first, dataLength: SIZE[PropertyValuePair],
	      alwaysOnePkt: FALSE];
	  BEGIN OPEN record: thisNode1.first;
	  WITH variant: record SELECT FROM
	    modifyAccess =>
	      BEGIN  -- Marshal variant: RECORD [modifyAccess: AccessList]
		  -- to pkt.data[pktLength].
		BEGIN OPEN record: variant;
		BEGIN  -- Marshal record.modifyAccess: AccessList to
		    -- pkt.data[pktLength].
		  thisNode5: AccessList;
		  listLength: Lupine.ListHeader ← 0;
		  FOR thisNode5 ← record.modifyAccess, thisNode5.rest
		      UNTIL thisNode5 = NIL DO
		    listLength ← listLength + 1;  ENDLOOP;
		  IF pktLength+2 > RpcPrivate.maxDataLength
		    THEN pktLength ← Lupine.StartNextPkt[pkt: pkt,
			pktLength: pktLength];
		  Lupine.StubPktDoubleWord[pkt, pktLength]↑ ← listLength;
		  pktLength ← pktLength + 2;
		  FOR thisNode5 ← record.modifyAccess, thisNode5.rest
		      UNTIL thisNode5 = NIL DO
		    BEGIN  -- Marshal thisNode5.first: Principal to
			-- pkt.data[pktLength].
		      IF pktLength+2 > RpcPrivate.maxDataLength
			THEN pktLength ← Lupine.StartNextPkt[pkt: pkt,
			    pktLength: pktLength];
		      pkt.data[pktLength] ← thisNode5.first=NIL;  pktLength
			  ← pktLength+1;
		      IF thisNode5.first # NIL
			THEN BEGIN
			  textRope: Rope.Text = RopeInline.InlineFlatten[r:
			      thisNode5.first];
			  IF textRope.length > RpcPrivate.maxShortStringLength
			    THEN Lupine.MarshalingError;
			  pkt.data[pktLength] ← textRope.length;  pktLength
			      ← pktLength+1;
			  pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength:
			      pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]],
			      dataLength: Lupine.WordsForChars[textRope.length],
			      alwaysOnePkt: FALSE];
			  END;  -- IF thisNode5.first # NIL.
		      END;  -- Marshal thisNode5.first.
		    ENDLOOP;  -- FOR thisNode5.
		  END;  -- Marshal record.modifyAccess.
		END;  -- OPEN record: variant.
		END;  -- Marshal variant.
	    owner =>
	      BEGIN  -- Marshal variant: RECORD [owner: OwnerName]
		  -- to pkt.data[pktLength].
		BEGIN OPEN record: variant;
		BEGIN  -- Marshal record.owner: OwnerName to pkt.data[pktLength].
		  IF pktLength+2 > RpcPrivate.maxDataLength
		    THEN pktLength ← Lupine.StartNextPkt[pkt: pkt,
			pktLength: pktLength];
		  pkt.data[pktLength] ← record.owner=NIL;  pktLength
		      ← pktLength+1;
		  IF record.owner # NIL
		    THEN BEGIN
		      textRope: Rope.Text = RopeInline.InlineFlatten[r:
			  record.owner];
		      IF textRope.length > RpcPrivate.maxShortStringLength
			THEN Lupine.MarshalingError;
		      pkt.data[pktLength] ← textRope.length;  pktLength
			  ← pktLength+1;
		      pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength:
			  pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]],
			  dataLength: Lupine.WordsForChars[textRope.length],
			  alwaysOnePkt: FALSE];
		      END;  -- IF record.owner # NIL.
		  END;  -- Marshal record.owner.
		END;  -- OPEN record: variant.
		END;  -- Marshal variant.
	    readAccess =>
	      BEGIN  -- Marshal variant: RECORD [readAccess: AccessList]
		  -- to pkt.data[pktLength].
		BEGIN OPEN record: variant;
		BEGIN  -- Marshal record.readAccess: AccessList to
		    -- pkt.data[pktLength].
		  thisNode5: AccessList;
		  listLength: Lupine.ListHeader ← 0;
		  FOR thisNode5 ← record.readAccess, thisNode5.rest
		      UNTIL thisNode5 = NIL DO
		    listLength ← listLength + 1;  ENDLOOP;
		  IF pktLength+2 > RpcPrivate.maxDataLength
		    THEN pktLength ← Lupine.StartNextPkt[pkt: pkt,
			pktLength: pktLength];
		  Lupine.StubPktDoubleWord[pkt, pktLength]↑ ← listLength;
		  pktLength ← pktLength + 2;
		  FOR thisNode5 ← record.readAccess, thisNode5.rest
		      UNTIL thisNode5 = NIL DO
		    BEGIN  -- Marshal thisNode5.first: Principal to
			-- pkt.data[pktLength].
		      IF pktLength+2 > RpcPrivate.maxDataLength
			THEN pktLength ← Lupine.StartNextPkt[pkt: pkt,
			    pktLength: pktLength];
		      pkt.data[pktLength] ← thisNode5.first=NIL;  pktLength
			  ← pktLength+1;
		      IF thisNode5.first # NIL
			THEN BEGIN
			  textRope: Rope.Text = RopeInline.InlineFlatten[r:
			      thisNode5.first];
			  IF textRope.length > RpcPrivate.maxShortStringLength
			    THEN Lupine.MarshalingError;
			  pkt.data[pktLength] ← textRope.length;  pktLength
			      ← pktLength+1;
			  pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength:
			      pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]],
			      dataLength: Lupine.WordsForChars[textRope.length],
			      alwaysOnePkt: FALSE];
			  END;  -- IF thisNode5.first # NIL.
		      END;  -- Marshal thisNode5.first.
		    ENDLOOP;  -- FOR thisNode5.
		  END;  -- Marshal record.readAccess.
		END;  -- OPEN record: variant.
		END;  -- Marshal variant.
	    stringName =>
	      BEGIN  -- Marshal variant: RECORD [stringName: String]
		  -- to pkt.data[pktLength].
		BEGIN OPEN record: variant;
		BEGIN  -- Marshal record.stringName: String to pkt.data[pktLength].
		  IF pktLength+2 > RpcPrivate.maxDataLength
		    THEN pktLength ← Lupine.StartNextPkt[pkt: pkt,
			pktLength: pktLength];
		  pkt.data[pktLength] ← record.stringName=NIL;  pktLength
		      ← pktLength+1;
		  IF record.stringName # NIL
		    THEN BEGIN
		      textRope: Rope.Text = RopeInline.InlineFlatten[r:
			  record.stringName];
		      pkt.data[pktLength] ← textRope.length;  pktLength
			  ← pktLength+1;
		      pktLength ← Lupine.CopyToPkt[pkt: pkt, pktLength:
			  pktLength, dataAdr: BASE[DESCRIPTOR[textRope.text]],
			  dataLength: Lupine.WordsForChars[textRope.length],
			  alwaysOnePkt: FALSE];
		      END;  -- IF record.stringName # NIL.
		  END;  -- Marshal record.stringName.
		END;  -- OPEN record: variant.
		END;  -- Marshal variant.
	    ENDCASE => NULL;  -- WITH variant: record.
	  END;  -- OPEN record: thisNode1.first.
	  END;  -- Marshal thisNode1.first.
	ENDLOOP;  -- FOR thisNode1.
      END;  -- Marshal properties.
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- WriteProperties.

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

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

  GetSize: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID, lock: LockOption]
    RETURNS [--size:-- PageCount] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← GetSize, openFileID
	(1): OpenFileID, lock (3): LockOption];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
	size (0): PageCount];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+4] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    resPkt: POINTER TO ResultOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 4;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID, lock: lock];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 2, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    RETURN[resPkt.size];
    END;  -- GetSize.

  SetSize: PUBLIC PROCEDURE [conversation: Conversation, openFileID:
      OpenFileID, size: PageCount, lock: LockOption] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.ProcedureIndex ← SetSize, openFileID
	(1): OpenFileID, size (3): PageCount, lock (5): LockOption];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+6] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 6;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
	conversation];
    argPkt↑ ← [openFileID: openFileID, size: size, lock: lock];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
	  maxReturnLength: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- SetSize.




-- 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
      AccessFailed => RETURN[
	AccessFailedStub[pkt: pkt, callLength: callLength, lastPkt:
	    lastPkt, localConversation: localConversation]];
      LockFailed => RETURN[
	LockFailedStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
	    localConversation: localConversation]];
      OperationFailed => RETURN[
	OperationFailedStub[pkt: pkt, callLength: callLength, lastPkt:
	    lastPkt, localConversation: localConversation]];
      StaticallyInvalid => RETURN[
	StaticallyInvalidStub[pkt: pkt, callLength: callLength, lastPkt:
	    lastPkt, localConversation: localConversation]];
      Unknown => RETURN[
	UnknownStub[pkt: pkt, callLength: callLength, lastPkt: lastPkt,
	    localConversation: localConversation]];
      PossiblyDamaged => RETURN[
	PossiblyDamagedStub[pkt: pkt, callLength: callLength, lastPkt:
	    lastPkt, localConversation: localConversation]];
      ENDCASE => RETURN[Lupine.DispatchingError[]];

    END;  -- ClientDispatcher


-- Public signal and error dispatcher stubs.

  AccessFailedStub: --ERROR [missingAccess: AlpineEnvironment.NeededAccess]--
      RpcPrivate.Dispatcher =
    INLINE BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.SignalIndex, missingAccess (1): AlpineEnvironment.NeededAccess];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    ERROR AlpineFile.AccessFailed[argPkt.missingAccess];
    END;  -- AccessFailedStub.

  LockFailedStub: --ERROR [why: AlpineEnvironment.LockFailure]-- RpcPrivate.Dispatcher
      =
    INLINE BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.SignalIndex, why (1): AlpineEnvironment.LockFailure];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    ERROR AlpineFile.LockFailed[argPkt.why];
    END;  -- LockFailedStub.

  OperationFailedStub: --ERROR [why: AlpineEnvironment.OperationFailure]--
      RpcPrivate.Dispatcher =
    INLINE BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.SignalIndex, why (1): AlpineEnvironment.OperationFailure];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    ERROR AlpineFile.OperationFailed[argPkt.why];
    END;  -- OperationFailedStub.

  StaticallyInvalidStub: --ERROR-- RpcPrivate.Dispatcher =
    INLINE BEGIN
    Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
    ERROR AlpineFile.StaticallyInvalid[];
    END;  -- StaticallyInvalidStub.

  UnknownStub: --ERROR [what: AlpineEnvironment.UnknownType]-- RpcPrivate.Dispatcher
      =
    INLINE BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
	transferIndex (0): RpcControl.SignalIndex, what (1): AlpineEnvironment.UnknownType];
    argPkt: LONG POINTER TO ArgumentOverlay = @pkt.data[0];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 2];
    ERROR AlpineFile.Unknown[argPkt.what];
    END;  -- UnknownStub.

  PossiblyDamagedStub: --SIGNAL-- RpcPrivate.Dispatcher =
    INLINE BEGIN
    pktLength: RpcPrivate.DataLength;
    Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
    SIGNAL AlpineFile.PossiblyDamaged[];
    pktLength ← 0;
    RETURN[returnLength: pktLength];
    END;  -- PossiblyDamagedStub.


-- No module initialization.

  END.  -- AlpineFileRpcClientImpl.