C
C This file is issued from the MODULEF library, but has been 
C subsequently modified
C
      SUBROUTINE CHAINT(CAR,ICAR,LGE,LGS)
C ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C    BUT: CODER LA CHAINE DE CARACTERES CAR ET SA LONGUEUR (TRONQUEE
C    AU MAXIMUM DE CARACTERES STOKABLES DANS ICAR(NBE) ) DANS UN TABLEAU
C    D'ENTIER ICAR DIMENSIONNER A LGE  ,LGS= NB D'ENTIERS UTILISES
C    LE TABLEAU ICAR EST DECODE PAR LA SUBROUTINE INTCHA
C    LONGUEUR MAXIMUN DE CODAGE 80 CARACTERES
C
C    IN :  CAR CHAINE DE CARACTERES
C    OUT:  ICAR(1:LGE) TABLEAU ENTIER S
C          LGS = NOMBRE D'ENTIERS UTILISES DANS ICAR
C ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C PROGRAMMEUR : F. HECHT - INRIA - AVRIL 86
C ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      CHARACTER*(*) CAR,FORM*7,BUF*80
      INTEGER ICAR(LGE)
      DATA NBCMOT/4/
      LGE1 = 20
      LGE1 = MIN(LGE1,LGE)
      NBCAR=LEN(CAR)
      NBM=LGE*NBCMOT-1
      WRITE (FORM,'(''('',I3,''A4)'')') LGE1
      NB=MIN(NBM,NBCAR,79)
      NB1=NB+1
      LGS=(NB1+3)/NBCMOT
C      NBF=LGS*4      OPTIM
      BUF(1:1)=CHAR(NB)
      BUF(2:80)=CAR
      READ (BUF,FORM) (ICAR(I),I=1,LGE1)
      END
