projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5cc8d99
)
Break ctables_cell_insert__() from ctables_cell_add__()
author
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 15 Jan 2022 05:03:11 +0000
(21:03 -0800)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 15 Jan 2022 05:03:11 +0000
(21:03 -0800)
src/language/stats/ctables.c
patch
|
blob
|
history
diff --git
a/src/language/stats/ctables.c
b/src/language/stats/ctables.c
index ca2cfd9b66d2b7e3d05141948019627ccee8adc5..2e0b51334f2aac778662163650a56a342e991236 100644
(file)
--- a/
src/language/stats/ctables.c
+++ b/
src/language/stats/ctables.c
@@
-2206,11
+2206,10
@@
ctables_categories_total (const struct ctables_categories *c)
: NULL);
}
: NULL);
}
-static
void
+static
struct ctables_cell *
ctables_cell_insert__ (struct ctables_table *t, const struct ccase *c,
size_t ix[PIVOT_N_AXES],
ctables_cell_insert__ (struct ctables_table *t, const struct ccase *c,
size_t ix[PIVOT_N_AXES],
- const struct ctables_category *cats[PIVOT_N_AXES][10],
- double weight)
+ const struct ctables_category *cats[PIVOT_N_AXES][10])
{
const struct ctables_nest *ss = &t->stacks[t->summary_axis].nests[ix[t->summary_axis]];
{
const struct ctables_nest *ss = &t->stacks[t->summary_axis].nests[ix[t->summary_axis]];
@@
-2254,7
+2253,7
@@
ctables_cell_insert__ (struct ctables_table *t, const struct ccase *c,
goto not_equal;
}
goto not_equal;
}
-
goto summarize
;
+
return cell
;
not_equal: ;
}
not_equal: ;
}
@@
-2294,8
+2293,18
@@
ctables_cell_insert__ (struct ctables_table *t, const struct ccase *c,
for (enum ctables_domain_type dt = 0; dt < N_CTDTS; dt++)
cell->domains[dt] = ctables_domain_insert (t, cell, dt);
hmap_insert (&t->cells, &cell->node, hash);
for (enum ctables_domain_type dt = 0; dt < N_CTDTS; dt++)
cell->domains[dt] = ctables_domain_insert (t, cell, dt);
hmap_insert (&t->cells, &cell->node, hash);
+ return cell;
+}
+
+static void
+ctables_cell_add__ (struct ctables_table *t, const struct ccase *c,
+ size_t ix[PIVOT_N_AXES],
+ const struct ctables_category *cats[PIVOT_N_AXES][10],
+ double weight)
+{
+ struct ctables_cell *cell = ctables_cell_insert__ (t, c, ix, cats);
+ const struct ctables_nest *ss = &t->stacks[t->summary_axis].nests[ix[t->summary_axis]];
-summarize: ;
const struct ctables_summary_spec_set *sss
= (cell->total ? &ss->total_sss : &ss->cell_sss);
for (size_t i = 0; i < sss->n; i++)
const struct ctables_summary_spec_set *sss
= (cell->total ? &ss->total_sss : &ss->cell_sss);
for (size_t i = 0; i < sss->n; i++)
@@
-2328,7
+2337,7
@@
recurse_totals (struct ctables_table *t, const struct ccase *c,
{
const struct ctables_category *save = cats[a][i];
cats[a][i] = total;
{
const struct ctables_category *save = cats[a][i];
cats[a][i] = total;
- ctables_cell_
insert
__ (t, c, ix, cats, weight);
+ ctables_cell_
add
__ (t, c, ix, cats, weight);
recurse_totals (t, c, ix, cats, weight, a, i + 1);
cats[a][i] = save;
}
recurse_totals (t, c, ix, cats, weight, a, i + 1);
cats[a][i] = save;
}
@@
-2371,7
+2380,7
@@
ctables_cell_insert (struct ctables_table *t,
}
}
}
}
- ctables_cell_
insert
__ (t, c, ix, cats, weight);
+ ctables_cell_
add
__ (t, c, ix, cats, weight);
recurse_totals (t, c, ix, cats, weight, 0, 0);
recurse_totals (t, c, ix, cats, weight, 0, 0);
@@
-2387,7
+2396,7
@@
ctables_cell_insert (struct ctables_table *t,
if (save->subtotal)
{
cats[a][i] = save->subtotal;
if (save->subtotal)
{
cats[a][i] = save->subtotal;
- ctables_cell_
insert
__ (t, c, ix, cats, weight);
+ ctables_cell_
add
__ (t, c, ix, cats, weight);
cats[a][i] = save;
}
}
cats[a][i] = save;
}
}