size_t *pc_a_idx_p)
{
assert (cell->postcompute);
- for (enum pivot_axis_type pc_a = 0; ; pc_a++)
- {
- assert (pc_a < PIVOT_N_AXES);
- for (size_t pc_a_idx = 0; pc_a_idx < s->nests[pc_a]->n; pc_a_idx++)
- {
- const struct ctables_cell_value *cv = &cell->axes[pc_a].cvs[pc_a_idx];
- if (cv->category->type == CCT_POSTCOMPUTE)
- {
- if (pc_a_p)
- *pc_a_p = pc_a;
- if (pc_a_idx_p)
- *pc_a_idx_p = pc_a_idx;
- return cv->category->pc;
- }
- }
- }
+ const struct ctables_postcompute *pc = NULL;
+ for (enum pivot_axis_type pc_a = 0; pc_a < PIVOT_N_AXES; pc_a++)
+ for (size_t pc_a_idx = 0; pc_a_idx < s->nests[pc_a]->n; pc_a_idx++)
+ {
+ const struct ctables_cell_value *cv = &cell->axes[pc_a].cvs[pc_a_idx];
+ if (cv->category->type == CCT_POSTCOMPUTE)
+ {
+ if (pc)
+ {
+ /* Multiple postcomputes cross each other. The value is
+ undefined. */
+ return NULL;
+ }
- NOT_REACHED ();
+ pc = cv->category->pc;
+ if (pc_a_p)
+ *pc_a_p = pc_a;
+ if (pc_a_idx_p)
+ *pc_a_idx_p = pc_a_idx;
+ }
+ }
+
+ assert (pc != NULL);
+ return pc;
}
static double
size_t pc_a_idx;
const struct ctables_postcompute *pc = ctables_cell_postcompute (
s, cell, &pc_a, &pc_a_idx);
+ if (!pc)
+ return SYSMIS;
if (pc->specs)
{
dnl - Definition of columns/rows when labels are rotated from one axis to another.
dnl - Preprocessing to distinguish categorical from scale.
dnl - PCOMPUTE:
-dnl * multi-dimensional (multiple CCT_POSTCOMPUTE in one cell)
dnl * dates
dnl
dnl Features not yet tested:
dnl * PCOMPUTE for more than one kind of summary (e.g. [COUNT, ROWPCT]).
dnl * MISSING, OTHERNM
dnl * strings and string ranges
+dnl * multi-dimensional (multiple CCT_POSTCOMPUTE in one cell)
dnl - PPROPERTIES:
dnl * )LABEL[N].
dnl - Summary functions: