+ Specifying a null pointer for SHORT_NAME clears the specified short name. */
+void
+var_set_short_name (struct variable *var, size_t idx, const char *short_name)
+{
+ assert (short_name == NULL || id_is_plausible (short_name, false));
+
+ /* Clear old short name numbered IDX, if any. */
+ if (idx < var->short_name_cnt)
+ {
+ free (var->short_names[idx]);
+ var->short_names[idx] = NULL;
+ }
+
+ /* Install new short name for IDX. */
+ if (short_name != NULL)
+ {
+ if (idx >= var->short_name_cnt)
+ {
+ size_t old_cnt = var->short_name_cnt;
+ size_t i;
+ var->short_name_cnt = MAX (idx * 2, 1);
+ var->short_names = xnrealloc (var->short_names, var->short_name_cnt,
+ sizeof *var->short_names);
+ for (i = old_cnt; i < var->short_name_cnt; i++)
+ var->short_names[i] = NULL;
+ }
+ var->short_names[idx] = xstrdup (short_name);
+ str_uppercase (var->short_names[idx]);
+ }
+
+ 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);