attrset_clear (&d->attributes);
}
-/* Destroys the aux data for every variable in D, by calling
- var_clear_aux() for each variable. */
-void
-dict_clear_aux (struct dictionary *d)
-{
- int i;
-
- for (i = 0; i < d->var_cnt; i++)
- var_clear_aux (d->var[i].var);
-}
-
/* Clears a dictionary and destroys it. */
void
dict_destroy (struct dictionary *d)
assert (dict_contains_var (d, v));
- /* Delete aux data. */
- var_clear_aux (v);
-
dict_unset_split_var (d, v);
dict_unset_mrset_var (d, v);
/* PSPP - a program for statistical analysis.
- Copyright (C) 2004, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* Clearing and destroying dictionaries. */
void dict_clear (struct dictionary *);
-void dict_clear_aux (struct dictionary *);
void dict_destroy (struct dictionary *);
/* Common ways to access variables. */
char **short_names;
size_t short_name_cnt;
- /* Each command may use these fields as needed. */
- void *aux;
- void (*aux_dtor) (struct variable *);
-
/* Custom attributes. */
struct attrset attributes;
};
assert (!var_has_vardict (v));
mv_destroy (&v->miss);
var_clear_short_names (v);
- var_clear_aux (v);
val_labs_destroy (v->val_labs);
var_clear_label (v);
attrset_destroy (var_get_attributes (v));
return vardict_get_case_index (v->vardict);
}
\f
-/* Returns V's auxiliary data, or a null pointer if none has been
- attached. */
-void *
-var_get_aux (const struct variable *v)
-{
- return v->aux;
-}
-
-/* Assign auxiliary data AUX to variable V, which must not
- already have auxiliary data. Before V's auxiliary data is
- cleared, AUX_DTOR(V) will be called. (var_dtor_free, below,
- may be appropriate for use as AUX_DTOR.) */
-void *
-var_attach_aux (const struct variable *v_,
- void *aux, void (*aux_dtor) (struct variable *))
-{
- struct variable *v = CONST_CAST (struct variable *, v_);
- assert (v->aux == NULL);
- assert (aux != NULL);
- v->aux = aux;
- v->aux_dtor = aux_dtor;
- return aux;
-}
-
-/* Remove auxiliary data, if any, from V, and return it, without
- calling any associated destructor. */
-void *
-var_detach_aux (struct variable *v)
-{
- void *aux = v->aux;
- assert (aux != NULL);
- v->aux = NULL;
- return aux;
-}
-
-/* Clears auxiliary data, if any, from V, and calls any
- associated destructor. */
-void
-var_clear_aux (struct variable *v)
-{
- if (v->aux != NULL)
- {
- if (v->aux_dtor != NULL)
- v->aux_dtor (v);
- v->aux = NULL;
- }
-}
-
-/* This function is appropriate for use an auxiliary data
- destructor (passed as AUX_DTOR to var_attach_aux()) for the
- case where the auxiliary data should be passed to free(). */
-void
-var_dtor_free (struct variable *v)
-{
- free (v->aux);
-}
-\f
/* Returns variable V's attribute set. The caller may examine or
modify the attribute set, but must not destroy it. Destroying
V, or calling var_set_attributes() on V, will also destroy its
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
size_t var_get_dict_index (const struct variable *);
size_t var_get_case_index (const struct variable *);
-/* Variable auxiliary data. */
-void *var_get_aux (const struct variable *);
-void *var_attach_aux (const struct variable *,
- void *aux, void (*aux_dtor) (struct variable *));
-void var_clear_aux (struct variable *);
-void *var_detach_aux (struct variable *);
-void var_dtor_free (struct variable *);
-
/* Custom attributes. */
struct attrset *var_get_attributes (const struct variable *);
void var_set_attributes (struct variable *, const struct attrset *);
ds = session_active_dataset (session);
assert (!proc_is_open (ds));
unset_cmd_algorithm ();
- dict_clear_aux (dataset_dict (ds));
if (!dataset_end_of_command (ds))
result = CMD_CASCADING_FAILURE;