- g_string_append_printf (string, " CUT(%g)", rd->cut_point);
- g_string_append_printf (string, " ITERATE(%d)", rd->max_iterations);
+ GString *var_names = g_string_new ("");
+ while (node)
+ {
+ g_string_prepend (var_names, var_get_name (node->data));
+ g_string_prepend (var_names, " ");
+ node = node->next;
+ }
+
+ g_string_append (strx, var_names->str);
+ g_string_free (var_names, TRUE);
+
+
+ GString *categoricals = g_string_new ("");
+ for (node = vars; node; node = node->next)
+ {
+ const struct variable *v = node->data;
+ enum measure m = var_get_measure (v);
+
+ if (m == MEASURE_NOMINAL || m == MEASURE_ORDINAL || var_is_alpha (v))
+ {
+ g_string_prepend (categoricals, var_get_name (v));
+ g_string_prepend (categoricals, " ");
+ }
+ }
+ if (0 != strcmp (categoricals->str, ""))
+ g_string_prepend (categoricals, "\n\t/CATEGORICAL =");
+
+ g_string_append (strx, categoricals->str);
+ g_string_free (categoricals, TRUE);
+ g_slist_free (vars);
+
+ struct string opt_str;
+ ds_init_cstr (&opt_str, "\n\t/CRITERIA =");
+ syntax_gen_pspp (&opt_str, " CUT(%g)", rd->cut_point);
+ syntax_gen_pspp (&opt_str, " ITERATE(%d)", rd->max_iterations);
+ g_string_append (strx, ds_data (&opt_str));
+ ds_destroy (&opt_str);