X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fctables.c;h=2833ce6b519911419408066728faa81cf50c375f;hb=7cd70df07f7e183645853716642810afd4b87bcd;hp=da511b69510f16bc7fb9d303392f7d719a1f4c55;hpb=15e323443edce619168aede1421aa195e7f7ecc2;p=pspp diff --git a/src/language/stats/ctables.c b/src/language/stats/ctables.c index da511b6951..2833ce6b51 100644 --- a/src/language/stats/ctables.c +++ b/src/language/stats/ctables.c @@ -4362,6 +4362,8 @@ ctables_format (double d, const struct fmt_spec *format, static void ctables_table_output (struct ctables *ct, struct ctables_table *t) { + printf ("\n"); + struct pivot_table *pt = pivot_table_create__ ( (t->title ? pivot_value_new_user_text (t->title, SIZE_MAX) @@ -4379,6 +4381,7 @@ ctables_table_output (struct ctables *ct, struct ctables_table *t) && t->summary_specs.n > 1)); if (summary_dimension) { + printf ("summary_dimension\n"); struct pivot_dimension *d = pivot_dimension_create ( pt, t->slabels_axis, N_("Statistics")); const struct ctables_summary_spec_set *specs = &t->summary_specs; @@ -4392,6 +4395,7 @@ ctables_table_output (struct ctables *ct, struct ctables_table *t) bool categories_dimension = t->clabels_example != NULL; if (categories_dimension) { + printf ("categories_dimension\n"); struct pivot_dimension *d = pivot_dimension_create ( pt, t->label_axis[t->clabels_from_axis], t->clabels_from_axis == PIVOT_AXIS_ROW @@ -4414,17 +4418,9 @@ ctables_table_output (struct ctables *ct, struct ctables_table *t) struct pivot_dimension *d[PIVOT_N_AXES]; for (enum pivot_axis_type a = 0; a < PIVOT_N_AXES; a++) { - static const char *names[] = { - [PIVOT_AXIS_ROW] = N_("Rows"), - [PIVOT_AXIS_COLUMN] = N_("Columns"), - [PIVOT_AXIS_LAYER] = N_("Layers"), - }; - d[a] = (t->axes[a] || a == t->summary_axis - ? pivot_dimension_create (pt, a, names[a]) - : NULL); - if (!d[a]) + d[a] = NULL; + if (!t->axes[a] && a != t->summary_axis) continue; - assert (t->axes[a]); for (size_t i = 0; i < t->stacks[a].n; i++) @@ -4536,6 +4532,17 @@ ctables_table_output (struct ctables *ct, struct ctables_table *t) }; } + if (!n_levels) + goto next_free; + + static const char *names[] = { + [PIVOT_AXIS_ROW] = N_("Rows"), + [PIVOT_AXIS_COLUMN] = N_("Columns"), + [PIVOT_AXIS_LAYER] = N_("Layers"), + }; + d[a] = pivot_dimension_create (pt, a, names[a]); + printf ("%s dimension\n", names[a]); + /* Pivot categories: - variable label for nest->vars[0], if vlabel != CTVL_NONE @@ -4633,8 +4640,9 @@ ctables_table_output (struct ctables *ct, struct ctables_table *t) cell->axes[a].leaf = prev_leaf; } - free (sorted); free (groups); + next_free: + free (sorted); free (levels); free (sections); }