Next: rangel_count, Previous: rangef_new, Up: Ranges
parse a list of integral ranges
#include <suplib/range.h>RangeErr rangel_parse( RangeLList **rll, char *range_spec, RangeOpts opts, long minval, long maxval, long *where );
RangeLList **rll
- returned range list
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
long minval
- minimum value for incomplete start
long maxval
- maximum value for incomplete end
long *where
- position in string where error occurred
rangel_parse
translates a list of ranges of the form
r1[{,| }r2[{,| }r3]]...
into start-end pairs. 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
Range_UNSIGNED
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
[start]{`:'}[end] [start]{`/'}count
where start and end are optional limits on the range, and count specifies the number of elements in a range. In the first form, if start or end is missing, minval and maxval are used appropriately (if the incomplete range flag is set). In the second form, if start is missing, the range starts at 1 if no previous range was specified, or directly follows the end of the previous range.
rangel_parse
creates a RangeLList
object and returns it
via the rll parameter.
Diab Jerius