PARSE_ARRAY(3)
NAME
parse_array - parse an array descriptor in an argument list
SYNOPSIS
#include <soi_names.h>
#include <soi_key.h>
int parse_array (KEY **params, char *root, int type)
DESCRIPTION
parse_array() takes as arguments a pointer to a keylist, a
key name root, and an integer type. It assumes that there
is an entry in the given keylist whose key is the root key
name and whose value is a string of the form:
[[|(|{] [token_0 [, token_1 [, ...]]] []|)|}]
that is, a comma separated list of string tokens optionally
enclosed in a matching pair of brackets, parentheses, or
braces. The string tokens are parsed as floating-point or
integer values according to the value of type.
An integer entry root_nvals containing the number of valid
tokens in the parse string is added to the keylist. If any
valid tokens are found, entries of the form root_i_value and
appropriate type, where
i = 0, ..., root_nvals-1,
are also added to the keylist.
Integer tokens are parsed according to the standard rules
for strtol (,,0), so that octal, decimal, and hexadecimal
representations may be used and mixed freely.
SEE ALSO
module(1)l strtod(3), strtol(3)
DIAGNOSTICS
Sets and returns soi_errno if the string to be parsed is
zero-length after stripping of the delimiters and white
space; thus the only way to produce root_nvals = 0 is by
providing a string that cannot be parsed by strtol() or
strtod(). Also sets and returns soi_errno if an unsupported
type is requested. The supported types are
KEYTYP_INT, KEYTYP_SHORT, KEYTYP_USHORT, KEYTYP_BYTE,
KEYTYP_UBYTE, (all of which produce arrays of integers), and
KEYTYP_FLOAT, KEYTYP_DOUBLE, both of which produce arrays
of doubles.
BUGS
Although the left and right delimiters are optional, if a
left delimiter is present there must be a matching right
delimiter of the same type
HISTORY
1999-11-17 SOI Version 4.5