Previous: utidf Up: ../plot79_u.html Next: utidl


UTIDI

       SUBROUTINE  UTIDI (NUMBER,NEXT,ERROR,FIELD,LENGTH,NBASE,FLUSH)
 C$    (Decode INTEGER Value from Character Form)
 C$    Convert an integer value represented as a string of  digits
 C$    in FIELD(*) to  internal (binary)  format.  Leading  blanks
 C$    and tabs  are  ignored.  Unlike  FORTRAN  formatted  input,
 C$    blanks ARE  significant.  To  permit free-form  input,  the
 C$    conversion will continue until a character which is neither
 C$    a sign  nor a  valid digit  is found,  or else  the end  of
 C$    FIELD(*) is  reached.   Lower-case letters  are  acceptable
 C$    input if the base is larger  than 10.  A pointer is set  to
 C$    the next unprocessed character in FIELD(*) (which might  be
 C$    FIELD(LENGTH+1)) so  that the  caller may  check for  valid
 C$    syntax.  The arguments are:
 C$
 C$    NUMBER.........Integer value (returned).
 C$    NEXT...........On exit, index of the character in  FIELD(*)
 C$                   which follows the last character  processed.
 C$                   On input,  it  should  point  to  the  first
 C$                   character to be processed.
 C$    ERROR.......... .TRUE. - No valid characters found.  NUMBER
 C$                             is set to 0.
 C$                   .FALSE. - No error occurred.
 C$    FIELD(*).......Character string to be decoded (A1 format).
 C$    LENGTH.........Number of characters in FIELD(*).
 C$    NBASE..........Number base.  If not in the range 2..16, the
 C$                   nearer of 2 or 16 will be assumed.
 C$    FLUSH.......... .TRUE. - Flush any leading invalid
 C$                             characters.
 C$                   .FALSE. - Do not flush leading invalid
 C$                             characters.
 C$
 C$    If FORTRAN formatted input is to be simulated, then  LENGTH
 C$    should be set to  the desired field  width, and the  output
 C$    value of NUMBER should be multiplied by 10**(LENGTH-NEXT+1)
 C$    to account for trailing blanks to be interpreted as zeroes.
 C$    It is  up  to  the  caller  to  verify  that  any  trailing
 C$    characters are in fact blanks.  The FLUSH option is  useful
 C$    to allow successive calls to retrieve integers separated by
 C$    commas, spaces,  etc.  The  caller must  realize,  however,
 C$    that this might cause skipping over incorrectly-coded items
 C$    (e.g. "1,2,3,R,5" for "1,2,3,4,5").
 C$    (11-SEP-85)