struct ctables_summary_spec_set
{
- struct ctables_summary_spec *summaries;
+ struct ctables_summary_spec *specs;
size_t n;
size_t allocated;
ctables_summary_spec_set_uninit (struct ctables_summary_spec_set *set)
{
for (size_t i = 0; i < set->n; i++)
- ctables_summary_spec_uninit (&set->summaries[i]);
- free (set->summaries);
+ ctables_summary_spec_uninit (&set->specs[i]);
+ free (set->specs);
}
static bool
struct ctables_summary_spec_set *set = (totals ? &axis->total_sss
: &axis->cell_sss);
if (set->n >= set->allocated)
- set->summaries = x2nrealloc (set->summaries, &set->allocated,
- sizeof *set->summaries);
+ set->specs = x2nrealloc (set->specs, &set->allocated,
+ sizeof *set->specs);
- struct ctables_summary_spec *dst = &set->summaries[set->n++];
+ struct ctables_summary_spec *dst = &set->specs[set->n++];
*dst = (struct ctables_summary_spec) {
.function = function,
.percentile = percentile,
= (cell->total ? &ss->total_sss : &ss->cell_sss);
cell->summaries = xmalloc (sss->n * sizeof *cell->summaries);
for (size_t i = 0; i < sss->n; i++)
- ctables_summary_init (&cell->summaries[i], &sss->summaries[i]);
+ ctables_summary_init (&cell->summaries[i], &sss->specs[i]);
}
for (enum ctables_domain_type dt = 0; dt < N_CTDTS; dt++)
cell->domains[dt] = ctables_domain_insert (t, cell, dt);
const struct ctables_summary_spec_set *sss
= (cell->total ? &ss->total_sss : &ss->cell_sss);
for (size_t i = 0; i < sss->n; i++)
- ctables_summary_add (&cell->summaries[i], &sss->summaries[i], sss->var,
+ ctables_summary_add (&cell->summaries[i], &sss->specs[i], sss->var,
case_data (c, sss->var), weight);
for (enum ctables_domain_type dt = 0; dt < N_CTDTS; dt++)
cell->domains[dt]->valid += weight;
if (!nest->cell_sss.n)
{
struct ctables_summary_spec_set *sss = &nest->cell_sss;
- sss->summaries = xmalloc (sizeof *sss->summaries);
+ sss->specs = xmalloc (sizeof *sss->specs);
sss->n = 1;
enum ctables_summary_function function
= sss->var ? CTSF_MEAN : CTSF_COUNT;
struct ctables_var var = { .is_mrset = false, .var = sss->var };
- *sss->summaries = (struct ctables_summary_spec) {
+ *sss->specs = (struct ctables_summary_spec) {
.function = function,
.format = ctables_summary_default_format (function, &var),
.label = ctables_summary_default_label (function, 0),
for (size_t m = 0; m < sss->n; m++)
{
int leaf = pivot_category_create_leaf (
- parent, pivot_value_new_text (sss->summaries[m].label));
+ parent, pivot_value_new_text (sss->specs[m].label));
if (m == 0)
prev_leaf = leaf;
}
dindexes[n_dindexes++] = leaf;
}
- double d = ctables_summary_value (cell, &cell->summaries[j], &sss->summaries[j]);
+ double d = ctables_summary_value (cell, &cell->summaries[j], &sss->specs[j]);
struct pivot_value *value = pivot_value_new_number (d);
- value->numeric.format = sss->summaries[j].format;
+ value->numeric.format = sss->specs[j].format;
pivot_table_put (pt, dindexes, n_dindexes, value);
}
}