Next: range_perror, Previous: Ranges, Up: Ranges
parse a list of floating point ranges
#include <suplib/range.h>RangeErr rangef_parse( RangeFList **rfl, char *range_spec, RangeOpts opts, double minval, double maxval, long *where );
RangeFList **rfl
- returned list of ranges
char *range_spec
- string containing range to parse
RangeOpts opts
- range options
Possible values for aRangeOpts
are as follows:Range_SORT
,Range_MERGE
,Range_INCOMPLETE
,Range_UNSIGNED
double minval
- replacement value for incomplete start
double maxval
- replacement value for incomplete end
long *where
- position in string where error occurred
rangef_parse
translate a list of ranges of the form
"r1,r2,r3,r4" into start-end pairs. a range has the format:
[start]{ `:' | `(' | `)' | `~' }[end]
where start and end are optional limits on the range.
It returns a code indicating whether an error ocurred. (See
suplib/range.h for the possible errors, and codes. It also
returns the location of the error in the range specification via
the passed where
variable.
Possible values for a
RangeErr
are as follows:
RangeErr_OK
- no error
RangeErr_NOMEM
- out of memory
RangeErr_INCOMPLETE
- incomplete range
RangeErr_ERANGE
- number out of bounds
RangeErr_ILLNUM
- not a number
RangeErr_NEGNUM
- negative number
RangeErr_OFLOWSTART
- overflow of start value
RangeErr_NONPOSCOUNT
- non-positive count
RangeErr_OFLOWEND
- overflow of end value
RangeErr_INTERNAL
- internal error
RangeErr_ORDER
- start greater than end
RangeErr_EMPTY
- float range is empty set
RangeErr_MAXERR
The handling of the ranges depends upon the flags set in the opts arguement. opts is set to the logical OR of zero or more of the following values
Range_SORT
Range_MERGE
Range_SORT
.
Range_INCOMPLETE
rangef_parse
creates a RangeFList
object and returns it
via the rfl parameter.
Diab Jerius