Next: , Previous: , Up: Variables   [Contents][Index]

2.5.9 Dictionary Class

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.

Enumeration: enum dict_class

The dictionary classes are:


An ordinary variable, one whose name does not begin with ‘$’ or ‘#’.


A system variable, one whose name begins with ‘$’. See System Variables in PSPP Users Guide.


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.

Function: enum dict_class dict_class_from_id (const char *name)

Returns the “dictionary class” for the given variable name, by looking at its first letter.

Function: const char * dict_class_to_name (enum dict_class dict_class)

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: , Previous: , Up: Variables   [Contents][Index]