+ dict_var_changed (var);
+}
+
+/* Clears V's short names. */
+void
+var_clear_short_names (struct variable *v)
+{
+ size_t i;
+
+ for (i = 0; i < v->short_name_cnt; i++)
+ free (v->short_names[i]);
+ free (v->short_names);
+ v->short_names = NULL;
+ v->short_name_cnt = 0;
+}
+\f
+/* Relationship with dictionary. */
+
+/* Returns V's index within its dictionary, the value
+ for which "dict_get_var (dict, index)" will return V.
+ V must be in a dictionary. */
+size_t
+var_get_dict_index (const struct variable *v)
+{
+ assert (var_has_vardict (v));
+ return vardict_get_dict_index (v->vardict);
+}
+
+/* Returns V's index within the case represented by its
+ dictionary, that is, the value for which "case_data_idx (case,
+ index)" will return the data for V in that case.
+ V must be in a dictionary. */
+size_t
+var_get_case_index (const struct variable *v)
+{
+ assert (var_has_vardict (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
+ attribute set. */
+struct attrset *
+var_get_attributes (const struct variable *v)
+{
+ return CONST_CAST (struct attrset *, &v->attributes);
+}
+
+/* Replaces variable V's attributes set by a copy of ATTRS. */
+void
+var_set_attributes (struct variable *v, const struct attrset *attrs)
+{
+ attrset_destroy (&v->attributes);
+ attrset_clone (&v->attributes, attrs);
+}
+
+/* Returns true if V has any custom attributes, false if it has none. */
+bool
+var_has_attributes (const struct variable *v)
+{
+ return attrset_count (&v->attributes) > 0;
+}
+\f
+/* Returns the encoding of values of variable VAR. (This is actually a
+ property of the dictionary.) Returns null if no specific encoding has been
+ set. */
+const char *
+var_get_encoding (const struct variable *var)
+{
+ return (var_has_vardict (var)
+ ? dict_get_encoding (vardict_get_dictionary (var->vardict))
+ : NULL);
+}
+\f
+/* Returns V's vardict structure. */
+struct vardict_info *
+var_get_vardict (const struct variable *v)
+{
+ return CONST_CAST (struct vardict_info *, v->vardict);
+}
+
+/* Sets V's vardict data to VARDICT. */
+void
+var_set_vardict (struct variable *v, struct vardict_info *vardict)
+{
+ v->vardict = vardict;
+}
+
+/* Returns true if V has vardict data. */
+bool
+var_has_vardict (const struct variable *v)
+{
+ return v->vardict != NULL;
+}
+
+/* Clears V's vardict data. */
+void
+var_clear_vardict (struct variable *v)
+{
+ v->vardict = NULL;
+}