X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Froc.c;h=d1461a599f0724471a37aaf41a1120c336670f52;hb=3a9c93bde727eb6bef3cd607e2ca4ea1d969a98f;hp=1d21a4f6a1221ed6b83f3c2bbb8d4e25c457c95a;hpb=cb72db62c20ecab427229110820c5b053d0663c4;p=pspp-builds.git diff --git a/src/language/stats/roc.c b/src/language/stats/roc.c index 1d21a4f6..d1461a59 100644 --- a/src/language/stats/roc.c +++ b/src/language/stats/roc.c @@ -18,28 +18,24 @@ #include -#include -#include -#include -#include -#include - #include #include #include #include #include -#include +#include #include - - +#include +#include +#include +#include #include +#include +#include +#include +#include #include -#include - -#include -#include #include "gettext.h" #define _(msgid) gettext (msgid) @@ -51,7 +47,7 @@ struct cmd_roc const struct variable **vars; const struct dictionary *dict; - const struct variable *state_var ; + const struct variable *state_var; union value state_value; /* Plot the roc curve */ @@ -97,7 +93,9 @@ cmd_roc (struct lexer *lexer, struct dataset *ds) roc.pos = roc.pos_weighted = 0; roc.neg = roc.neg_weighted = 0; roc.dict = dataset_dict (ds); + roc.state_var = NULL; + lex_match (lexer, '/'); if (!parse_variables_const (lexer, dict, &roc.vars, &roc.n_vars, PV_APPEND | PV_NO_DUPLICATE | PV_NUMERIC)) goto error; @@ -114,6 +112,7 @@ cmd_roc (struct lexer *lexer, struct dataset *ds) goto error; } + value_init (&roc.state_value, var_get_width (roc.state_var)); parse_value (lexer, &roc.state_value, var_get_width (roc.state_var)); @@ -273,10 +272,13 @@ cmd_roc (struct lexer *lexer, struct dataset *ds) if ( ! run_roc (ds, &roc)) goto error; + value_destroy (&roc.state_value, var_get_width (roc.state_var)); free (roc.vars); return CMD_SUCCESS; error: + if ( roc.state_var) + value_destroy (&roc.state_value, var_get_width (roc.state_var)); free (roc.vars); return CMD_FAILURE; } @@ -936,7 +938,6 @@ show_auc (struct roc_state *rs, const struct cmd_roc *roc) tab_headers (tbl, n_cols - n_fields, 0, 1, 0); - tab_dim (tbl, tab_natural_dimensions, NULL, NULL); tab_text (tbl, n_cols - n_fields, 1, TAT_TITLE, _("Area")); @@ -1028,8 +1029,6 @@ show_summary (const struct cmd_roc *roc) tab_headers (tbl, 1, 0, 2, 0); - tab_dim (tbl, tab_natural_dimensions, NULL, NULL); - tab_box (tbl, TAL_2, TAL_2, -1, -1, @@ -1090,8 +1089,6 @@ show_coords (struct roc_state *rs, const struct cmd_roc *roc) tab_headers (tbl, 1, 0, 1, 0); - tab_dim (tbl, tab_natural_dimensions, NULL, NULL); - tab_hline (tbl, TAL_2, 0, n_cols - 1, 1); if ( roc->n_vars > 1) @@ -1168,7 +1165,7 @@ output_roc (struct roc_state *rs, const struct cmd_roc *roc) for (i = 0; i < roc->n_vars; i++) roc_chart_add_var (rc, var_get_name (roc->vars[i]), rs[i].cutpoint_rdr); - chart_submit (roc_chart_get_chart (rc)); + roc_chart_submit (rc); } show_auc (rs, roc);