C CPAPLO    SOURCE    GF238795  16/10/18    21:15:06     9131           
      subroutine cpaplo(pilLoc,bu,bufPos)
C=======================================================================
C  Sous-programme cpaplo (COLlaborateur PAquettage Piles LOcale)
C  Enregistre les piles de reels et de mots dans le buffer d'envoi
C=======================================================================
      integer bufPos
      integer lonBuf
      integer nbRee,nbCha,nbMot
      segment BUFFER
      character*1 ffer(lonBuf)
      endsegment
      segment PILOC
      real*8 reel(nbRee)
      character*(nbCha)  chara
      integer motdeb(nbMot+1)
      endsegment
      pointeur pilLoc.PILOC
      pointeur bu.BUFFER
C      write(ioimp,*) 'Entree dans CPAPLO'

      lonBuf=bu.ffer(/2)
      nbRee=pilLoc.reel(/1)
      nbCha=pilLoc.chara(/1)
      nbMot=pilLoc.motdeb(/1)-1
C      write(ioimp,*)'Position du buffer',bufPos
      call mpipaI(nbRee,1,bu,bufPos)
      call mpipaI(nbCha,1,bu,bufPos)
      call mpipaI(nbMot,1,bu,bufPos)
      if(nbRee.gt.0) then
         call mpipaR(pilLoc.reel,nbRee,bu,bufPos)
      endif
      if(nbCha.gt.0) then
         call mpipaC(pilLoc.chara,nbCha,bu,bufPos)
      endif
      if(nbMot.gt.0) then
         call mpipaI(pilLoc.motdeb,nbMot+1,bu,bufPos)
      endif
C      write(ioimp,*)'Position du buffer',bufPos
C      write(ioimp,*) 'Sortie de CPAPLO'
      end


 
