static void
ctables_cell_add__ (struct ctables_section *s, const struct ccase *c,
const struct ctables_category *cats[PIVOT_N_AXES][10],
- double d_weight, double e_weight)
+ bool is_included, double d_weight, double e_weight)
{
struct ctables_cell *cell = ctables_cell_insert__ (s, c, cats);
const struct ctables_nest *ss = s->nests[s->table->summary_axis];
const struct ctables_summary_spec_set *specs = &ss->specs[cell->sv];
const union value *value = case_data (c, specs->var);
bool is_missing = var_is_value_missing (specs->var, value);
- bool is_included;
- bool scale_missing;
- if (specs->is_scale)
- {
- is_included = !is_missing;
- scale_missing = is_missing || is_listwise_missing (specs, c);
- }
- else
- {
- is_included = (cats[s->table->summary_axis][ss->summary_idx]->type
- != CCT_EXCLUDED_MISSING);
- scale_missing = false;
- }
+ bool scale_missing = specs->is_scale && (is_missing || is_listwise_missing (specs, c));
for (size_t i = 0; i < specs->n; i++)
ctables_summary_add (&cell->summaries[i], &specs->specs[i],
static void
recurse_totals (struct ctables_section *s, const struct ccase *c,
const struct ctables_category *cats[PIVOT_N_AXES][10],
- double d_weight, double e_weight,
+ bool is_included, double d_weight, double e_weight,
enum pivot_axis_type start_axis, size_t start_nest)
{
for (enum pivot_axis_type a = start_axis; a < PIVOT_N_AXES; a++)
if (total)
{
const struct ctables_category *save = cats[a][i];
- if (save->type != CCT_EXCLUDED_MISSING)
- /* XXX ^^ this shows why we need to keep track of
- 'excluded_missing' (or 'is_included') at a high level,
- because it gets replaced by a total category. So we need to
- restore that and plumb it through again. */
- {
- cats[a][i] = total;
- ctables_cell_add__ (s, c, cats, d_weight, e_weight);
- recurse_totals (s, c, cats, d_weight, e_weight, a, i + 1);
- cats[a][i] = save;
- }
+ cats[a][i] = total;
+ ctables_cell_add__ (s, c, cats, is_included, d_weight, e_weight);
+ recurse_totals (s, c, cats, is_included, d_weight, e_weight, a, i + 1);
+ cats[a][i] = save;
}
}
start_nest = 0;
static void
recurse_subtotals (struct ctables_section *s, const struct ccase *c,
const struct ctables_category *cats[PIVOT_N_AXES][10],
- double d_weight, double e_weight,
+ bool is_included, double d_weight, double e_weight,
enum pivot_axis_type start_axis, size_t start_nest)
{
for (enum pivot_axis_type a = start_axis; a < PIVOT_N_AXES; a++)
if (save->subtotal)
{
cats[a][i] = save->subtotal;
- ctables_cell_add__ (s, c, cats, d_weight, e_weight);
- recurse_subtotals (s, c, cats, d_weight, e_weight, a, i + 1);
+ ctables_cell_add__ (s, c, cats, is_included, d_weight, e_weight);
+ recurse_subtotals (s, c, cats, is_included, d_weight, e_weight, a, i + 1);
cats[a][i] = save;
}
}
{
const struct ctables_category *cats[PIVOT_N_AXES][10]; /* XXX */
- bool excluded_missing = false;
+ bool is_included = true;
for (enum pivot_axis_type a = 0; a < PIVOT_N_AXES; a++)
{
.hide = true,
};
cats[a][i] = &cct_excluded_missing;
- excluded_missing = true;
+ is_included = false;
}
}
}
- if (!excluded_missing)
+ if (is_included)
for (enum pivot_axis_type a = 0; a < PIVOT_N_AXES; a++)
{
const struct ctables_nest *nest = s->nests[a];
}
}
- ctables_cell_add__ (s, c, cats, d_weight, e_weight);
- recurse_totals (s, c, cats, d_weight, e_weight, 0, 0);
- recurse_subtotals (s, c, cats, d_weight, e_weight, 0, 0);
+ ctables_cell_add__ (s, c, cats, is_included, d_weight, e_weight);
+ recurse_totals (s, c, cats, is_included, d_weight, e_weight, 0, 0);
+ recurse_subtotals (s, c, cats, is_included, d_weight, e_weight, 0, 0);
}
struct merge_item