+ size_t j;
+ int n_vars = 0;
+ struct variable **varlist;
+ struct pspp_linreg_coeff *coeff;
+ const struct variable *v;
+ union value *val;
+
+ fprintf (fp, "%s", reg_export_categorical_encode_1);
+
+ varlist = xnmalloc (c->n_indeps, sizeof (*varlist));
+ for (i = 1; i < c->n_indeps; i++) /* c->coeff[0] is the intercept. */
+ {
+ coeff = c->coeff + i;
+ v = pspp_linreg_coeff_get_var (coeff, 0);
+ if (v->type == ALPHA)
+ {
+ if (!reg_inserted (v, varlist, n_vars))
+ {
+ fprintf (fp, "struct pspp_reg_categorical_variable %s;\n\t",
+ v->name);
+ varlist[n_vars] = (struct variable *) v;
+ n_vars++;
+ }
+ }
+ }
+ fprintf (fp, "int n_vars = %d;\n\t", n_vars);
+ fprintf (fp, "struct pspp_reg_categorical_variable *varlist[%d] = {",
+ n_vars);
+ for (i = 0; i < n_vars - 1; i++)
+ {
+ fprintf (fp, "&%s,\n\t\t", varlist[i]->name);
+ }
+ fprintf (fp, "&%s};\n\t", varlist[i]->name);
+
+ for (i = 0; i < n_vars; i++)
+ {
+ coeff = c->coeff + i;
+ fprintf (fp, "%s.name = \"%s\";\n\t", varlist[i]->name,
+ varlist[i]->name);
+ fprintf (fp, "%s.n_vals = %d;\n\t", varlist[i]->name,
+ varlist[i]->obs_vals->n_categories);
+
+ for (j = 0; j < varlist[i]->obs_vals->n_categories; j++)
+ {
+ val = cat_subscript_to_value ((const size_t) j, varlist[i]);
+ fprintf (fp, "%s.values[%d] = \"%s\";\n\t", varlist[i]->name, j,
+ value_to_string (val, varlist[i]));
+ }
+ }
+ fprintf (fp, "%s", reg_export_categorical_encode_2);
+}
+
+static void
+reg_print_depvars (FILE * fp, pspp_linreg_cache * c)
+{
+ int i;
+ struct pspp_linreg_coeff *coeff;
+ const struct variable *v;