X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fcrosstabs.q;h=a2115cef8aaac660d337e03e05f5b5a1336cb7be;hb=92f198d13c9214c0d75b936f0ea0dc2684ea914b;hp=55c92d8c4b2e9b6e768fdcecc9aa1085dab14664;hpb=81fff61a96bece351e381ad3fef8ab1248a952ba;p=pspp diff --git a/src/language/stats/crosstabs.q b/src/language/stats/crosstabs.q index 55c92d8c4b..a2115cef8a 100644 --- a/src/language/stats/crosstabs.q +++ b/src/language/stats/crosstabs.q @@ -42,9 +42,12 @@ #include #include #include +#include #include +#include #include #include +#include #include #include #include @@ -66,7 +69,7 @@ crosstabs (crs_): *^tables=custom; +variables=custom; - +missing=miss:!table/include/report; + missing=miss:!table/include/report; +write[wr_]=none,cells,all; +format=fmt:!labels/nolabels/novallabs, val:!avalue/dvalue, @@ -173,9 +176,9 @@ static struct pool *pl_tc; /* For table cells. */ static struct pool *pl_col; /* For column data. */ static int internal_cmd_crosstabs (void); -static void precalc (void *); -static bool calc_general (struct ccase *, void *); -static bool calc_integer (struct ccase *, void *); +static void precalc (const struct ccase *, void *); +static bool calc_general (const struct ccase *, void *); +static bool calc_integer (const struct ccase *, void *); static void postcalc (void *); static void submit (struct tab_table *); @@ -209,7 +212,7 @@ internal_cmd_crosstabs (void) pl_tc = pool_create (); pl_col = pool_create (); - if (!parse_crosstabs (&cmd)) + if (!parse_crosstabs (&cmd, NULL)) return CMD_FAILURE; mode = variables ? INTEGER : GENERAL; @@ -299,7 +302,7 @@ internal_cmd_crosstabs (void) /* Parses the TABLES subcommand. */ static int -crs_custom_tables (struct cmd_crosstabs *cmd UNUSED) +crs_custom_tables (struct cmd_crosstabs *cmd UNUSED, void *aux UNUSED) { struct var_set *var_set; int n_by; @@ -403,7 +406,7 @@ crs_custom_tables (struct cmd_crosstabs *cmd UNUSED) /* Parses the VARIABLES subcommand. */ static int -crs_custom_variables (struct cmd_crosstabs *cmd UNUSED) +crs_custom_variables (struct cmd_crosstabs *cmd UNUSED, void *aux UNUSED) { if (nxtab) { @@ -485,8 +488,9 @@ static unsigned hash_table_entry (const void *, void *); /* Set up the crosstabulation tables for processing. */ static void -precalc (void *aux UNUSED) +precalc (const struct ccase *first, void *aux UNUSED) { + output_split_file_values (first); if (mode == GENERAL) { gen_tab = hsh_create (512, compare_table_entry, hash_table_entry, @@ -558,7 +562,7 @@ precalc (void *aux UNUSED) /* Form crosstabulations for general mode. */ static bool -calc_general (struct ccase *c, void *aux UNUSED) +calc_general (const struct ccase *c, void *aux UNUSED) { int bad_warn = 1; @@ -632,7 +636,7 @@ calc_general (struct ccase *c, void *aux UNUSED) } static bool -calc_integer (struct ccase *c, void *aux UNUSED) +calc_integer (const struct ccase *c, void *aux UNUSED) { int bad_warn = 1; @@ -1659,7 +1663,7 @@ static void table_value_missing (struct tab_table *table, int c, int r, unsigned char opt, const union value *v, const struct variable *var) { - struct fixed_string s; + struct substring s; const char *label = val_labs_find (var->val_labs, *v); if (label) @@ -1706,7 +1710,7 @@ format_cell_entry (struct tab_table *table, int c, int r, double value, { const struct fmt_spec f = {FMT_F, 10, 1}; union value v; - struct fixed_string s; + struct substring s; s.length = 10; s.string = tab_alloc (table, 16); @@ -1796,8 +1800,7 @@ display_crosstabulation (void) * (1. - col_tot[c] / W))); break; default: - assert (0); - abort (); + NOT_REACHED (); } format_cell_entry (table, c, i, v, suffix, mark_missing); @@ -1852,8 +1855,7 @@ display_crosstabulation (void) v = 0.; break; default: - assert (0); - abort (); + NOT_REACHED (); } format_cell_entry (table, n_cols, 0, v, suffix, mark_missing); @@ -1908,8 +1910,7 @@ display_crosstabulation (void) case CRS_CL_ASRESIDUAL: continue; default: - assert (0); - abort (); + NOT_REACHED (); } format_cell_entry (table, c, i, v, suffix, mark_missing);