-- RapunzelDescription.mesa
-- Willie-Sue	18-Mar-87 13:05:45 PST

DIRECTORY Courier, RapunzelCourier, Rapunzel;

RapunzelDescription: PROGRAM
  EXPORTS RapunzelCourier = PUBLIC {

  DescribeShort: Courier.Description = {
    p: LONG POINTER TO Rapunzel.Short = notes.noteSize[
      SIZE[Rapunzel.Short]];
    };

  DescribeLong: Courier.Description = {
    p: LONG POINTER TO Rapunzel.Long = notes.noteSize[
      SIZE[Rapunzel.Long]];
    notes.noteLongCardinal[p];
    };

  DescribeSeqShort: Courier.Description = {
    p: LONG POINTER TO Rapunzel.SeqShort = notes.noteSize[
      SIZE[Rapunzel.SeqShort]];
    notes.noteArrayDescriptor[p, SIZE[Rapunzel.Short], CARDINAL.LAST];
    FOR i:Rapunzel.SeqShortIndex IN [0..LENGTH[p↑]) DO 
      notes.noteParameters[@p[i], DescribeShort];
      ENDLOOP;
    };

  DescribeSeqLong: Courier.Description = {
    p: LONG POINTER TO Rapunzel.SeqLong = notes.noteSize[
      SIZE[Rapunzel.SeqLong]];
    notes.noteArrayDescriptor[p, SIZE[Rapunzel.Long], CARDINAL.LAST];
    FOR i:Rapunzel.SeqLongIndex IN [0..LENGTH[p↑]) DO 
      notes.noteParameters[@p[i], DescribeLong];
      ENDLOOP;
    };

  DescribeAddress: Courier.Description = {
    p: LONG POINTER TO Rapunzel.Address = notes.noteSize[
      SIZE[Rapunzel.Address]];
    notes.noteLongCardinal[p];
    };

  DescribePeekShortCmd: Courier.Description = {
    p: LONG POINTER TO Rapunzel.PeekShortCmd = notes.noteSize[
      SIZE[Rapunzel.PeekShortCmd]];
    notes.noteParameters[@p.address, DescribeAddress];
    };

  DescribePokeShortCmd: Courier.Description = {
    p: LONG POINTER TO Rapunzel.PokeShortCmd = notes.noteSize[
      SIZE[Rapunzel.PokeShortCmd]];
    notes.noteParameters[@p.address, DescribeAddress];
    notes.noteParameters[@p.value, DescribeShort];
    };

  DescribePokeLongCmd: Courier.Description = {
    p: LONG POINTER TO Rapunzel.PokeLongCmd = notes.noteSize[
      SIZE[Rapunzel.PokeLongCmd]];
    notes.noteParameters[@p.address, DescribeAddress];
    notes.noteParameters[@p.value, DescribeLong];
    };

  DescribeShftReadCmd: Courier.Description = {
    p: LONG POINTER TO Rapunzel.ShftReadCmd = notes.noteSize[
      SIZE[Rapunzel.ShftReadCmd]];
    notes.noteParameters[@p.address, DescribeAddress];
    notes.noteParameters[@p.numRepeats, DescribeShort];
    };

  DescribeShftWriteCmd: Courier.Description = {
    p: LONG POINTER TO Rapunzel.ShftWriteCmd = notes.noteSize[
      SIZE[Rapunzel.ShftWriteCmd]];
    notes.noteParameters[@p.address, DescribeAddress];
    notes.noteParameters[@p.numRepeats, DescribeShort];
    };

  DescribeReturnLengthCmd: Courier.Description = {
    p: LONG POINTER TO Rapunzel.ReturnLengthCmd = notes.noteSize[
      SIZE[Rapunzel.ReturnLengthCmd]];
    notes.noteParameters[@p.returnLength, DescribeShort];
    };

  DescribeOpCode: Courier.Description = {
    p: LONG POINTER TO Rapunzel.OpCode = notes.noteSize[
      SIZE[Rapunzel.OpCode]];
    };

  DescribeCmd: Courier.Description = {
    p: LONG POINTER TO Rapunzel.Cmd = notes.noteSize[
      SIZE[Rapunzel.Cmd]];
    sizes: ARRAY [0..6) OF CARDINAL ← [
      SIZE[Rapunzel.PeekShortCmd] + 1, SIZE[Rapunzel.PokeShortCmd] + 1, SIZE[Rapunzel.PokeLongCmd] + 1, SIZE[Rapunzel.ShftReadCmd] + 1, SIZE[Rapunzel.ShftWriteCmd] + 1, SIZE[Rapunzel.ReturnLengthCmd] + 1];
    notes.noteChoice[p, SIZE[Rapunzel.Cmd], LONG[DESCRIPTOR[sizes]]];
    WITH variant: p↑ SELECT FROM
      peekShort =>     notes.noteParameters[@variant.peekShort, DescribePeekShortCmd];
      pokeShort =>     notes.noteParameters[@variant.pokeShort, DescribePokeShortCmd];
      pokeLong =>     notes.noteParameters[@variant.pokeLong, DescribePokeLongCmd];
      shftRead =>     notes.noteParameters[@variant.shftRead, DescribeShftReadCmd];
      shftWrite =>     notes.noteParameters[@variant.shftWrite, DescribeShftWriteCmd];
      returnLength =>     notes.noteParameters[@variant.returnLength, DescribeReturnLengthCmd];
      ENDCASE;
    };

  DescribeSeqCmd: Courier.Description = {
    p: LONG POINTER TO Rapunzel.SeqCmd = notes.noteSize[
      SIZE[Rapunzel.SeqCmd]];
    notes.noteArrayDescriptor[p, SIZE[Rapunzel.Cmd], CARDINAL.LAST];
    FOR i:Rapunzel.SeqCmdIndex IN [0..LENGTH[p↑]) DO 
      notes.noteParameters[@p[i], DescribeCmd];
      ENDLOOP;
    };

  DescribePeekShortResult: Courier.Description = {
    p: LONG POINTER TO Rapunzel.PeekShortResult = notes.noteSize[
      SIZE[Rapunzel.PeekShortResult]];
    notes.noteParameters[@p.value, DescribeShort];
    };

  DescribePokeShortResult: Courier.Description = {
    p: LONG POINTER TO Rapunzel.PokeShortResult = notes.noteSize[
      SIZE[Rapunzel.PokeShortResult]];
    };

  DescribePokeLongResult: Courier.Description = {
    p: LONG POINTER TO Rapunzel.PokeLongResult = notes.noteSize[
      SIZE[Rapunzel.PokeLongResult]];
    };

  DescribeShftReadResult: Courier.Description = {
    p: LONG POINTER TO Rapunzel.ShftReadResult = notes.noteSize[
      SIZE[Rapunzel.ShftReadResult]];
    notes.noteParameters[@p.numRepeats, DescribeShort];
    };

  DescribeShftWriteResult: Courier.Description = {
    p: LONG POINTER TO Rapunzel.ShftWriteResult = notes.noteSize[
      SIZE[Rapunzel.ShftWriteResult]];
    notes.noteParameters[@p.numRepeats, DescribeShort];
    };

  DescribeReturnLengthResult: Courier.Description = {
    p: LONG POINTER TO Rapunzel.ReturnLengthResult = notes.noteSize[
      SIZE[Rapunzel.ReturnLengthResult]];
    };

  DescribeResult: Courier.Description = {
    p: LONG POINTER TO Rapunzel.Result = notes.noteSize[
      SIZE[Rapunzel.Result]];
    sizes: ARRAY [0..6) OF CARDINAL ← [
      SIZE[Rapunzel.PeekShortResult] + 1, SIZE[Rapunzel.PokeShortResult] + 1, SIZE[Rapunzel.PokeLongResult] + 1, SIZE[Rapunzel.ShftReadResult] + 1, SIZE[Rapunzel.ShftWriteResult] + 1, SIZE[Rapunzel.ReturnLengthResult] + 1];
    notes.noteChoice[p, SIZE[Rapunzel.Result], LONG[DESCRIPTOR[sizes]]];
    WITH variant: p↑ SELECT FROM
      peekShort =>     notes.noteParameters[@variant.peekShort, DescribePeekShortResult];
      pokeShort =>     notes.noteParameters[@variant.pokeShort, NIL];
      pokeLong =>     notes.noteParameters[@variant.pokeLong, NIL];
      shftRead =>     notes.noteParameters[@variant.shftRead, DescribeShftReadResult];
      shftWrite =>     notes.noteParameters[@variant.shftWrite, DescribeShftWriteResult];
      returnLength =>     notes.noteParameters[@variant.returnLength, NIL];
      ENDCASE;
    };

  DescribeSeqResult: Courier.Description = {
    p: LONG POINTER TO Rapunzel.SeqResult = notes.noteSize[
      SIZE[Rapunzel.SeqResult]];
    notes.noteArrayDescriptor[p, SIZE[Rapunzel.Result], CARDINAL.LAST];
    FOR i:Rapunzel.SeqResultIndex IN [0..LENGTH[p↑]) DO 
      notes.noteParameters[@p[i], DescribeResult];
      ENDLOOP;
    };

  DescribeFaultArgs: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.FaultArgs = notes.noteSize[
      SIZE[RapunzelCourier.FaultArgs]];
    notes.noteParameters[@p.code, DescribeFaultCode];
    notes.noteParameters[@p.address, DescribeAddress];
    };

  DescribeFaultCode: Courier.Description = {
    p: LONG POINTER TO Rapunzel.FaultCode = notes.noteSize[
      SIZE[Rapunzel.FaultCode]];
    };

  DescribePeekShortArgs: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.PeekShortArgs = notes.noteSize[
      SIZE[RapunzelCourier.PeekShortArgs]];
    notes.noteParameters[@p.address, DescribeAddress];
    };

  DescribePeekShortRes: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.PeekShortRes = notes.noteSize[
      SIZE[RapunzelCourier.PeekShortRes]];
    notes.noteParameters[@p.result, DescribeShort];
    };

  DescribePokeShortArgs: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.PokeShortArgs = notes.noteSize[
      SIZE[RapunzelCourier.PokeShortArgs]];
    notes.noteParameters[@p.address, DescribeAddress];
    notes.noteParameters[@p.value, DescribeShort];
    };

  DescribePeekSeqShortArgs: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.PeekSeqShortArgs = notes.noteSize[
      SIZE[RapunzelCourier.PeekSeqShortArgs]];
    notes.noteParameters[@p.address, DescribeAddress];
    };

  DescribePeekSeqShortRes: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.PeekSeqShortRes = notes.noteSize[
      SIZE[RapunzelCourier.PeekSeqShortRes]];
    notes.noteDisjointData[@p.resultSeq, DescribeSeqShort];
    };

  DescribePeekSeqLongArgs: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.PeekSeqLongArgs = notes.noteSize[
      SIZE[RapunzelCourier.PeekSeqLongArgs]];
    notes.noteParameters[@p.address, DescribeAddress];
    };

  DescribePeekSeqLongRes: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.PeekSeqLongRes = notes.noteSize[
      SIZE[RapunzelCourier.PeekSeqLongRes]];
    notes.noteDisjointData[@p.resultSeq, DescribeSeqLong];
    };

  DescribePokeSeqShortArgs: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.PokeSeqShortArgs = notes.noteSize[
      SIZE[RapunzelCourier.PokeSeqShortArgs]];
    notes.noteParameters[@p.address, DescribeAddress];
    notes.noteDisjointData[@p.valueSeq, DescribeSeqShort];
    };

  DescribePeekLongArgs: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.PeekLongArgs = notes.noteSize[
      SIZE[RapunzelCourier.PeekLongArgs]];
    notes.noteParameters[@p.address, DescribeAddress];
    };

  DescribePeekLongRes: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.PeekLongRes = notes.noteSize[
      SIZE[RapunzelCourier.PeekLongRes]];
    notes.noteParameters[@p.result, DescribeLong];
    };

  DescribePokeLongArgs: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.PokeLongArgs = notes.noteSize[
      SIZE[RapunzelCourier.PokeLongArgs]];
    notes.noteParameters[@p.address, DescribeAddress];
    notes.noteParameters[@p.value, DescribeLong];
    };

  DescribeDoCmdsArgs: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.DoCmdsArgs = notes.noteSize[
      SIZE[RapunzelCourier.DoCmdsArgs]];
    notes.noteDisjointData[@p.cmdSeq, DescribeSeqCmd];
    };

  DescribeDoCmdsRes: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.DoCmdsRes = notes.noteSize[
      SIZE[RapunzelCourier.DoCmdsRes]];
    notes.noteDisjointData[@p.resultSeq, DescribeSeqResult];
    };

  DescribeSetShftAddrsArgs: Courier.Description = {
    p: LONG POINTER TO RapunzelCourier.SetShftAddrsArgs = notes.noteSize[
      SIZE[RapunzelCourier.SetShftAddrsArgs]];
    notes.noteParameters[@p.shftA, DescribeAddress];
    notes.noteParameters[@p.shftB, DescribeAddress];
    };



  }.