From e552b78ccafd962fc00c1092bd7e22ed6676d527 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 31 Dec 2020 21:57:30 -0800 Subject: [PATCH] output: Improve comments. --- src/output/pivot-output.c | 24 ++++++++++++++++++++++++ src/output/pivot-table.c | 4 ---- src/output/pivot-table.h | 2 +- src/output/spv/spv.h | 4 ++-- src/output/table.c | 5 +---- src/output/table.h | 2 +- 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/output/pivot-output.c b/src/output/pivot-output.c index 1a4ac9db7c..c8ca2c19d6 100644 --- a/src/output/pivot-output.c +++ b/src/output/pivot-output.c @@ -190,6 +190,13 @@ draw_line (struct table *t, const struct table_border_style *styles, table_vline (t, rule, a, b0, b1); } +/* Fills row or column headings into T. + + This function uses terminology and variable names for column headings, but + it also applies to row headings because it uses variables for the + differences, e.g. when for column headings it would use the H axis, it + instead uses 'h', which is set to H for column headings and V for row + headings. */ static void compose_headings (struct table *t, const struct pivot_axis *a_axis, enum table_axis a, @@ -348,6 +355,23 @@ compose_headings (struct table *t, vrules[x1] = true; } } + + /* Draws the horizontal lines within a dimension, that is, those + that separate a separating a category (or group) from its + parent group or dimension's label. Our running example + doesn't have groups but the ==== lines below show the + separators between categories and their dimension label: + + +-----------------------------------------------------+ + | bbbb | + +=================+=================+=================+ + | bbbb1 | bbbb2 | bbbb3 | + +-----------------+-----------------+-----------------+ + | aaaa | aaaa | aaaa | + +=====+=====+=====+=====+=====+=====+=====+=====+=====+ + |aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3| + +-----+-----+-----+-----+-----+-----+-----+-----+-----+ + */ if (c->parent && c->parent->show_label) draw_line (t, borders, cat_col_horz, a, y1, x1 + a_ofs, x2 + a_ofs - 1); diff --git a/src/output/pivot-table.c b/src/output/pivot-table.c index aa5b181c52..a01bae388d 100644 --- a/src/output/pivot-table.c +++ b/src/output/pivot-table.c @@ -1389,10 +1389,6 @@ pivot_table_assign_label_depth (struct pivot_table *table) pivot_axis_assign_label_depth (table, PIVOT_AXIS_LAYER, false); } -/* Footnotes. */ - - - static void indent (int indentation) { diff --git a/src/output/pivot-table.h b/src/output/pivot-table.h index de50c7f39e..56ca865a2d 100644 --- a/src/output/pivot-table.h +++ b/src/output/pivot-table.h @@ -428,7 +428,7 @@ struct pivot_table bool show_grid_lines; bool show_title; bool show_caption; - size_t *current_layer; /* axis[PIVOT_AXIS_LAYER].n_dimensions elements. */ + size_t *current_layer; /* axes[PIVOT_AXIS_LAYER].n_dimensions elements. */ enum settings_value_show show_values; enum settings_value_show show_variables; struct fmt_spec weight_format; diff --git a/src/output/spv/spv.h b/src/output/spv/spv.h index 6857d9b3b6..d1706f4e7e 100644 --- a/src/output/spv/spv.h +++ b/src/output/spv/spv.h @@ -116,8 +116,8 @@ struct spv_item char *structure_member; enum spv_item_type type; - char *label; - char *command_id; /* Unique command identifier. */ + char *label; /* Localized label. */ + char *command_id; /* Non-localized unique command identifier. */ /* Whether the item is visible. For SPV_ITEM_HEADING, false indicates that the item is collapsed. diff --git a/src/output/table.c b/src/output/table.c index 5087441224..2691b79e0d 100644 --- a/src/output/table.c +++ b/src/output/table.c @@ -693,10 +693,7 @@ table_cell_is_empty (const struct table *table, int c, int r) } /* Initializes CELL with the contents of the table cell at column X and row Y - within TABLE. When CELL is no longer needed, the caller is responsible for - freeing it by calling table_cell_free(CELL). - - The caller must ensure that CELL is destroyed before TABLE is unref'ed. */ + within TABLE. */ void table_get_cell (const struct table *t, int x, int y, struct table_cell *cell) { diff --git a/src/output/table.h b/src/output/table.h index 07c88874c8..85d063e8b6 100644 --- a/src/output/table.h +++ b/src/output/table.h @@ -19,7 +19,7 @@ /* Tables. -. A table is a rectangular grid of cells. Cells can be joined to form larger + A table is a rectangular grid of cells. Cells can be joined to form larger cells. Rows and columns can be separated by rules of various types. Rows at the top and bottom of a table and columns at the left and right edges of a table can be designated as headers, which means that if the table must be -- 2.30.2