+
+ struct ctables_cell *cell;
+ HMAP_FOR_EACH (cell, struct ctables_cell, node, &t->cells)
+ {
+ if (cell->hide)
+ continue;
+
+ const struct ctables_nest *nest = &t->stacks[t->summary_axis].nests[cell->axes[t->summary_axis].stack_idx];
+ const struct ctables_summary_spec_set *specs = &nest->specs[cell->sv];
+ for (size_t j = 0; j < specs->n; j++)
+ {
+ size_t dindexes[5];
+ size_t n_dindexes = 0;
+
+ if (summary_dimension)
+ dindexes[n_dindexes++] = specs->specs[j].axis_idx;
+
+ if (categories_dimension)
+ {
+ dindexes[n_dindexes++] = 0; /* XXX */
+ }
+
+ for (enum pivot_axis_type a = 0; a < PIVOT_N_AXES; a++)
+ if (d[a])
+ {
+ int leaf = cell->axes[a].leaf;
+ if (a == t->summary_axis && !summary_dimension)
+ leaf += j;
+ dindexes[n_dindexes++] = leaf;
+ }
+
+ double d = ctables_summary_value (cell, &cell->summaries[j], &specs->specs[j]);
+ struct pivot_value *value = pivot_value_new_number (d);
+ value->numeric.format = specs->specs[j].format;
+ pivot_table_put (pt, dindexes, n_dindexes, value);
+ }
+ }
+