-#include <libpspp/hash.h>
-#include <libpspp/pool.h>
+#include <data/procedure.h>
+#include <data/value-labels.h>
+#include <data/variable.h>
-#include <libpspp/message.h>
+#include <language/lexer/variable-parser.h>
+#include <libpspp/alloc.h>
+#include <libpspp/array.h>
+#include <libpspp/assertion.h>
+#include <libpspp/compiler.h>
+#include <libpspp/hash.h>
+write[wr_]=none,cells,all;
+format=fmt:!labels/nolabels/novallabs,
val:!avalue/dvalue,
+write[wr_]=none,cells,all;
+format=fmt:!labels/nolabels/novallabs,
val:!avalue/dvalue,
-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 postcalc (void *);
+static int internal_cmd_crosstabs (struct dataset *ds);
+static void precalc (const struct ccase *, void *, const struct dataset *);
+static bool calc_general (const struct ccase *, void *, const struct dataset *);
+static bool calc_integer (const struct ccase *, void *, const struct dataset *);
+static bool postcalc (void *, const struct dataset *);
static void submit (struct tab_table *);
static void format_short (char *s, const struct fmt_spec *fp,
static void submit (struct tab_table *);
static void format_short (char *s, const struct fmt_spec *fp,
- if (!parse_variables (default_dict, &variables, &variables_cnt,
+ if (!parse_variables (dataset_dict (ds), &variables, &variables_cnt,
static unsigned hash_table_entry (const void *, void *);
/* Set up the crosstabulation tables for processing. */
static unsigned hash_table_entry (const void *, void *);
/* Set up the crosstabulation tables for processing. */
if (mode == GENERAL)
{
gen_tab = hsh_create (512, compare_table_entry, hash_table_entry,
if (mode == GENERAL)
{
gen_tab = hsh_create (512, compare_table_entry, hash_table_entry,
n_sorted_tab + 1, sizeof *sorted_tab);
sorted_tab[n_sorted_tab] = NULL;
}
n_sorted_tab + 1, sizeof *sorted_tab);
sorted_tab[n_sorted_tab] = NULL;
}
tab_headers (summary, 1, 0, 3, 0);
tab_joint_text (summary, 1, 0, 6, 0, TAB_CENTER, _("Cases"));
tab_joint_text (summary, 1, 1, 2, 1, TAB_CENTER, _("Valid"));
tab_headers (summary, 1, 0, 3, 0);
tab_joint_text (summary, 1, 0, 6, 0, TAB_CENTER, _("Cases"));
tab_joint_text (summary, 1, 1, 2, 1, TAB_CENTER, _("Valid"));
/* Number of variables from the crosstabulation to consider. This is
either x->nvar, if pivoting is on, or 2, if pivoting is off. */
/* Number of variables from the crosstabulation to consider. This is
either x->nvar, if pivoting is on, or 2, if pivoting is off. */
(pe - pb) / n_cols * 3 / 2 * N_CHISQ + 10, 1);
tab_headers (chisq, 1 + (nvar - 2), 0, 1, 0);
(pe - pb) / n_cols * 3 / 2 * N_CHISQ + 10, 1);
tab_headers (chisq, 1 + (nvar - 2), 0, 1, 0);
tab_offset (chisq, nvar - 2, 0);
tab_text (chisq, 0, 0, TAB_LEFT | TAT_TITLE, _("Statistic"));
tab_offset (chisq, nvar - 2, 0);
tab_text (chisq, 0, 0, TAB_LEFT | TAT_TITLE, _("Statistic"));
{
sym = tab_create (6 + (nvar - 2), (pe - pb) / n_cols * 7 + 10, 1);
tab_headers (sym, 2 + (nvar - 2), 0, 1, 0);
{
sym = tab_create (6 + (nvar - 2), (pe - pb) / n_cols * 7 + 10, 1);
tab_headers (sym, 2 + (nvar - 2), 0, 1, 0);
tab_offset (sym, nvar - 2, 0);
tab_text (sym, 0, 0, TAB_LEFT | TAT_TITLE, _("Category"));
tab_offset (sym, nvar - 2, 0);
tab_text (sym, 0, 0, TAB_LEFT | TAT_TITLE, _("Category"));
{
risk = tab_create (4 + (nvar - 2), (pe - pb) / n_cols * 4 + 10, 1);
tab_headers (risk, 1 + nvar - 2, 0, 2, 0);
{
risk = tab_create (4 + (nvar - 2), (pe - pb) / n_cols * 4 + 10, 1);
tab_headers (risk, 1 + nvar - 2, 0, 2, 0);
tab_offset (risk, nvar - 2, 0);
tab_joint_text (risk, 2, 0, 3, 0, TAB_CENTER | TAT_TITLE | TAT_PRINTF,
tab_offset (risk, nvar - 2, 0);
tab_joint_text (risk, 2, 0, 3, 0, TAB_CENTER | TAT_TITLE | TAT_PRINTF,
{
direct = tab_create (7 + (nvar - 2), (pe - pb) / n_cols * 7 + 10, 1);
tab_headers (direct, 3 + (nvar - 2), 0, 1, 0);
{
direct = tab_create (7 + (nvar - 2), (pe - pb) / n_cols * 7 + 10, 1);
tab_headers (direct, 3 + (nvar - 2), 0, 1, 0);
tab_offset (direct, nvar - 2, 0);
tab_text (direct, 0, 0, TAB_LEFT | TAT_TITLE, _("Category"));
tab_offset (direct, nvar - 2, 0);
tab_text (direct, 0, 0, TAB_LEFT | TAT_TITLE, _("Category"));
tab_box (t, TAL_2, TAL_2, -1, -1, 0, 0, tab_nc (t) - 1, tab_nr (t) - 1);
tab_box (t, -1, -1, -1, TAL_1, tab_l (t), tab_t (t) - 1, tab_nc (t) - 1,
tab_nr (t) - 1);
tab_box (t, TAL_2, TAL_2, -1, -1, 0, 0, tab_nc (t) - 1, tab_nr (t) - 1);
tab_box (t, -1, -1, -1, TAL_1, tab_l (t), tab_t (t) - 1, tab_nc (t) - 1,
tab_nr (t) - 1);
- tab_box (t, -1, -1, -1, TAL_1 | TAL_SPACING, 0, tab_t (t), tab_l (t) - 1,
+ tab_box (t, -1, -1, -1, TAL_GAP, 0, tab_t (t), tab_l (t) - 1,
tab_nr (t) - 1);
tab_vline (t, TAL_2, tab_l (t), 0, tab_nr (t) - 1);
tab_dim (t, crosstabs_dim);
tab_nr (t) - 1);
tab_vline (t, TAL_2, tab_l (t), 0, tab_nr (t) - 1);
tab_dim (t, crosstabs_dim);
table_value_missing (struct tab_table *table, int c, int r, unsigned char opt,
const union value *v, const struct variable *var)
{
table_value_missing (struct tab_table *table, int c, int r, unsigned char opt,
const union value *v, const struct variable *var)
{
additionally suffixed with a letter `M'. */
static void
format_cell_entry (struct tab_table *table, int c, int r, double value,
additionally suffixed with a letter `M'. */
static void
format_cell_entry (struct tab_table *table, int c, int r, double value,
tab_hline (table, TAL_1, -1, n_cols, 0);
for (c = 0; c < n_cols; c++)
{
tab_hline (table, TAL_1, -1, n_cols, 0);
for (c = 0; c < n_cols; c++)
{
double expected_value = row_tot[r] * col_tot[c] / W;
if (cmd.miss == CRS_REPORT
&& (mv_is_num_user_missing (&x->vars[COL_VAR]->miss, cols[c].f)
|| mv_is_num_user_missing (&x->vars[ROW_VAR]->miss,
rows[r].f)))
double expected_value = row_tot[r] * col_tot[c] / W;
if (cmd.miss == CRS_REPORT
&& (mv_is_num_user_missing (&x->vars[COL_VAR]->miss, cols[c].f)
|| mv_is_num_user_missing (&x->vars[ROW_VAR]->miss,
rows[r].f)))
}
format_cell_entry (table, c, i, v, suffix, mark_missing);
}
format_cell_entry (table, c, i, v, suffix, mark_missing);
if (cmd.miss == CRS_REPORT
&& mv_is_num_user_missing (&x->vars[ROW_VAR]->miss, rows[r].f))
if (cmd.miss == CRS_REPORT
&& mv_is_num_user_missing (&x->vars[ROW_VAR]->miss, rows[r].f))
}
format_cell_entry (table, n_cols, 0, v, suffix, mark_missing);
}
format_cell_entry (table, n_cols, 0, v, suffix, mark_missing);
char suffix = 0;
int i;
if (cmd.miss == CRS_REPORT && c < n_cols
&& mv_is_num_user_missing (&x->vars[COL_VAR]->miss, cols[c].f))
char suffix = 0;
int i;
if (cmd.miss == CRS_REPORT && c < n_cols
&& mv_is_num_user_missing (&x->vars[COL_VAR]->miss, cols[c].f))
}
format_cell_entry (table, c, i, v, suffix, mark_missing);
}
format_cell_entry (table, c, i, v, suffix, mark_missing);