slaDfltin -


void slaDfltin(string, nstrt, dreslt, jflag)


char *string
int *nstrt
double *dreslt
int *jflag


  Convert free-format input into double precision floating point.


     *string     char       string containing field to be decoded
     *nstrt      int        where to start decode (1st = 1)


     *nstrt      int        advanced to next field
     *dreslt     double     result
     *jflag      int        -1 = -OK, 0 = +OK, 1 = null field, 2 = error




     1     A tab character is interpreted as a space, and lower
           case d,e are interpreted as upper case.

     2     The basic format is ^.^@^ where # means + or -,
           ^ means a decimal subfield and @ means D or E.

3 Spaces
             Leading spaces are ignored.
             Embedded spaces are allowed only after # and D or E,
             and after . where the first ^ is absent.
             Trailing spaces are ignored;  the first signifies
             end of decoding and subsequent ones are skipped.

4 Field separators
             Any character other than +,-,0-9,.,D,E or space may be
             used to end a field.  Comma is recognised by slaDfltin
             as a special case; it is skipped, leaving the
             pointer on the next character.  See 12, below.

     5     Both signs are optional.  The default is +.

     6     The mantissa defaults to 1.

     7     The exponent defaults to e0.

     8     The decimal subfields may be of any length.

     9     The decimal point is optional for whole numbers.

     10    A null field is one that does not begin with
           +,-,0-9,.,D or E, or consists entirely of spaces.
           If the field is null, jflag is set to 1 and dreslt
           is left untouched.

     11    nstrt = 1 for the first character in the string.

     12    On return from slaDfltin, nstrt is set ready for the next
           decode - following trailing blanks and (if used) the
           comma separator.  If a separator other than comma is
           being used, nstrt must be incremented before the next
           call to slaDfltin.

13 Errors (jflag=2) occur when
             a)  A +, -, D or E is left unsatisfied.
             b)  The decimal point is present without at least
                 one decimal subfield.
             c)  An exponent more than 100 has been presented.

     14    When an error has been detected, nstrt is left
           pointing to the character following the last
           one used before the error came to light.  This
           may be after the point at which a more sophisticated
           program could have detected the error.  For example,
           slaDfltin does not detect that '1e999' is unacceptable
           until the whole field has been read.

     15    Certain highly unlikely combinations of mantissa &
           exponent can cause arithmetic faults during the
           decode, in some cases despite the fact that they
           together could be construed as a valid number.

     16    Decoding is left to right, one pass.

17 End of field may occur in either of two ways
             a)  As dictated by the string length.
             b)  Detected during the decode.
                 (b overrides a.)

  P.T.Wallace   Starlink   17 November 1993