X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-logistic.c;h=5fb557031585ace80aed8b7e99ac1e618f6517c6;hb=8855cb5d6ff72efd5bdb05b339cf9fb175991d5e;hp=8640beef9bb3e23f3d22565f6459eb3e0249a381;hpb=cdfb21de2cbbf921b4e1fe0662439da1c460eabc;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-logistic.c b/src/ui/gui/psppire-dialog-action-logistic.c index 8640beef9b..5fb5570315 100644 --- a/src/ui/gui/psppire-dialog-action-logistic.c +++ b/src/ui/gui/psppire-dialog-action-logistic.c @@ -163,15 +163,48 @@ generate_syntax (PsppireDialogAction *a) g_string_append (strx, dep); - g_string_append (strx, " WITH "); + g_string_append (strx, " WITH"); - psppire_var_view_append_names (PSPPIRE_VAR_VIEW (rd->indep_vars), 0, strx); + GSList *vars = psppire_var_view_list_names (PSPPIRE_VAR_VIEW (rd->indep_vars), 0); + GSList *node = vars; - g_string_append (strx, "\n\t/CRITERIA ="); + 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); - g_string_append_printf (strx, " CUT(%g)", rd->cut_point); - g_string_append_printf (strx, " ITERATE(%d)", rd->max_iterations); + 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); if (rd->conf) {