Environment-LIST() Functions

Fortran version:

    LOGICAL FUNCTION INTLIST( ENAME, EDESC, NMAX, NCNT, ILIST )
    LOGICAL FUNCTION REALIST( ENAME, EDESC, NMAX, NCNT, RLIST )
    LOGICAL FUNCTION STRLIST( ENAME, EDESC, NMAX, NCNT, SLIST )
        CHARACTER*(*)   ENAME   !  in:  environment variable for the list
        CHARACTER*(*)   EDESC   !  in:  environment variable description
        INTEGER         NMAX    !  in:  dimension for list
        INTEGER         NCNT    ! out:  actual number of entries in list
        INTEGER         ILIST( NMAX )    ! out:  array of values found    
        REAL            RLIST( NMAX )    ! out:  array of values found    
        CHARACTER*(*)   SLIST( NMAX )    ! out:  array of string values found    

NO C versions:

Roll your own out of standard library function strtok().

Summary:

Looks at the value of the indicated environment variable, parses and evaluates it as a comma-delimited list of the indicated type, counts the number of entries and returns the count in NCNT and the values in the array [I|R|S]LIST. Environment-variable lists may have an optional LIST: prefix, followed by a sequence of comma-delimited values. Blanks are not significant (and are skipped).

Return FALSE if ENAME is a bad environment variable, if there are no entries in the list or if the list does not parse and evaluate correctly, or if the array would have overflowed (i.e., has more than NMAX entries.

For Fortran-90 declarations and interface checking:

    USE M3UTILIO
    

Preconditions:

Fortran Usage:

    ...
    INTEGER     NMAX
    PARAMETER ( NMAX = ... )
    ...
    INTEGER     ILIST( NMAX )
    INTEGER     NCNT
    ...
    IF ( .NOT. INTLIST( 'MYLIST', 
 &                 'This is my comma-delimited list of INTEGERs', 
 &                 NMAX, NCNT, ILIST ) ) THEN
        !! either bad environment variable, invalid INTEGERs
        !! in the list, list had no entries, or list overflowed
        ...
    END IF
    ...

C Usage:

don't


Previous: LEN2

Next: LOCATC, LOCAT1, LOCAT2, LOCAT3, LOCAT4, LOCATR1, LOCATR2, LOCATR3, LOCATR4

Up: Utility Routines

To: Models-3/EDSS I/O API: The Help Pages