+/* Returns VAR's short name with the given IDX, if it has one
+ with that index, or a null pointer otherwise. Short names may
+ be sparse: even if IDX is less than the number of short names
+ in VAR, this function may return a null pointer. */
+const char *
+var_get_short_name (const struct variable *var, size_t idx)
+{
+ return idx < var->short_name_cnt ? var->short_names[idx] : NULL;
+}
+
+/* Sets VAR's short name with the given IDX to the UTF-8 string SHORT_NAME.
+ The caller must already have checked that, in the dictionary encoding,
+ SHORT_NAME is no more than SHORT_NAME_LEN bytes long. The new short name
+ will be converted to uppercase.
+
+ 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)