From ff2c83253f1f450a8bd1d36c7efb8b59cdfed058 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Wed, 7 Aug 2013 19:07:25 +0200 Subject: [PATCH] src/output/table.h: Rename class -> klass This makes it possible to include this file in C++ compiled programs. --- src/output/tab.c | 2 +- src/output/table-casereader.c | 2 +- src/output/table-paste.c | 12 ++++++------ src/output/table-select.c | 6 +++--- src/output/table-transpose.c | 4 ++-- src/output/table.c | 12 ++++++------ src/output/table.h | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/output/tab.c b/src/output/tab.c index bc4ac534d0..6f2a0051bb 100644 --- a/src/output/tab.c +++ b/src/output/tab.c @@ -767,6 +767,6 @@ static const struct table_class tab_table_class = struct tab_table * tab_cast (const struct table *table) { - assert (table->class == &tab_table_class); + assert (table->klass == &tab_table_class); return UP_CAST (table, struct tab_table, table); } diff --git a/src/output/table-casereader.c b/src/output/table-casereader.c index 672dd87f49..5d5154ef40 100644 --- a/src/output/table-casereader.c +++ b/src/output/table-casereader.c @@ -38,7 +38,7 @@ static const struct table_class table_casereader_class; static struct table_casereader * table_casereader_cast (const struct table *table) { - assert (table->class == &table_casereader_class); + assert (table->klass == &table_casereader_class); return UP_CAST (table, struct table_casereader, table); } diff --git a/src/output/table-paste.c b/src/output/table-paste.c index 5f6d3f83e0..ad32de7276 100644 --- a/src/output/table-paste.c +++ b/src/output/table-paste.c @@ -47,14 +47,14 @@ static const struct table_class table_paste_class; static struct table_paste * table_paste_cast (const struct table *table) { - assert (table->class == &table_paste_class); + assert (table->klass == &table_paste_class); return UP_CAST (table, struct table_paste, table); } static bool is_table_paste (const struct table *table, int orientation) { - return (table->class == &table_paste_class + return (table->klass == &table_paste_class && table_paste_cast (table)->orientation == orientation); } @@ -151,15 +151,15 @@ table_paste (struct table *a, struct table *b, enum table_axis orientation) /* Handle tables that know how to paste themselves. */ if (!table_is_shared (a) && !table_is_shared (b) && a != b) { - if (a->class->paste != NULL) + if (a->klass->paste != NULL) { - struct table *new = a->class->paste (a, b, orientation); + struct table *new = a->klass->paste (a, b, orientation); if (new != NULL) return new; } - if (b->class->paste != NULL && a->class != b->class) + if (b->klass->paste != NULL && a->klass != b->klass) { - struct table *new = b->class->paste (a, b, orientation); + struct table *new = b->klass->paste (a, b, orientation); if (new != NULL) return new; } diff --git a/src/output/table-select.c b/src/output/table-select.c index dcc6b7de2a..00d0ee9931 100644 --- a/src/output/table-select.c +++ b/src/output/table-select.c @@ -35,7 +35,7 @@ static const struct table_class table_select_class; static struct table_select * table_select_cast (const struct table *table) { - assert (table->class == &table_select_class); + assert (table->klass == &table_select_class); return UP_CAST (table, struct table_select, table); } @@ -55,9 +55,9 @@ table_select (struct table *subtable, int rect[TABLE_N_AXES][2]) && rect[TABLE_VERT][1] == subtable->n[TABLE_VERT]) return subtable; - if (!table_is_shared (subtable) && subtable->class->select != NULL) + if (!table_is_shared (subtable) && subtable->klass->select != NULL) { - struct table *selected = subtable->class->select (subtable, rect); + struct table *selected = subtable->klass->select (subtable, rect); if (selected != NULL) return selected; } diff --git a/src/output/table-transpose.c b/src/output/table-transpose.c index 3dd8620262..f2db939f5a 100644 --- a/src/output/table-transpose.c +++ b/src/output/table-transpose.c @@ -34,7 +34,7 @@ static const struct table_class table_transpose_class; static struct table_transpose * table_transpose_cast (const struct table *table) { - assert (table->class == &table_transpose_class); + assert (table->klass == &table_transpose_class); return UP_CAST (table, struct table_transpose, table); } @@ -46,7 +46,7 @@ table_transpose (struct table *subtable) if (subtable->n[TABLE_HORZ] == subtable->n[TABLE_VERT] && subtable->n[TABLE_HORZ] <= 1) return subtable; - else if (subtable->class == &table_transpose_class) + else if (subtable->klass == &table_transpose_class) { struct table_transpose *tt = table_transpose_cast (subtable); struct table *table = table_ref (tt->subtable); diff --git a/src/output/table.c b/src/output/table.c index bd51f49403..e9abca85e3 100644 --- a/src/output/table.c +++ b/src/output/table.c @@ -47,7 +47,7 @@ table_unref (struct table *table) { assert (table->ref_cnt > 0); if (--table->ref_cnt == 0) - table->class->destroy (table); + table->klass->destroy (table); } } @@ -104,7 +104,7 @@ table_set_hb (struct table *table, int hb) void table_init (struct table *table, const struct table_class *class) { - table->class = class; + table->klass = class; table->n[TABLE_HORZ] = table->n[TABLE_VERT] = 0; table->h[TABLE_HORZ][0] = table->h[TABLE_HORZ][1] = 0; table->h[TABLE_VERT][0] = table->h[TABLE_VERT][1] = 0; @@ -138,7 +138,7 @@ table_get_cell (const struct table *table, int x, int y, { assert (x >= 0 && x < table->n[TABLE_HORZ]); assert (y >= 0 && y < table->n[TABLE_VERT]); - table->class->get_cell (table, x, y, cell); + table->klass->get_cell (table, x, y, cell); } /* Frees CELL, which should have been initialized by calling @@ -192,7 +192,7 @@ table_get_rule (const struct table *table, enum table_axis axis, int x, int y) { assert (x >= 0 && x < table->n[TABLE_HORZ] + (axis == TABLE_HORZ)); assert (y >= 0 && y < table->n[TABLE_VERT] + (axis == TABLE_VERT)); - return table->class->get_rule (table, axis, x, y); + return table->klass->get_rule (table, axis, x, y); } struct table_unshared @@ -233,7 +233,7 @@ table_unshare (struct table *table) static struct table_unshared * table_unshared_cast (const struct table *table) { - assert (table->class == &table_unshared_class); + assert (table->klass == &table_unshared_class); return UP_CAST (table, struct table_unshared, table); } @@ -295,7 +295,7 @@ table_from_string (unsigned int options, const char *s) static struct table_string * table_string_cast (const struct table *table) { - assert (table->class == &table_string_class); + assert (table->klass == &table_string_class); return UP_CAST (table, struct table_string, table); } diff --git a/src/output/table.h b/src/output/table.h index 06427ac32b..e245b72760 100644 --- a/src/output/table.h +++ b/src/output/table.h @@ -102,7 +102,7 @@ enum table_axis /* A table. */ struct table { - const struct table_class *class; + const struct table_class *klass; /* Table size. -- 2.30.2