-- RapunzelDescription.mesa
-- Willie-Sue	10-Oct-86 13:55:48 PDT
-- Willie-Sue, October 13, 1986 11:41:39 am PDT

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;
    };

  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];
    };

  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..2) OF CARDINAL ← [
      SIZE[peekShort Rapunzel.Cmd], SIZE[pokeShort Rapunzel.Cmd]];
    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];
      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]];
    };

  DescribeResult: Courier.Description = {
    p: LONG POINTER TO Rapunzel.Result = notes.noteSize[
      SIZE[Rapunzel.Result]];
    sizes: ARRAY [0..2) OF CARDINAL ← [
      SIZE[peekShort Rapunzel.Result], SIZE[pokeShort Rapunzel.Result]];
    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];
      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]];
    };

  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];
    };

  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];
    };

  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];
    };



  }.