C
C SUBROUTINE 'STRVAL'
C ===================
C
C Split string into lists of numeric value tokens
C (Non-numeric tokens ignored)
C
      SUBROUTINE STRVAL (STR, SEP, MAXTOK, VALUES, NVALS)
C
C PARAMETERS
C
C      STR (I)   Character string to be searched
C      SEP (I)   Character string containing characters to be used as 
C                separators; if this starts with a space then white space or 
C                white space + one other separator character will be taken as 
C                a single separator.
C   MAXTOK (I)   Maximum number of tokens to be looked for
C   VALUES (O)   Array returning real values (should be dimensioned to
C                at least MAXTOK)
C    NVALS (O)   Number of value tokens found
C
C====== Specification statements
C
      CHARACTER*(*) STR, SEP
      REAL VALUES(*)
      LOGICAL ERR
C
C====== Get tokens
C
      NTOK = 0
      NVALS = 0
      IL = 0
100   I = NXTTOK (STR, SEP, IL, M1, M2)
      IF (I.LT.0) RETURN
      NTOK = NTOK + 1
      ERR = .TRUE.
      IF (I.GT.0) X = FLPVAL (STR(M1:M2), ERR)
      IF (.NOT.ERR) THEN
         NVALS = NVALS + 1
         VALUES (NVALS) = X
      ENDIF
      IF (NTOK.LT.MAXTOK) GO TO 100
      RETURN
      END
