X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fpivot-output.c;h=c3751d04d888dff563b28a1155c18143c64f8b80;hb=9654a384b04ef5c35a9a305d65357262dcf52e70;hp=cd21e2cb195b74c81208ee90fe9860c7bb74a0ea;hpb=21f20b8cb6460fd5ac9db7fde038bc00cfa80831;p=pspp diff --git a/src/output/pivot-output.c b/src/output/pivot-output.c index cd21e2cb19..c3751d04d8 100644 --- a/src/output/pivot-output.c +++ b/src/output/pivot-output.c @@ -23,12 +23,10 @@ #include "data/settings.h" #include "libpspp/assertion.h" #include "libpspp/pool.h" -#include "output/page-eject-item.h" +#include "output/output-item.h" #include "output/pivot-table.h" -#include "output/table-item.h" #include "output/table-provider.h" #include "output/table.h" -#include "output/text-item.h" #include "gl/minmax.h" #include "gl/xalloc.h" @@ -235,7 +233,7 @@ compose_headings (struct table *t, |aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3| +-----+-----+-----+-----+-----+-----+-----+-----+-----+ */ - bool *vrules = xzalloc (n_columns + 1); + bool *vrules = XCALLOC (n_columns + 1, bool); vrules[0] = vrules[n_columns] = true; for (int dim_index = h_axis->n_dimensions; --dim_index >= 0; ) { @@ -396,12 +394,13 @@ add_references (const struct pivot_table *pt, const struct table *table, if (x == cell.d[H][0] && y == cell.d[V][0]) { - for (size_t i = 0; i < cell.value->n_footnotes; i++) + const struct pivot_value_ex *ex = pivot_value_ex (cell.value); + for (size_t i = 0; i < ex->n_footnotes; i++) { - size_t idx = cell.value->footnote_indexes[i]; + size_t idx = ex->footnote_indexes[i]; assert (idx < pt->n_footnotes); - if (!refs[idx]) + if (!refs[idx] && pt->footnotes[idx]->show) { refs[idx] = true; (*n_refs)++; @@ -427,7 +426,7 @@ collect_footnotes (const struct pivot_table *pt, return NULL; } - bool *refs = xzalloc (pt->n_footnotes); + bool *refs = XCALLOC (pt->n_footnotes, bool); size_t n_refs = 0; add_references (pt, title, refs, &n_refs); add_references (pt, layers, refs, &n_refs); @@ -595,7 +594,7 @@ pivot_output (const struct pivot_table *pt, if (n_layers > 0) { layers = create_aux_table (pt, 1, n_layers, PIVOT_AREA_LAYERS); - size_t y = 0; + size_t y = n_layers - 1; for (size_t i = 0; i < layer_axis->n_dimensions; i++) { const struct pivot_dimension *d = layer_axis->dimensions[i]; @@ -603,11 +602,9 @@ pivot_output (const struct pivot_table *pt, continue; struct string s = DS_EMPTY_INITIALIZER; - pivot_value_format (d->root->name, pt, &s); - ds_put_cstr (&s, ": "); pivot_value_format (d->data_leaves[layer_indexes[i]]->name, pt, &s); fill_cell_owned (layers, 0, y, 0, y, PIVOT_AREA_LAYERS, &s, false); - y++; + y--; } } else @@ -635,7 +632,7 @@ pivot_output (const struct pivot_table *pt, for (size_t i = 0; i < nf; i++) { struct string s = DS_EMPTY_INITIALIZER; - pivot_value_format (f[i]->marker, pt, &s); + pivot_footnote_format_marker (f[i], pt, &s); ds_put_cstr (&s, ". "); pivot_value_format (f[i]->content, pt, &s); fill_cell_owned (footnotes, 0, i, 0, i, PIVOT_AREA_FOOTER, &s, @@ -665,5 +662,5 @@ pivot_output (const struct pivot_table *pt, void pivot_table_submit (struct pivot_table *pt) { - table_item_submit (table_item_create (pt)); + output_item_submit (table_item_create (pt)); }