Next: Creating Variables, Up: Dictionaries [Contents][Index]
The most common operations on a dictionary simply retrieve a
struct variable *
of an individual variable based on its name
or position.
Looks up and returns the variable with the given name within dict. Name lookup is not case-sensitive.
dict_lookup_var
returns a null pointer if dict does not
contain a variable named name. dict_lookup_var_assert
asserts that such a variable exists.
Returns the variable at the given position in dict. position must be less than the number of variables in dict (see below).
Returns the number of variables in dict.
Another pair of functions allows retrieving a number of variables at once. These functions are more rarely useful.
Retrieves all of the variables in dict, in their original order,
except that any variables in the dictionary classes specified
exclude, if any, are excluded (see Dictionary Class).
Pointers to the variables are stored in an array allocated with
malloc
, and a pointer to the first element of this array is
stored in *vars
. The caller is responsible for freeing
this memory when it is no longer needed. The number of variables
retrieved is stored in *cnt
.
The presence or absence of DC_SYSTEM
in exclude has no
effect, because dictionaries never include system variables.
One additional function is available. This function is most often used in assertions, but it is not restricted to such use.
Tests whether var is one of the variables in dict. Returns true if so, false otherwise.
Next: Creating Variables, Up: Dictionaries [Contents][Index]