-- Stub file  was translated on December 14, 1983 3:39 pm by Lupine of October 25, 1983 10:51 am
-- Source interface AlpineDebug came from file AlpineDebug.bcd, which was created on December 14, 1983 3:37 pm with version stamp 145B#143B#15732130232B from source of May 27, 1983 4:41 pm.

-- The RPC stub modules for AlpineDebug are:
--   AlpineDebugRpcControl.mesa;
--   AlpineDebugRpcClientImpl.mesa;
--   AlpineDebugRpcBinderImpl.mesa;
--   AlpineDebugRpcServerImpl.mesa.

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


DIRECTORY
  AlpineEnvironment,
  AlpineDebug,
  AlpineDebugRpcControl 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, defaultZones,
      -- 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]--,
  Rope --USING SOME OF [InlineFlatten, Length, NewText, Text]--;


AlpineDebugRpcClientImpl: MONITOR
  IMPORTS AlpineDebug, RpcPrivate: RPCLupine, Lupine: LupineRuntime,
      Atom, Rope
  EXPORTS AlpineDebug, AlpineDebugRpcControl
  SHARES  AlpineDebug, AlpineDebugRpcControl, Rope
  = BEGIN OPEN AlpineDebug, RpcControl: AlpineDebugRpcControl, 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 ] =
    TRUSTED BEGIN ENABLE UNWIND => NULL;
    IsNull: PROCEDURE [string: Rope.ROPE] RETURNS [BOOLEAN] =
      INLINE {RETURN[string.Length[] = 0]};
    IF bound THEN Lupine.BindingError;
    myInterface ← RpcPrivate.ImportInterface [
      interface: [
        type: IF ~IsNull[interfaceName.type]
          THEN interfaceName.type ELSE "AlpineDebug~145B#143B#15732130232B",
        instance: interfaceName.instance,
        version: interfaceName.version ],
      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;

  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.

  ReadOwnerFileHeader: PUBLIC PROCEDURE [conversation: AlpineEnvironment.Conversation,
      transID: AlpineEnvironment.TransID, volumeGroupID: AlpineEnvironment.VolumeGroupID]
    RETURNS [--version:-- NAT, --recordedVolGroupID:-- AlpineEnvironment.VolumeGroupID,
        --totalQuota:-- AlpineEnvironment.PageCount, --quotaLeft:-- AlpineEnvironment.PageCount,
        --numberOfOwners:-- NAT, --numberOfOwnerSlotsInUse:-- NAT, --maxNumberOfOwnersAllowed:--
        NAT] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← ReadOwnerFileHeader,
        transID (1): AlpineEnvironment.TransID, volumeGroupID (10): AlpineEnvironment.VolumeGroupID];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        version (0): NAT, recordedVolGroupID (1): AlpineEnvironment.VolumeGroupID,
        totalQuota (6): AlpineEnvironment.PageCount, quotaLeft (8): AlpineEnvironment.PageCount,
        numberOfOwners (10): NAT, numberOfOwnerSlotsInUse (11): NAT, maxNumberOfOwnersAllowed
        (12): NAT];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+15] 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 ← 15;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        conversation];
    argPkt↑ ← [transID: transID, volumeGroupID: volumeGroupID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 13, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 13];
    RETURN[resPkt.version, resPkt.recordedVolGroupID, resPkt.totalQuota,
        resPkt.quotaLeft, resPkt.numberOfOwners, resPkt.numberOfOwnerSlotsInUse,
        resPkt.maxNumberOfOwnersAllowed];
    END;  -- ReadOwnerFileHeader.

  ReadNextOwnerRecord: PUBLIC PROCEDURE [conversation: AlpineEnvironment.Conversation,
      transID: AlpineEnvironment.TransID, volumeGroupID: AlpineEnvironment.VolumeGroupID,
      contRecNum: INT, desiredProperties: AlpineEnvironment.OwnerPropertySet]
    RETURNS [entryEmpty: BOOLEAN, entryValid: BOOLEAN, owner: AlpineEnvironment.OwnerName,
        properties: LIST OF AlpineEnvironment.OwnerPropertyValuePair, nextContRecNum:
        INT] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← ReadNextOwnerRecord,
        transID (1): AlpineEnvironment.TransID, volumeGroupID (10): AlpineEnvironment.VolumeGroupID,
        contRecNum (15): INT, desiredProperties (17): AlpineEnvironment.OwnerPropertySet];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        entryEmpty (0): BOOLEAN, entryValid (1): BOOLEAN, nextContRecNum
        (2): INT];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+254] 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 ← 18;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        conversation];
    argPkt↑ ← [transID: transID, volumeGroupID: volumeGroupID, contRecNum:
        contRecNum, desiredProperties: desiredProperties];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 254, signalHandler: ClientDispatcher];
    pktLength ← 4;
    BEGIN  -- OnePkt.
    onePkt: BOOLEAN = lastPkt;
    IF ~onePkt THEN BEGIN  -- Must move statics from pkt now.
      [entryEmpty: entryEmpty, entryValid: entryValid, nextContRecNum:
          nextContRecNum] ← resPkt↑;
      END;
    BEGIN  -- Unmarshal owner: AlpineEnvironment.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 owner ← NIL
        ELSE BEGIN
          ropeLength: Lupine.RopeHeader;
          textRope: Rope.Text;
          ropeLength ← pkt.data[pktLength];  pktLength ← pktLength+1;
          IF ropeLength > RpcPrivate.maxShortStringLength
            THEN Lupine.UnmarshalingError;
          owner ← textRope ← Rope.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 owner.
    BEGIN  -- Unmarshal properties: LIST OF AlpineEnvironment.OwnerPropertyValuePair
        -- from pkt.data[pktLength].
      lastNode: LIST OF AlpineEnvironment.OwnerPropertyValuePair ←
          (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 AlpineEnvironment.OwnerPropertyValuePair
            = paramZones.gc.CONS[--DefaultValue--,NIL];
        BEGIN  -- Unmarshal thisNode1.first: AlpineEnvironment.OwnerPropertyValuePair
            -- from pkt.data[pktLength].
          pktLength ← Lupine.CopyFromPkt[pkt: pkt, pktLength: pktLength,
              dataAdr: @thisNode1.first, dataLength: SIZE[AlpineEnvironment.OwnerPropertyValuePair],
              alwaysOnePkt: FALSE];
          -- Restore garbled REFs to NIL following copy.
          BEGIN OPEN record: thisNode1.first;
          WITH variant: record SELECT FROM
            createAccessList =>
              BEGIN OPEN record: variant;
              LOOPHOLE[record.createAccessList, LONG POINTER] ← NIL;
              END;  -- OPEN record: variant.
            modifyAccessList =>
              BEGIN OPEN record: variant;
              LOOPHOLE[record.modifyAccessList, 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
            createAccessList =>
              BEGIN  -- Unmarshal variant: RECORD [createAccessList:
                  -- AccessList] from pkt.data[pktLength].
                BEGIN OPEN record: variant;
                BEGIN  -- Unmarshal record.createAccessList: AccessList
                    -- from pkt.data[pktLength].
                  lastNode: AccessList ← (record.createAccessList ←
                      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: RName 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 ← Rope.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.createAccessList ← thisNode5);
                    listLength ← listLength - 1;
                    ENDLOOP;  -- WHILE listLength > 0.
                  END;  -- Unmarshal record.createAccessList.
                END;  -- OPEN record: variant.
                END;  -- Unmarshal variant.
            modifyAccessList =>
              BEGIN  -- Unmarshal variant: RECORD [modifyAccessList:
                  -- AccessList] from pkt.data[pktLength].
                BEGIN OPEN record: variant;
                BEGIN  -- Unmarshal record.modifyAccessList: AccessList
                    -- from pkt.data[pktLength].
                  lastNode: AccessList ← (record.modifyAccessList ←
                      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: RName 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 ← Rope.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.modifyAccessList ← thisNode5);
                    listLength ← listLength - 1;
                    ENDLOOP;  -- WHILE listLength > 0.
                  END;  -- Unmarshal record.modifyAccessList.
                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];
    IF onePkt
      THEN RETURN[resPkt.entryEmpty, resPkt.entryValid, owner, properties,
          resPkt.nextContRecNum]
      ELSE RETURN[entryEmpty, entryValid, owner, properties, nextContRecNum];
    END;  -- OnePkt.
    END;  -- ReadNextOwnerRecord.

  ChangeSpaceForOwner: PUBLIC PROCEDURE [conversation: AlpineEnvironment.Conversation,
      transID: AlpineEnvironment.TransID, volumeGroupID: AlpineEnvironment.VolumeGroupID,
      owner: AlpineEnvironment.OwnerName, nPages: AlpineEnvironment.PageCount]
      =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← ChangeSpaceForOwner,
        transID (1): AlpineEnvironment.TransID, volumeGroupID (10): AlpineEnvironment.VolumeGroupID,
        nPages (15): AlpineEnvironment.PageCount];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+51] OF WORD;
    pkt: RpcPrivate.StubPkt = RpcPrivate.GetStubPkt[space: @pktBuffer];
    argPkt: POINTER TO ArgumentOverlay = @pkt.data[0];
    pktLength: RpcPrivate.DataLength ← 17;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface, localConversation:
        conversation];
    argPkt↑ ← [transID: transID, volumeGroupID: volumeGroupID, nPages:
        nPages];
    BEGIN  -- Marshal owner: AlpineEnvironment.OwnerName to pkt.data[pktLength].
      pkt.data[pktLength] ← owner=NIL;  pktLength ← pktLength+1;
      IF owner # NIL
        THEN BEGIN
          textRope: Rope.Text = Rope.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: 0, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 0];
    RETURN[];
    END;  -- ChangeSpaceForOwner.

  ReadDBUniversalFile: PUBLIC PROCEDURE [volumeGroupID: AlpineEnvironment.VolumeGroupID]
      RETURNS [--dBID:-- AlpineEnvironment.UniversalFile] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← ReadDBUniversalFile,
        volumeGroupID (1): AlpineEnvironment.VolumeGroupID];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        dBID (0): AlpineEnvironment.UniversalFile];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+10] 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 ← 6;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
    argPkt↑ ← [volumeGroupID: volumeGroupID];
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 10, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 10];
    RETURN[resPkt.dBID];
    END;  -- ReadDBUniversalFile.

  ReportAccessCacheStats: PUBLIC PROCEDURE RETURNS [--nCacheEntries:--
      NAT, --statsCacheHit:-- INT, --statsGrapevineAuthorized:-- INT, --statsGrapevineNotAuthorized:--
      INT, --statsRegServersDown:-- INT, --statsIndivGrapeNotAuthorized:--
      INT] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← ReportAccessCacheStats];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nCacheEntries (0): NAT, statsCacheHit (1): INT, statsGrapevineAuthorized
        (3): INT, statsGrapevineNotAuthorized (5): INT, statsRegServersDown
        (7): INT, statsIndivGrapeNotAuthorized (9): INT];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+11] 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 ← 1;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
    argPkt.transferIndex ← ReportAccessCacheStats;
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 11, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 11];
    RETURN[resPkt.nCacheEntries, resPkt.statsCacheHit, resPkt.statsGrapevineAuthorized,
        resPkt.statsGrapevineNotAuthorized, resPkt.statsRegServersDown,
        resPkt.statsIndivGrapeNotAuthorized];
    END;  -- ReportAccessCacheStats.

  ReportAccessVolatileStats: PUBLIC PROCEDURE RETURNS [--nRegs:-- INT,
      --nInits:-- INT, --nUnRegs:-- INT, --nReorganizes:-- INT, --nEnumAlls:--
      INT, --nAllocReqsWin:-- INT, --nAllocReqsLose:-- INT, --nDeallocReqs:--
      INT, --nRemoveOwner:-- INT, --nEnumFindWin:-- INT, --nEnumFindLose:--
      INT, --nSetEnums:-- INT, --nActions:-- INT, --nPhaseOnes:-- INT,
      --nPhaseTwos:-- INT, --nAborts:-- INT] =
    BEGIN
    ArgumentOverlay: TYPE = MACHINE DEPENDENT RECORD [
        transferIndex (0): RpcControl.ProcedureIndex ← ReportAccessVolatileStats];
    ResultOverlay: TYPE = MACHINE DEPENDENT RECORD [
        nRegs (0): INT, nInits (2): INT, nUnRegs (4): INT, nReorganizes
        (6): INT, nEnumAlls (8): INT, nAllocReqsWin (10): INT, nAllocReqsLose
        (12): INT, nDeallocReqs (14): INT, nRemoveOwner (16): INT, nEnumFindWin
        (18): INT, nEnumFindLose (20): INT, nSetEnums (22): INT, nActions
        (24): INT, nPhaseOnes (26): INT, nPhaseTwos (28): INT, nAborts
        (30): INT];
    pktBuffer: ARRAY [1..RpcPrivate.pktOverhead+32] 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 ← 1;
    lastPkt: BOOLEAN;
    RpcPrivate.StartCall[callPkt: pkt, interface: myInterface];
    argPkt.transferIndex ← ReportAccessVolatileStats;
    [returnLength: , lastPkt: lastPkt] ←
      RpcPrivate.Call[ pkt: pkt, callLength: pktLength,
          maxReturnLength: 32, signalHandler: ClientDispatcher];
    Lupine.CheckPktLength[pkt: pkt, pktLength: 32];
    RETURN[resPkt.nRegs, resPkt.nInits, resPkt.nUnRegs, resPkt.nReorganizes,
        resPkt.nEnumAlls, resPkt.nAllocReqsWin, resPkt.nAllocReqsLose,
        resPkt.nDeallocReqs, resPkt.nRemoveOwner, resPkt.nEnumFindWin,
        resPkt.nEnumFindLose, resPkt.nSetEnums, resPkt.nActions, resPkt.nPhaseOnes,
        resPkt.nPhaseTwos, resPkt.nAborts];
    END;  -- ReportAccessVolatileStats.

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


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


-- Public signal and error dispatcher.

  ClientDispatcher: --PROCEDURE [pkt: RPCPkt, callLength: DataLength,
      -- lastPkt: BOOLEAN, localConversation: Conversation] RETURNS [returnLength:
      -- DataLength]-- RpcPrivate.Dispatcher =
    BEGIN

    SELECT LOOPHOLE[pkt.data[0], RpcControl.SignalIndex] FROM
      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]];
      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 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 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 OperationFailed[argPkt.why];
    END;  -- OperationFailedStub.

  StaticallyInvalidStub: --ERROR-- RpcPrivate.Dispatcher =
    INLINE BEGIN
    Lupine.CheckPktLength[pkt: pkt, pktLength: 1];
    ERROR 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 Unknown[argPkt.what];
    END;  -- UnknownStub.


-- No module initialization.

END.  -- AlpineDebugRpcClientImpl.