-/* Find and return the variable in default_dict having name NAME, or
- NULL if no such variable exists in default_dict. */
-struct variable *
-find_variable (const char *name)
-{
- return avl_find (default_dict.var_by_name, (struct variable *) name);
-}
-
-/* Find and return the variable in dictionary D having name NAME, or
- NULL if no such variable exists in D. */
-struct variable *
-find_dict_variable (const struct dictionary *d, const char *name)
-{
- return avl_find (d->var_by_name, (struct variable *) name);
-}
-
-/* Creates a variable named NAME in dictionary DICT having type TYPE
- (ALPHA or NUMERIC) and, if type==ALPHA, width WIDTH. Returns a
- pointer to the newly created variable if successful. On failure
- (which indicates that a variable having the specified name already
- exists), returns NULL. */
-struct variable *
-create_variable (struct dictionary *dict, const char *name,
- int type, int width)
-{
- if (find_dict_variable (dict, name))
- return NULL;
-
- {
- struct variable *new_var;
-
- dict->var = xrealloc (dict->var, (dict->nvar + 1) * sizeof *dict->var);
- new_var = dict->var[dict->nvar] = xmalloc (sizeof *new_var);
-
- new_var->index = dict->nvar;
- dict->nvar++;
-
- init_variable (dict, new_var, name, type, width);
-
- return new_var;
- }
-}
-
-#if GLOBAL_DEBUGGING
-/* For situations in which we know that there are no variables with an
- identical name in the dictionary. */
-struct variable *
-force_create_variable (struct dictionary *dict, const char *name,
- int type, int width)
-{
- struct variable *new_var = create_variable (dict, name, type, width);
- assert (new_var != NULL);
- return new_var;
-}
-
-/* For situations in which we know that there are no variables with an
- identical name in the dictionary. */
-struct variable *
-force_dup_variable (struct dictionary *dict, const struct variable *src,
- const char *name)
-{
- struct variable *new_var = dup_variable (dict, src, name);
- assert (new_var != NULL);
- return new_var;
-}
-#endif
-
-/* Delete variable V from DICT. It should only be used when there are
- guaranteed to be absolutely NO REFERENCES to it, for instance in
- the very same function that created it. */
-void
-delete_variable (struct dictionary *dict, struct variable *v)
-{
- int i;
-
- clear_variable (dict, v);
- dict->nvar--;
- for (i = v->index; i < dict->nvar; i++)
- {
- dict->var[i] = dict->var[i + 1];
- dict->var[i]->index = i;
- }
- free (v);
-}
-
-/* Initialize fields in variable V inside dictionary D with name NAME,
- type TYPE, and width WIDTH. Initializes some other fields too. */
-static inline void
-common_init_stuff (struct dictionary *dict, struct variable *v,
- const char *name, int type, int width)