return false;
struct ctables_categories *c = xmalloc (sizeof *c);
- *c = (struct ctables_categories) { .n_refs = n_vars };
+ *c = (struct ctables_categories) { .n_refs = n_vars, .show_empty = true };
for (size_t i = 0; i < n_vars; i++)
{
struct ctables_categories **cp
enum pivot_axis_type a, size_t a_idx)
{
if (a >= PIVOT_N_AXES)
- {
-
- }
- else if (!s->nests[a] || idx >= s->nests[a]->n)
- {
-
-
- }
+ ctables_cell_insert__ (s, c, cats);
+ else if (!s->nests[a] || a_idx >= s->nests[a]->n)
+ ctables_section_recurse_add_empty_categories (s, cats, c, a + 1, 0);
else
{
-
- for (size_t i = 0; i < s->nests[a]->n; i++)
-
+ const struct variable *var = s->nests[a]->vars[a_idx];
+ int width = var_get_width (var);
+ const struct hmap *occurrences = &s->occurrences[a][a_idx];
+ const struct ctables_section_value *sv;
+ HMAP_FOR_EACH (sv, struct ctables_section_value, node, occurrences)
+ {
+ union value *value = case_data_rw (c, var);
+ value_destroy (value, width);
+ value_clone (value, &sv->value, width);
+ cats[a][a_idx] = ctables_categories_match (
+ s->table->categories[var_get_dict_index (var)], value, var);
+ assert (cats[a][a_idx] != NULL);
+ ctables_section_recurse_add_empty_categories (s, cats, c, a, a_idx + 1);
+ }
}
}
const struct ctables_category *cats[PIVOT_N_AXES][10]; /* XXX */
struct ccase *c = case_create (dict_get_proto (s->table->ctables->dict));
- ctables_section_recurse_add_empty_categories (s, c, cats, a, 0);
+ ctables_section_recurse_add_empty_categories (s, cats, c, 0, 0);
+ case_unref (c);
}
static bool
.n_refs = n_vars,
.cats = cat,
.n_cats = 1,
+ .show_empty = true,
};
struct ctables_categories **categories = xnmalloc (n_vars,