cdds_scanf - retrieve definition from dictionary
SYNOPSIS
#include "cdds.h"
int cdds_scanf(alias, fmt, ...);
-
const char *alias
const char *fmt
[ Description
| Examples
]
DESCRIPTION
cdds_scanf retrieves a definition from dictionaries. The
scan dictionaries must have been previously selected by
cdds_dict, or related function. The name of
the definition is specified by alias (multiple names, delimited
by white space, may be specified). If a null alias is specified
(i.e. NULL, zero length string, or a string that only contains
white space) the value is processed, starting from the current position
of the current scan definition.
Dictionaries are scanned from bottom-to-top and right-to-left.
The newest definition that matches any alias is selected.
cdds_scanf is controlled by a format string and optional
arguments. Processing begins at the current position in the
definition value. Characters are matched and converted,
as specified by the ANSI standard for the stdio sscanf function.
The current position is advanced as the format is processed.
The function returns the number of arguments converted and assigned.
It returns EOF, if no match is found, if a scan definition is
not already selected, or if conversion fails prior to the first
assignment.
Dictionaries may contain alias definitions. They define
alternate names for older definitions. Alias
definitions are denoted by a special prefix,
"alias:defn_name" or "$defn_name".
The value of an alias definition is a list of alternate names.
For example:
out_data= /very/long/path/name/file
name= value...
alias:data= out_data
foo= hidden definition...
name= value...
$foo=
Alias definitions are processed, when scan functions search for
a name. If a definition name matches an alias, the search list
is modified and processing continues. The defined values (definition
names delimited by white space) replace the one name matched in the
original alias list.
EXAMPLES
int i, j, n;
float alpha, gamma[100], f;
const char s[100];
alpha = 3.14;
j = cdds_scanf("alpha", "%f", &alpha);
j = cdds_scanf("beta", "%s %i %f", s, &i, &f);
/* retrieve list of float values */
j = cdds_scanf("gamma", "");
for(n = 0; 1 == cdds_scanf("", "%f", gamma + n); n++);
SEE ALSO
cdds_dict Select DDS dictionary and mode
cdds_scank Retrieve a definition
cdds_scant Retrieve a definition
cdds_scantn Retrieve a definition
cdds_scanv Retrieve a definition
AUTHOR
R. L. Selzler, EPTG (Oct 1995)