From: Ben Pfaff Date: Fri, 30 Oct 2020 06:11:59 +0000 (-0700) Subject: table: Rename area_style to table_area_style for consistency. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6fd6e894861f4f86d1076dc9d9ea59c58b4a14f;p=pspp table: Rename area_style to table_area_style for consistency. Other, similarly situated data structures have a table_ prefix. --- diff --git a/src/output/ascii.c b/src/output/ascii.c index a5faa1f814..8bdcd51d96 100644 --- a/src/output/ascii.c +++ b/src/output/ascii.c @@ -941,7 +941,7 @@ ascii_test_write (struct output_driver *driver, if (!a->file) return; - struct area_style style = { + struct table_area_style style = { .cell_style.halign = TABLE_HALIGN_LEFT, .font_style.bold = bold, .font_style.underline = underline, diff --git a/src/output/pivot-output.c b/src/output/pivot-output.c index 158116117f..1e27c84192 100644 --- a/src/output/pivot-output.c +++ b/src/output/pivot-output.c @@ -53,19 +53,19 @@ find_category (const struct pivot_dimension *d, int dim_index, return NULL; } -static struct area_style * -area_style_override (struct pool *pool, - const struct area_style *in, - const struct cell_style *cell_, - const struct font_style *font_) +static struct table_area_style * +table_area_style_override (struct pool *pool, + const struct table_area_style *in, + const struct cell_style *cell_, + const struct font_style *font_) { const struct cell_style *cell = cell_ ? cell_ : &in->cell_style; const struct font_style *font = font_ ? font_ : &in->font_style; - struct area_style *out = (pool + struct table_area_style *out = (pool ? pool_alloc (pool, sizeof *out) : xmalloc (sizeof *out)); - *out = (struct area_style) { + *out = (struct table_area_style) { .cell_style.halign = cell->halign, .cell_style.valign = cell->valign, .cell_style.decimal_offset = cell->decimal_offset, @@ -91,7 +91,7 @@ area_style_override (struct pool *pool, static void fill_cell (struct table *t, int x1, int y1, int x2, int y2, - const struct area_style *style, int style_idx, + const struct table_area_style *style, int style_idx, const struct pivot_value *value, struct footnote **footnotes, enum settings_value_show show_values, enum settings_value_show show_variables, @@ -118,9 +118,9 @@ fill_cell (struct table *t, int x1, int y1, int x2, int y2, { if (value->cell_style || value->font_style) table_add_style (t, x1, y1, - area_style_override (t->container, style, - value->cell_style, - value->font_style)); + table_area_style_override (t->container, style, + value->cell_style, + value->font_style)); for (size_t i = 0; i < value->n_footnotes; i++) { @@ -137,7 +137,7 @@ fill_cell (struct table *t, int x1, int y1, int x2, int y2, static struct table_item_text * pivot_value_to_table_item_text (const struct pivot_value *value, - const struct area_style *area, + const struct table_area_style *area, struct footnote **footnotes, enum settings_value_show show_values, enum settings_value_show show_variables) @@ -152,7 +152,7 @@ pivot_value_to_table_item_text (const struct pivot_value *value, *text = (struct table_item_text) { .content = ds_steal_cstr (&s), .footnotes = xnmalloc (value->n_footnotes, sizeof *text->footnotes), - .style = area_style_override ( + .style = table_area_style_override ( NULL, area, value->cell_style, value->font_style), }; @@ -195,8 +195,9 @@ compose_headings (struct table *t, enum pivot_border cat_col_horz, enum pivot_border cat_col_vert, const size_t *column_enumeration, size_t n_columns, - const struct area_style *label_style, int label_style_idx, - const struct area_style *corner_style, + const struct table_area_style *label_style, + int label_style_idx, + const struct table_area_style *corner_style, struct footnote **footnotes, enum settings_value_show show_values, enum settings_value_show show_variables, @@ -324,8 +325,8 @@ pivot_table_submit_layer (const struct pivot_table *pt, stub[H], 0, stub[V], 0); for (size_t i = 0; i < PIVOT_N_AREAS; i++) - table->styles[i] = area_style_override (table->container, &pt->areas[i], - NULL, NULL); + table->styles[i] = table_area_style_override ( + table->container, &pt->areas[i], NULL, NULL); for (size_t i = 0; i < PIVOT_N_BORDERS; i++) { @@ -353,9 +354,10 @@ pivot_table_submit_layer (const struct pivot_table *pt, pt->show_variables); footnotes[i] = table_create_footnote ( table, i, content, marker, - area_style_override (table->container, &pt->areas[PIVOT_AREA_FOOTER], - pf->content->cell_style, - pf->content->font_style)); + table_area_style_override (table->container, + &pt->areas[PIVOT_AREA_FOOTER], + pf->content->cell_style, + pf->content->font_style)); free (marker); free (content); } @@ -469,7 +471,7 @@ pivot_table_submit_layer (const struct pivot_table *pt, if (!layers) { layers = xzalloc (sizeof *layers); - layers->style = area_style_override ( + layers->style = table_area_style_override ( NULL, &pt->areas[PIVOT_AREA_LAYERS], NULL, NULL); layers->layers = xnmalloc (layer_axis->n_dimensions, sizeof *layers->layers); diff --git a/src/output/pivot-table.c b/src/output/pivot-table.c index f2967eae81..3e7fb8ca13 100644 --- a/src/output/pivot-table.c +++ b/src/output/pivot-table.c @@ -62,7 +62,7 @@ pivot_area_to_string (enum pivot_area area) } } -const struct area_style * +const struct table_area_style * pivot_area_get_default_style (enum pivot_area area) { #define STYLE(BOLD, H, V, L, R, T, B) { \ @@ -80,7 +80,7 @@ pivot_area_get_default_style (enum pivot_area area) .typeface = (char *) "Sans Serif", \ }, \ } - static const struct area_style default_area_styles[PIVOT_N_AREAS] = { + static const struct table_area_style default_area_styles[PIVOT_N_AREAS] = { [PIVOT_AREA_TITLE] = STYLE(true, CENTER, CENTER, 8,11,1,8), [PIVOT_AREA_CAPTION] = STYLE(false, LEFT, TOP, 8,11,1,1), [PIVOT_AREA_FOOTER] = STYLE(false, LEFT, TOP, 11, 8,2,3), @@ -713,7 +713,8 @@ pivot_table_create__ (struct pivot_value *title, const char *subtype) table->sizing[TABLE_VERT].range[1] = 120; for (size_t i = 0; i < PIVOT_N_AREAS; i++) - area_style_copy (NULL, &table->areas[i], pivot_area_get_default_style (i)); + table_area_style_copy (NULL, &table->areas[i], + pivot_area_get_default_style (i)); /* Set default border styles. */ static const enum table_stroke default_strokes[PIVOT_N_BORDERS] = { @@ -820,7 +821,7 @@ pivot_table_unref (struct pivot_table *table) pivot_value_destroy (table->caption); for (size_t i = 0; i < PIVOT_N_AREAS; i++) - area_style_uninit (&table->areas[i]); + table_area_style_uninit (&table->areas[i]); for (size_t i = 0; i < table->n_dimensions; i++) pivot_dimension_destroy (table->dimensions[i]); @@ -1355,8 +1356,8 @@ pivot_dimension_dump (const struct pivot_dimension *d, int indentation) } static void -area_style_dump (enum pivot_area area, const struct area_style *a, - int indentation) +table_area_style_dump (enum pivot_area area, const struct table_area_style *a, + int indentation) { indent (indentation); printf ("%s: ", pivot_area_to_string (area)); @@ -1504,7 +1505,7 @@ pivot_table_dump (const struct pivot_table *table, int indentation) indent (indentation); printf ("areas:\n"); for (enum pivot_area area = 0; area < PIVOT_N_AREAS; area++) - area_style_dump (area, &table->areas[area], indentation + 1); + table_area_style_dump (area, &table->areas[area], indentation + 1); indent (indentation); printf ("borders:\n"); @@ -1988,7 +1989,7 @@ void pivot_value_get_style (struct pivot_value *value, const struct font_style *base_font_style, const struct cell_style *base_cell_style, - struct area_style *area) + struct table_area_style *area) { font_style_copy (NULL, &area->font_style, (value->font_style ? value->font_style @@ -2001,7 +2002,7 @@ pivot_value_get_style (struct pivot_value *value, /* Copies AREA into VALUE's style. */ void pivot_value_set_style (struct pivot_value *value, - const struct area_style *area) + const struct table_area_style *area) { if (value->font_style) font_style_uninit (value->font_style); diff --git a/src/output/pivot-table.h b/src/output/pivot-table.h index ed8f9b7a2b..b6f746e6bf 100644 --- a/src/output/pivot-table.h +++ b/src/output/pivot-table.h @@ -107,7 +107,7 @@ enum pivot_area }; const char *pivot_area_to_string (enum pivot_area); -const struct area_style *pivot_area_get_default_style (enum pivot_area); +const struct table_area_style *pivot_area_get_default_style (enum pivot_area); /* Table borders for styling purposes. */ enum pivot_border @@ -439,7 +439,7 @@ struct pivot_table char *notes; /* Styles. */ - struct area_style areas[PIVOT_N_AREAS]; + struct table_area_style areas[PIVOT_N_AREAS]; struct table_border_style borders[PIVOT_N_BORDERS]; /* Dimensions. */ @@ -714,8 +714,9 @@ void pivot_value_destroy (struct pivot_value *); void pivot_value_get_style (struct pivot_value *, const struct font_style *base_font_style, const struct cell_style *base_cell_style, - struct area_style *); -void pivot_value_set_style (struct pivot_value *, const struct area_style *); + struct table_area_style *); +void pivot_value_set_style (struct pivot_value *, + const struct table_area_style *); /* Template arguments. */ struct pivot_argument diff --git a/src/output/render.c b/src/output/render.c index 890741a3f9..a7cc3e67b6 100644 --- a/src/output/render.c +++ b/src/output/render.c @@ -1532,7 +1532,7 @@ add_text_page (struct render_pager *p, const struct table_item_text *t, for (size_t i = 0; i < t->n_footnotes; i++) table_add_footnote (tab, 0, 0, t->footnotes[i]); if (t->style) - tab->styles[0] = area_style_clone (tab->container, t->style); + tab->styles[0] = table_area_style_clone (tab->container, t->style); render_pager_add_table (p, tab, min_width); } @@ -1552,7 +1552,7 @@ add_layers_page (struct render_pager *p, table_add_footnote (tab, 0, i, layer->footnotes[j]); } if (layers->style) - tab->styles[0] = area_style_clone (tab->container, layers->style); + tab->styles[0] = table_area_style_clone (tab->container, layers->style); render_pager_add_table (p, tab, min_width); } diff --git a/src/output/spv/spv-legacy-decoder.c b/src/output/spv/spv-legacy-decoder.c index b5f4e9eeac..0c0f954797 100644 --- a/src/output/spv/spv-legacy-decoder.c +++ b/src/output/spv/spv-legacy-decoder.c @@ -578,7 +578,7 @@ optional_px (double inches, int default_px) static void decode_spvdx_style_incremental (const struct spvdx_style *in, const struct spvdx_style *bg, - struct area_style *out) + struct table_area_style *out) { if (in && in->font_weight) out->font_style.bold = in->font_weight == SPVDX_FONT_WEIGHT_BOLD; @@ -644,9 +644,9 @@ decode_spvdx_style_incremental (const struct spvdx_style *in, static void decode_spvdx_style (const struct spvdx_style *in, const struct spvdx_style *bg, - struct area_style *out) + struct table_area_style *out) { - *out = (struct area_style) AREA_STYLE_INITIALIZER; + *out = (struct table_area_style) TABLE_AREA_STYLE_INITIALIZER; decode_spvdx_style_incremental (in, bg, out); } @@ -667,7 +667,7 @@ decode_label_frame (struct pivot_table *table, return NULL; struct pivot_value **target; - struct area_style *area; + struct table_area_style *area; if (lf->label->purpose == SPVDX_PURPOSE_TITLE) { target = &table->title; @@ -697,7 +697,7 @@ decode_label_frame (struct pivot_table *table, else return NULL; - area_style_uninit (area); + table_area_style_uninit (area); decode_spvdx_style (lf->label->style, lf->label->text_frame_style, area); if (target) @@ -1079,14 +1079,14 @@ add_dimension (struct spv_series **series, size_t n, = find_facet_level (v, base_facet_level + n); if (fl) { - struct area_style *area = (axis_type == PIVOT_AXIS_COLUMN - ? &table->areas[PIVOT_AREA_COLUMN_LABELS] - : axis_type == PIVOT_AXIS_ROW - ? &table->areas[PIVOT_AREA_ROW_LABELS] - : NULL); + struct table_area_style *area = (axis_type == PIVOT_AXIS_COLUMN + ? &table->areas[PIVOT_AREA_COLUMN_LABELS] + : axis_type == PIVOT_AXIS_ROW + ? &table->areas[PIVOT_AREA_ROW_LABELS] + : NULL); if (area && fl->axis->label) { - area_style_uninit (area); + table_area_style_uninit (area); decode_spvdx_style (fl->axis->label->style, fl->axis->label->text_frame_style, area); } @@ -1409,7 +1409,7 @@ static void apply_styles_to_value (struct pivot_table *table, struct pivot_value *value, const struct spvdx_set_format *sf, - const struct area_style *base_area_style, + const struct table_area_style *base_area_style, const struct spvdx_style *fg, const struct spvdx_style *bg) { @@ -1464,7 +1464,7 @@ apply_styles_to_value (struct pivot_table *table, } if (fg || bg) { - struct area_style area; + struct table_area_style area; pivot_value_get_style ( value, value->font_style ? value->font_style : &base_area_style->font_style, @@ -1472,7 +1472,7 @@ apply_styles_to_value (struct pivot_table *table, &area); decode_spvdx_style_incremental (fg, bg, &area); pivot_value_set_style (value, &area); - area_style_uninit (&area); + table_area_style_uninit (&area); } } @@ -1491,13 +1491,13 @@ decode_set_cell_properties__ (struct pivot_table *table, && !interval && !major_ticks && !frame && !set_format) { /* Sets alt_fg_color and alt_bg_color. */ - struct area_style area; + struct table_area_style area; decode_spvdx_style (labeling, graph, &area); table->areas[PIVOT_AREA_DATA].font_style.fg[1] = area.font_style.fg[0]; table->areas[PIVOT_AREA_DATA].font_style.bg[1] = area.font_style.bg[0]; - area_style_uninit (&area); + table_area_style_uninit (&area); } else if (graph && !labeling && !interval && !major_ticks && !frame && !set_format) @@ -1529,7 +1529,7 @@ decode_set_cell_properties__ (struct pivot_table *table, struct pivot_category *c = find_category (s, include); if (c) { - const struct area_style *base_area_style + const struct table_area_style *base_area_style = (c->dimension->axis_type == PIVOT_AXIS_ROW ? &table->areas[PIVOT_AREA_ROW_LABELS] : &table->areas[PIVOT_AREA_COLUMN_LABELS]); @@ -1844,7 +1844,7 @@ decode_spvdx_table (const struct spvdx_visualization *v, const char *subtype, } if (v->graph->interval->labeling->style) { - area_style_uninit (&table->areas[PIVOT_AREA_DATA]); + table_area_style_uninit (&table->areas[PIVOT_AREA_DATA]); decode_spvdx_style (v->graph->interval->labeling->style, v->graph->cell_style, &table->areas[PIVOT_AREA_DATA]); diff --git a/src/output/spv/spv-light-decoder.c b/src/output/spv/spv-light-decoder.c index ebac2a5635..a09ac5ba24 100644 --- a/src/output/spv/spv-light-decoder.c +++ b/src/output/spv/spv-light-decoder.c @@ -434,7 +434,7 @@ decode_spvlb_value (const struct pivot_table *table, } static char * WARN_UNUSED_RESULT -decode_spvlb_area (const struct spvlb_area *in, struct area_style *out, +decode_spvlb_area (const struct spvlb_area *in, struct table_area_style *out, const char *encoding) { char *error; @@ -467,7 +467,7 @@ decode_spvlb_area (const struct spvlb_area *in, struct area_style *out, if (error) return error; - *out = (struct area_style) { + *out = (struct table_area_style) { .font_style = { .bold = (in->style & 1) != 0, .italic = (in->style & 2) != 0, diff --git a/src/output/spv/spv-table-look.c b/src/output/spv/spv-table-look.c index 3a2fb4578c..c9945b000c 100644 --- a/src/output/spv/spv-table-look.c +++ b/src/output/spv/spv-table-look.c @@ -144,7 +144,8 @@ spv_table_look_decode (const struct spvsx_table_properties *in, = (f->number_format == SPVSX_NUMBER_FORMAT_NUMERIC); for (int i = 0; i < PIVOT_N_AREAS; i++) - area_style_copy (NULL, &out->areas[i], pivot_area_get_default_style (i)); + table_area_style_copy (NULL, &out->areas[i], + pivot_area_get_default_style (i)); const struct spvsx_cell_format_properties *cfp = in->cell_format_properties; for (size_t i = 0; i < cfp->n_cell_style; i++) @@ -159,7 +160,7 @@ spv_table_look_decode (const struct spvsx_table_properties *in, goto error; } - struct area_style *a = &out->areas[area]; + struct table_area_style *a = &out->areas[area]; const struct spvsx_style *s = c->style; if (s->font_weight) a->font_style.bold = s->font_weight == SPVSX_FONT_WEIGHT_BOLD; @@ -408,7 +409,7 @@ spv_table_look_write (const char *filename, const struct spv_table_look *look) start_elem (xml, "cellFormatProperties"); for (enum pivot_area a = 0; a < PIVOT_N_AREAS; a++) { - const struct area_style *area = &look->areas[a]; + const struct table_area_style *area = &look->areas[a]; const struct font_style *font = &area->font_style; const struct cell_style *cell = &area->cell_style; @@ -511,7 +512,7 @@ spv_table_look_destroy (struct spv_table_look *look) { free (look->name); for (size_t i = 0; i < PIVOT_N_AREAS; i++) - area_style_uninit (&look->areas[i]); + table_area_style_uninit (&look->areas[i]); free (look->continuation); free (look); } @@ -538,8 +539,8 @@ spv_table_look_install (const struct spv_table_look *look, for (size_t i = 0; i < PIVOT_N_AREAS; i++) { - area_style_uninit (&table->areas[i]); - area_style_copy (NULL, &table->areas[i], &look->areas[i]); + table_area_style_uninit (&table->areas[i]); + table_area_style_copy (NULL, &table->areas[i], &look->areas[i]); } for (size_t i = 0; i < PIVOT_N_BORDERS; i++) table->borders[i] = look->borders[i]; @@ -572,7 +573,7 @@ spv_table_look_get (const struct pivot_table *table) look->show_numeric_markers = table->show_numeric_markers; for (size_t i = 0; i < PIVOT_N_AREAS; i++) - area_style_copy (NULL, &look->areas[i], &table->areas[i]); + table_area_style_copy (NULL, &look->areas[i], &table->areas[i]); for (size_t i = 0; i < PIVOT_N_BORDERS; i++) look->borders[i] = table->borders[i]; diff --git a/src/output/spv/spv-table-look.h b/src/output/spv/spv-table-look.h index 9867595021..76d6efb03a 100644 --- a/src/output/spv/spv-table-look.h +++ b/src/output/spv/spv-table-look.h @@ -45,7 +45,7 @@ struct spv_table_look bool footnote_marker_superscripts; /* Styles. */ - struct area_style areas[PIVOT_N_AREAS]; + struct table_area_style areas[PIVOT_N_AREAS]; struct table_border_style borders[PIVOT_N_BORDERS]; /* Print settings. */ diff --git a/src/output/spv/spv-writer.c b/src/output/spv/spv-writer.c index 1cba64bd8b..db8d03dfbf 100644 --- a/src/output/spv/spv-writer.c +++ b/src/output/spv/spv-writer.c @@ -795,7 +795,7 @@ put_light_table (struct buf *buf, uint64_t table_id, /* Areas. */ for (size_t i = 0; i < PIVOT_N_AREAS; i++) { - const struct area_style *a = &table->areas[i]; + const struct table_area_style *a = &table->areas[i]; put_byte (buf, i + 1); put_byte (buf, 0x31); put_string (buf, (a->font_style.typeface diff --git a/src/output/table-item.c b/src/output/table-item.c index a1595479bb..1ead1f92f6 100644 --- a/src/output/table-item.c +++ b/src/output/table-item.c @@ -52,7 +52,7 @@ table_item_text_clone (const struct table_item_text *old) .footnotes = xmemdup (old->footnotes, old->n_footnotes * sizeof *old->footnotes), .n_footnotes = old->n_footnotes, - .style = area_style_clone (NULL, old->style), + .style = table_area_style_clone (NULL, old->style), }; return new; } @@ -64,7 +64,7 @@ table_item_text_destroy (struct table_item_text *text) { free (text->content); free (text->footnotes); - area_style_free (text->style); + table_area_style_free (text->style); free (text); } } @@ -99,7 +99,7 @@ table_item_layers_clone (const struct table_item_layers *old) *new = (struct table_item_layers) { .layers = xnmalloc (old->n_layers, sizeof *new->layers), .n_layers = old->n_layers, - .style = area_style_clone (NULL, old->style), + .style = table_area_style_clone (NULL, old->style), }; for (size_t i = 0; i < new->n_layers; i++) table_item_layer_copy (&new->layers[i], &old->layers[i]); @@ -114,7 +114,7 @@ table_item_layers_destroy (struct table_item_layers *layers) for (size_t i = 0; i < layers->n_layers; i++) table_item_layer_uninit (&layers->layers[i]); free (layers->layers); - area_style_free (layers->style); + table_area_style_free (layers->style); free (layers); } } diff --git a/src/output/table-item.h b/src/output/table-item.h index a16c82ebb3..eb3dcb16ea 100644 --- a/src/output/table-item.h +++ b/src/output/table-item.h @@ -35,7 +35,7 @@ struct table_item_text char *content; const struct footnote **footnotes; size_t n_footnotes; - struct area_style *style; + struct table_area_style *style; }; struct table_item_text *table_item_text_create (const char *); @@ -57,7 +57,7 @@ struct table_item_layers { struct table_item_layer *layers; size_t n_layers; - struct area_style *style; + struct table_area_style *style; }; struct table_item_layers *table_item_layers_clone ( diff --git a/src/output/table-provider.h b/src/output/table-provider.h index 711f84d6b3..be45912d92 100644 --- a/src/output/table-provider.h +++ b/src/output/table-provider.h @@ -30,7 +30,7 @@ struct footnote size_t idx; char *content; char *marker; - struct area_style *style; + struct table_area_style *style; }; /* A cell in a table. */ @@ -60,7 +60,7 @@ struct table_cell char *superscript; const struct footnote **footnotes; size_t n_footnotes; - const struct area_style *style; + const struct table_area_style *style; }; void table_cell_format_footnote_markers (const struct table_cell *, diff --git a/src/output/table.c b/src/output/table.c index 31348a46a7..c27d208f72 100644 --- a/src/output/table.c +++ b/src/output/table.c @@ -67,10 +67,10 @@ table_is_shared (const struct table *table) return table->ref_cnt > 1; } -struct area_style * -area_style_clone (struct pool *pool, const struct area_style *old) +struct table_area_style * +table_area_style_clone (struct pool *pool, const struct table_area_style *old) { - struct area_style *new = pool_malloc (pool, sizeof *new); + struct table_area_style *new = pool_malloc (pool, sizeof *new); *new = *old; if (new->font_style.typeface) new->font_style.typeface = pool_strdup (pool, new->font_style.typeface); @@ -78,7 +78,7 @@ area_style_clone (struct pool *pool, const struct area_style *old) } void -area_style_free (struct area_style *style) +table_area_style_free (struct table_area_style *style) { if (style) { @@ -177,8 +177,8 @@ table_from_string (const char *text) { struct table *t = table_create (1, 1, 0, 0, 0, 0); t->styles[0] = pool_alloc (t->container, sizeof *t->styles[0]); - *t->styles[0] = (struct area_style) { - AREA_STYLE_INITIALIZER__, + *t->styles[0] = (struct table_area_style) { + TABLE_AREA_STYLE_INITIALIZER__, .cell_style.halign = TABLE_HALIGN_LEFT, .cell_style.valign = TABLE_VALIGN_TOP }; @@ -250,15 +250,15 @@ font_style_uninit (struct font_style *font) } void -area_style_copy (struct pool *container, - struct area_style *dst, const struct area_style *src) +table_area_style_copy (struct pool *container, struct table_area_style *dst, + const struct table_area_style *src) { font_style_copy (container, &dst->font_style, &src->font_style); dst->cell_style = src->cell_style; } void -area_style_uninit (struct area_style *area) +table_area_style_uninit (struct table_area_style *area) { if (area) font_style_uninit (&area->font_style); @@ -667,7 +667,7 @@ table_add_superscript (struct table *table, int x, int y, footnote later, so it is important for the caller to remember it. */ struct footnote * table_create_footnote (struct table *table, size_t idx, const char *content, - const char *marker, struct area_style *style) + const char *marker, struct table_area_style *style) { assert (style); @@ -701,7 +701,7 @@ table_add_footnote (struct table *table, int x, int y, TABLE->container or have a lifetime that will outlive TABLE. */ void table_add_style (struct table *table, int x, int y, - const struct area_style *style) + const struct table_area_style *style) { get_joined_cell (table, x, y)->style = style; } @@ -758,7 +758,7 @@ table_get_cell (const struct table *t, int x, int y, struct table_cell *cell) unsigned short opt = t->ct[index]; const void *cc = t->cc[index]; - const struct area_style *style + const struct table_area_style *style = t->styles[(opt & TAB_STYLE_MASK) >> TAB_STYLE_SHIFT]; if (opt & TAB_JOIN) { diff --git a/src/output/table.h b/src/output/table.h index 0cdeef1b4e..ed8e70123b 100644 --- a/src/output/table.h +++ b/src/output/table.h @@ -157,22 +157,23 @@ void font_style_copy (struct pool *, void font_style_uninit (struct font_style *); void font_style_dump (const struct font_style *); -struct area_style +struct table_area_style { struct cell_style cell_style; struct font_style font_style; }; -#define AREA_STYLE_INITIALIZER { AREA_STYLE_INITIALIZER__ } -#define AREA_STYLE_INITIALIZER__ \ +#define TABLE_AREA_STYLE_INITIALIZER { TABLE_AREA_STYLE_INITIALIZER__ } +#define TABLE_AREA_STYLE_INITIALIZER__ \ .cell_style = CELL_STYLE_INITIALIZER, \ .font_style = FONT_STYLE_INITIALIZER -struct area_style *area_style_clone (struct pool *, const struct area_style *); -void area_style_copy (struct pool *, - struct area_style *, const struct area_style *); -void area_style_uninit (struct area_style *); -void area_style_free (struct area_style *); +struct table_area_style *table_area_style_clone ( + struct pool *, const struct table_area_style *); +void table_area_style_copy (struct pool *, struct table_area_style *, + const struct table_area_style *); +void table_area_style_uninit (struct table_area_style *); +void table_area_style_free (struct table_area_style *); /* Properties of a table cell. */ enum @@ -227,7 +228,7 @@ struct table points to a struct table_cell. */ void **cc; /* Cell contents; void *[nr][nc]. */ unsigned short *ct; /* Cell types; unsigned short[nr][nc]. */ - struct area_style *styles[8]; + struct table_area_style *styles[8]; /* Rules. */ unsigned char *rh; /* Horiz rules; unsigned char[nr+1][nc]. */ @@ -299,12 +300,12 @@ void table_add_superscript (struct table *, int x, int y, struct footnote *table_create_footnote (struct table *, size_t idx, const char *content, const char *marker, - struct area_style *); + struct table_area_style *); void table_add_footnote (struct table *, int x, int y, const struct footnote *); void table_add_style (struct table *, int x, int y, - const struct area_style *); + const struct table_area_style *); bool table_cell_is_empty (const struct table *, int c, int r); diff --git a/src/output/text-item.c b/src/output/text-item.c index ba0f3873ad..f892e92774 100644 --- a/src/output/text-item.c +++ b/src/output/text-item.c @@ -121,9 +121,9 @@ text_item_to_table_item (struct text_item *text_item) { struct table *tab = table_create (1, 1, 0, 0, 0, 0); - struct area_style *style = pool_alloc (tab->container, sizeof *style); - *style = (struct area_style) { AREA_STYLE_INITIALIZER__, - .cell_style.halign = TABLE_HALIGN_LEFT }; + struct table_area_style *style = pool_alloc (tab->container, sizeof *style); + *style = (struct table_area_style) { TABLE_AREA_STYLE_INITIALIZER__, + .cell_style.halign = TABLE_HALIGN_LEFT }; struct font_style *font_style = &style->font_style; if (text_item->typeface) font_style->typeface = pool_strdup (tab->container, text_item->typeface); diff --git a/tests/output/render-test.c b/tests/output/render-test.c index b9ddd3e7f9..6b0aa73c4a 100644 --- a/tests/output/render-test.c +++ b/tests/output/render-test.c @@ -413,13 +413,15 @@ read_table (FILE *stream) cs = 1; } -#define S(H) { AREA_STYLE_INITIALIZER__, .cell_style.halign = H } - static const struct area_style left_style = S (TABLE_HALIGN_LEFT); - static const struct area_style right_style = S (TABLE_HALIGN_RIGHT); - static const struct area_style center_style +#define S(H) { TABLE_AREA_STYLE_INITIALIZER__, .cell_style.halign = H } + static const struct table_area_style left_style + = S (TABLE_HALIGN_LEFT); + static const struct table_area_style right_style + = S (TABLE_HALIGN_RIGHT); + static const struct table_area_style center_style = S (TABLE_HALIGN_CENTER); - const struct area_style *style = &right_style; + const struct table_area_style *style = &right_style; while (*text && strchr ("<>^,@()|", *text)) switch (*text++) { @@ -478,7 +480,7 @@ read_table (FILE *stream) char marker[2] = { 'a' + n_footnotes, '\0' }; struct footnote *f = table_create_footnote ( tab, n_footnotes, content, marker, - area_style_clone (tab->container, &left_style)); + table_area_style_clone (tab->container, &left_style)); table_add_footnote (tab, c, r, f); n_footnotes++; }