Next: Variable Creation and Destruction, Previous: Variable Leave Status, Up: Variables [Contents][Index]
Occasionally it is useful to classify variables into dictionary
classes based on their names. Dictionary classes are represented by
enum dict_class
. This type and other declarations for dictionary
classes are in the <data/dict-class.h> header.
The dictionary classes are:
DC_ORDINARY
An ordinary variable, one whose name does not begin with ‘$’ or ‘#’.
DC_SYSTEM
A system variable, one whose name begins with ‘$’. See System Variables in PSPP Users Guide.
DC_SCRATCH
A scratch variable, one whose name begins with ‘#’. See Scratch Variables in PSPP Users Guide.
The values for dictionary classes are bitwise disjoint, which allows
them to be used in bit-masks. An extra enumeration constant
DC_ALL
, whose value is the bitwise-or of all of the above
constants, is provided to aid in this purpose.
One example use of dictionary classes arises in connection with PSPP
syntax that uses a TO b
to name the variables in a
dictionary from a to b (see Sets of Variables in PSPP Users Guide). This syntax requires a and b to be in
the same dictionary class. It limits the variables that it includes
to those in that dictionary class.
The following functions relate to dictionary classes.
Returns the “dictionary class” for the given variable name, by looking at its first letter.
Returns a name for the given dict_class as an adjective, e.g.
"scratch"
.
This function should probably not be used in new code as it can lead to difficulties for internationalization.
Next: Variable Creation and Destruction, Previous: Variable Leave Status, Up: Variables [Contents][Index]