}
static void
-fill_cell (struct tab_table *t, int x1, int y1, int x2, int y2,
+fill_cell (struct table *t, int x1, int y1, int x2, int y2,
const struct area_style *style, int style_idx,
const struct pivot_value *value, struct footnote **footnotes,
enum settings_value_show show_values,
}
static void
-draw_line (struct tab_table *t, const struct table_border_style *styles,
+draw_line (struct table *t, const struct table_border_style *styles,
enum pivot_border style_idx,
enum table_axis axis, int a, int b0, int b1)
{
}
static void
-compose_headings (struct tab_table *t,
+compose_headings (struct table *t,
const struct pivot_axis *a_axis, enum table_axis a,
const struct pivot_axis *b_axis,
const struct table_border_style *borders,
? dim_col_vert
: cat_col_vert);
draw_line (t, borders, style, b, x2 + a_ofs, y1,
- t->table.n[b] - 1);
+ t->n[b] - 1);
}
if (pivot_category_is_leaf (c) && x1 > 0)
{
? dim_col_vert
: cat_col_vert);
draw_line (t, borders, style, b, x1 + a_ofs, y1,
- t->table.n[b] - 1);
+ t->n[b] - 1);
}
}
if (c->parent && c->parent->show_label)
if (dim_index > 1)
draw_line (t, borders, dim_col_horz, a, bottom_row + 1, a_ofs,
- t->table.n[a] - 1);
+ t->n[a] - 1);
bottom_row -= d->label_depth;
}
[H] = pt->axes[PIVOT_AXIS_ROW].label_depth,
[V] = pt->axes[PIVOT_AXIS_COLUMN].label_depth,
};
- struct tab_table *table = tab_create (body[H] + stub[H],
+ struct table *table = tab_create (body[H] + stub[H],
body[V] + stub[V],
stub[H], 0, stub[V], 0);
pt->corner_text, footnotes,
pt->show_values, pt->show_variables, false);
- if (tab_nc (table) && tab_nr (table))
+ if (table_nc (table) && table_nr (table))
{
tab_hline (
table, get_table_rule (pt->borders, PIVOT_BORDER_INNER_TOP),
- 0, tab_nc (table) - 1, 0);
+ 0, table_nc (table) - 1, 0);
tab_hline (
table, get_table_rule (pt->borders, PIVOT_BORDER_INNER_BOTTOM),
- 0, tab_nc (table) - 1, tab_nr (table));
+ 0, table_nc (table) - 1, table_nr (table));
tab_vline (
table, get_table_rule (pt->borders, PIVOT_BORDER_INNER_LEFT),
- 0, 0, tab_nr (table) - 1);
+ 0, 0, table_nr (table) - 1);
tab_vline (
table, get_table_rule (pt->borders, PIVOT_BORDER_INNER_RIGHT),
- tab_nc (table), 0, tab_nr (table) - 1);
+ table_nc (table), 0, table_nr (table) - 1);
if (stub[V])
tab_hline (
table, get_table_rule (pt->borders, PIVOT_BORDER_DATA_TOP),
- 0, tab_nc (table) - 1, stub[V]);
+ 0, table_nc (table) - 1, stub[V]);
if (stub[H])
tab_vline (
table, get_table_rule (pt->borders, PIVOT_BORDER_DATA_LEFT),
- stub[H], 0, tab_nr (table) - 1);
+ stub[H], 0, table_nr (table) - 1);
}
free (column_enumeration);
free (row_enumeration);
- struct table_item *ti = table_item_create (&table->table, NULL, NULL);
+ struct table_item *ti = table_item_create (table, NULL, NULL);
if (pt->title)
{
if (!n_footnotes)
return;
- struct tab_table *t = tab_create (1, n_footnotes, 0, 0, 0, 0);
+ struct table *t = tab_create (1, n_footnotes, 0, 0, 0, 0);
for (size_t i = 0; i < n_footnotes; i++)
{
tab_text_format (t, 0, i, TAB_LEFT, "%s. %s",
if (f[i]->style)
tab_add_style (t, 0, i, f[i]->style);
}
- render_pager_add_table (p, &t->table, 0);
+ render_pager_add_table (p, t, 0);
free (f);
}
if (!t)
return;
- struct tab_table *tab = tab_create (1, 1, 0, 0, 0, 0);
+ struct table *tab = tab_create (1, 1, 0, 0, 0, 0);
tab_text (tab, 0, 0, 0, t->content);
for (size_t i = 0; i < t->n_footnotes; i++)
tab_add_footnote (tab, 0, 0, t->footnotes[i]);
if (t->style)
tab->styles[0] = area_style_clone (tab->container, t->style);
- render_pager_add_table (p, &tab->table, min_width);
+ render_pager_add_table (p, tab, min_width);
}
static void
if (!layers)
return;
- struct tab_table *tab = tab_create (1, layers->n_layers, 0, 0, 0, 0);
+ struct table *tab = tab_create (1, layers->n_layers, 0, 0, 0, 0);
for (size_t i = 0; i < layers->n_layers; i++)
{
const struct table_item_layer *layer = &layers->layers[i];
}
if (layers->style)
tab->styles[0] = area_style_clone (tab->container, layers->style);
- render_pager_add_table (p, &tab->table, min_width);
+ render_pager_add_table (p, tab, min_width);
}
/* Creates and returns a new render_pager for rendering TABLE_ITEM on the
static const bool debugging = true;
-
-/* Cell options. */
-#define TAB_JOIN (1u << TAB_FIRST_AVAILABLE)
-
/* Joined cell. */
struct tab_joined_cell
{
multiple pages.
The table's cells are initially empty. */
-struct tab_table *
+struct table *
tab_create (int nc, int nr, int hl, int hr, int ht, int hb)
{
- struct tab_table *t;
+ struct table *t;
- t = pool_create_container (struct tab_table, container);
- t->table.n[TABLE_HORZ] = nc;
- t->table.n[TABLE_VERT] = nr;
- t->table.h[TABLE_HORZ][0] = hl;
- t->table.h[TABLE_HORZ][1] = hr;
- t->table.h[TABLE_VERT][0] = ht;
- t->table.h[TABLE_VERT][1] = hb;
- t->table.ref_cnt = 1;
+ t = pool_create_container (struct table, container);
+ t->n[TABLE_HORZ] = nc;
+ t->n[TABLE_VERT] = nr;
+ t->h[TABLE_HORZ][0] = hl;
+ t->h[TABLE_HORZ][1] = hr;
+ t->h[TABLE_VERT][0] = ht;
+ t->h[TABLE_VERT][1] = hb;
+ t->ref_cnt = 1;
t->cc = pool_calloc (t->container, nr * nc, sizeof *t->cc);
t->ct = pool_calloc (t->container, nr * nc, sizeof *t->ct);
/* Draws a vertical line to the left of cells at horizontal position X
from Y1 to Y2 inclusive in style STYLE, if style is not -1. */
void
-tab_vline (struct tab_table *t, int style, int x, int y1, int y2)
+tab_vline (struct table *t, int style, int x, int y1, int y2)
{
if (debugging)
{
- if (x < 0 || x > tab_nc (t)
- || y1 < 0 || y1 >= tab_nr (t)
- || y2 < 0 || y2 >= tab_nr (t))
+ if (x < 0 || x > table_nc (t)
+ || y1 < 0 || y1 >= table_nr (t)
+ || y2 < 0 || y2 >= table_nr (t))
{
printf (_("bad vline: x=%d y=(%d,%d) in table size (%d,%d)\n"),
- x, y1, y2, tab_nc (t), tab_nr (t));
+ x, y1, y2, table_nc (t), table_nr (t));
return;
}
}
assert (x >= 0);
- assert (x <= tab_nc (t));
+ assert (x <= table_nc (t));
assert (y1 >= 0);
assert (y2 >= y1);
- assert (y2 <= tab_nr (t));
+ assert (y2 <= table_nr (t));
if (style != -1)
{
int y;
for (y = y1; y <= y2; y++)
- t->rv[x + (tab_nc (t) + 1) * y] = style;
+ t->rv[x + (table_nc (t) + 1) * y] = style;
}
}
/* Draws a horizontal line above cells at vertical position Y from X1
to X2 inclusive in style STYLE, if style is not -1. */
void
-tab_hline (struct tab_table *t, int style, int x1, int x2, int y)
+tab_hline (struct table *t, int style, int x1, int x2, int y)
{
if (debugging)
{
- if (y < 0 || y > tab_nr (t)
- || x1 < 0 || x1 >= tab_nc (t)
- || x2 < 0 || x2 >= tab_nc (t))
+ if (y < 0 || y > table_nr (t)
+ || x1 < 0 || x1 >= table_nc (t)
+ || x2 < 0 || x2 >= table_nc (t))
{
printf (_("bad hline: x=(%d,%d) y=%d in table size (%d,%d)\n"),
- x1, x2, y, tab_nc (t), tab_nr (t));
+ x1, x2, y, table_nc (t), table_nr (t));
return;
}
}
assert (y >= 0);
- assert (y <= tab_nr (t));
+ assert (y <= table_nr (t));
assert (x2 >= x1);
assert (x1 >= 0);
- assert (x2 < tab_nc (t));
+ assert (x2 < table_nc (t));
if (style != -1)
{
int x;
for (x = x1; x <= x2; x++)
- t->rh[x + tab_nc (t) * y] = style;
+ t->rh[x + table_nc (t) * y] = style;
}
}
drawing those lines. This is distinct from 0, which draws a null
line. */
void
-tab_box (struct tab_table *t, int f_h, int f_v, int i_h, int i_v,
+tab_box (struct table *t, int f_h, int f_v, int i_h, int i_v,
int x1, int y1, int x2, int y2)
{
if (debugging)
{
- if (x1 < 0 || x1 >= tab_nc (t)
- || x2 < 0 || x2 >= tab_nc (t)
- || y1 < 0 || y1 >= tab_nr (t)
- || y2 < 0 || y2 >= tab_nr (t))
+ if (x1 < 0 || x1 >= table_nc (t)
+ || x2 < 0 || x2 >= table_nc (t)
+ || y1 < 0 || y1 >= table_nr (t)
+ || y2 < 0 || y2 >= table_nr (t))
{
printf (_("bad box: (%d,%d)-(%d,%d) in table size (%d,%d)\n"),
- x1, y1, x2, y2, tab_nc (t), tab_nr (t));
+ x1, y1, x2, y2, table_nc (t), table_nr (t));
NOT_REACHED ();
}
}
assert (y2 >= y1);
assert (x1 >= 0);
assert (y1 >= 0);
- assert (x2 < tab_nc (t));
- assert (y2 < tab_nr (t));
+ assert (x2 < table_nc (t));
+ assert (y2 < table_nr (t));
if (f_h != -1)
{
int x;
for (x = x1; x <= x2; x++)
{
- t->rh[x + tab_nc (t) * y1] = f_h;
- t->rh[x + tab_nc (t) * (y2 + 1)] = f_h;
+ t->rh[x + table_nc (t) * y1] = f_h;
+ t->rh[x + table_nc (t) * (y2 + 1)] = f_h;
}
}
if (f_v != -1)
int y;
for (y = y1; y <= y2; y++)
{
- t->rv[x1 + (tab_nc (t) + 1) * y] = f_v;
- t->rv[(x2 + 1) + (tab_nc (t) + 1) * y] = f_v;
+ t->rv[x1 + (table_nc (t) + 1) * y] = f_v;
+ t->rv[(x2 + 1) + (table_nc (t) + 1) * y] = f_v;
}
}
int x;
for (x = x1; x <= x2; x++)
- t->rh[x + tab_nc (t) * y] = i_h;
+ t->rh[x + table_nc (t) * y] = i_h;
}
}
if (i_v != -1)
int y;
for (y = y1; y <= y2; y++)
- t->rv[x + (tab_nc (t) + 1) * y] = i_v;
+ t->rv[x + (table_nc (t) + 1) * y] = i_v;
}
}
}
/* Cells. */
static void
-do_tab_text (struct tab_table *table, int c, int r, unsigned opt, char *text)
+do_tab_text (struct table *table, int c, int r, unsigned opt, char *text)
{
assert (c >= 0);
assert (r >= 0);
- assert (c < tab_nc (table));
- assert (r < tab_nr (table));
+ assert (c < table_nc (table));
+ assert (r < table_nr (table));
if (debugging)
{
- if (c < 0 || r < 0 || c >= tab_nc (table) || r >= tab_nr (table))
+ if (c < 0 || r < 0 || c >= table_nc (table) || r >= table_nr (table))
{
printf ("tab_text(): bad cell (%d,%d) in table size (%d,%d)\n",
- c, r, tab_nc (table), tab_nr (table));
+ c, r, table_nc (table), table_nr (table));
return;
}
}
- table->cc[c + r * tab_nc (table)] = text;
- table->ct[c + r * tab_nc (table)] = opt;
+ table->cc[c + r * table_nc (table)] = text;
+ table->ct[c + r * table_nc (table)] = opt;
}
/* Sets cell (C,R) in TABLE, with options OPT, to have text value
TEXT. */
void
-tab_text (struct tab_table *table, int c, int r, unsigned opt,
+tab_text (struct table *table, int c, int r, unsigned opt,
const char *text)
{
do_tab_text (table, c, r, opt, pool_strdup (table->container, text));
/* Sets cell (C,R) in TABLE, with options OPT, to have text value
FORMAT, which is formatted as if passed to printf. */
void
-tab_text_format (struct tab_table *table, int c, int r, unsigned opt,
+tab_text_format (struct table *table, int c, int r, unsigned opt,
const char *format, ...)
{
va_list args;
}
static struct tab_joined_cell *
-add_joined_cell (struct tab_table *table, int x1, int y1, int x2, int y2,
+add_joined_cell (struct table *table, int x1, int y1, int x2, int y2,
unsigned opt)
{
struct tab_joined_cell *j;
assert (y1 >= 0);
assert (y2 >= y1);
assert (x2 >= x1);
- assert (y2 < tab_nr (table));
- assert (x2 < tab_nc (table));
+ assert (y2 < table_nr (table));
+ assert (x2 < table_nc (table));
if (debugging)
{
- if (x1 < 0 || x1 >= tab_nc (table)
- || y1 < 0 || y1 >= tab_nr (table)
- || x2 < x1 || x2 >= tab_nc (table)
- || y2 < y1 || y2 >= tab_nr (table))
+ if (x1 < 0 || x1 >= table_nc (table)
+ || y1 < 0 || y1 >= table_nr (table)
+ || x2 < x1 || x2 >= table_nc (table)
+ || y2 < y1 || y2 >= table_nr (table))
{
printf ("tab_joint_text(): bad cell "
"(%d,%d)-(%d,%d) in table size (%d,%d)\n",
- x1, y1, x2, y2, tab_nc (table), tab_nr (table));
+ x1, y1, x2, y2, table_nc (table), table_nr (table));
return NULL;
}
}
j->style = NULL;
{
- void **cc = &table->cc[x1 + y1 * tab_nc (table)];
- unsigned short *ct = &table->ct[x1 + y1 * tab_nc (table)];
- const int ofs = tab_nc (table) - (x2 - x1);
+ void **cc = &table->cc[x1 + y1 * table_nc (table)];
+ unsigned short *ct = &table->ct[x1 + y1 * table_nc (table)];
+ const int ofs = table_nc (table) - (x2 - x1);
int y;
/* Joins cells (X1,X2)-(Y1,Y2) inclusive in TABLE, and sets them with
options OPT to have text value TEXT. */
void
-tab_joint_text (struct tab_table *table, int x1, int y1, int x2, int y2,
+tab_joint_text (struct table *table, int x1, int y1, int x2, int y2,
unsigned opt, const char *text)
{
char *s = pool_strdup (table->container, text);
}
struct footnote *
-tab_create_footnote (struct tab_table *table, size_t idx, const char *content,
+tab_create_footnote (struct table *table, size_t idx, const char *content,
const char *marker, struct area_style *style)
{
struct footnote *f = pool_alloc (table->container, sizeof *f);
}
void
-tab_add_footnote (struct tab_table *table, int x, int y,
+tab_add_footnote (struct table *table, int x, int y,
const struct footnote *f)
{
- int index = x + y * tab_nc (table);
+ int index = x + y * table_nc (table);
unsigned short opt = table->ct[index];
struct tab_joined_cell *j;
}
void
-tab_add_style (struct tab_table *table, int x, int y,
+tab_add_style (struct table *table, int x, int y,
const struct area_style *style)
{
- int index = x + y * tab_nc (table);
+ int index = x + y * table_nc (table);
unsigned short opt = table->ct[index];
struct tab_joined_cell *j;
}
bool
-tab_cell_is_empty (const struct tab_table *table, int c, int r)
+tab_cell_is_empty (const struct table *table, int c, int r)
{
- return table->cc[c + r * tab_nc (table)] == NULL;
+ return table->cc[c + r * table_nc (table)] == NULL;
}
\f
/* Editing. */
void
tab_destroy (struct table *table)
{
- struct tab_table *t = tab_cast (table);
- pool_destroy (t->container);
+ pool_destroy (table->container);
}
void
-tab_get_cell (const struct table *table, int x, int y,
- struct table_cell *cell)
+tab_get_cell (const struct table *t, int x, int y, struct table_cell *cell)
{
- const struct tab_table *t = tab_cast (table);
- int index = x + y * tab_nc (t);
+ int index = x + y * table_nc (t);
unsigned short opt = t->ct[index];
const void *cc = t->cc[index];
}
int
-tab_get_rule (const struct table *table, enum table_axis axis, int x, int y,
+tab_get_rule (const struct table *t, enum table_axis axis, int x, int y,
struct cell_color *color)
{
- const struct tab_table *t = tab_cast (table);
uint8_t raw = (axis == TABLE_VERT
- ? t->rh[x + tab_nc (t) * y]
- : t->rv[x + (tab_nc (t) + 1) * y]);
+ ? t->rh[x + table_nc (t) * y]
+ : t->rv[x + (table_nc (t) + 1) * y]);
struct cell_color *p = t->rule_colors[(raw & TAB_RULE_STYLE_MASK)
>> TAB_RULE_STYLE_SHIFT];
if (p)
*color = *p;
return (raw & TAB_RULE_TYPE_MASK) >> TAB_RULE_TYPE_SHIFT;
}
-
-struct tab_table *
-tab_cast (const struct table *table)
-{
- return UP_CAST (table, struct tab_table, table);
-}
#include "output/table.h"
#include "data/format.h"
-#define TAB_STYLE_MASK (7u << (TAB_FIRST_AVAILABLE + 1))
-#define TAB_STYLE_SHIFT (TAB_FIRST_AVAILABLE + 1)
-
-enum
- {
- /* Horizontal alignment of cell contents. */
- TAB_RIGHT = 0 << (TAB_FIRST_AVAILABLE + 4),
- TAB_LEFT = 1 << (TAB_FIRST_AVAILABLE + 4),
- TAB_CENTER = 2 << (TAB_FIRST_AVAILABLE + 4),
- TAB_HALIGN = 3 << (TAB_FIRST_AVAILABLE + 4), /* Alignment mask. */
-
- /* Vertical alignment of cell contents. */
- TAB_TOP = 0 << (TAB_FIRST_AVAILABLE + 6),
- TAB_MIDDLE = 1 << (TAB_FIRST_AVAILABLE + 6),
- TAB_BOTTOM = 2 << (TAB_FIRST_AVAILABLE + 6),
- TAB_VALIGN = 3 << (TAB_FIRST_AVAILABLE + 6), /* Alignment mask. */
- };
-
/* Rule masks. */
#define TAB_RULE_TYPE_MASK 7
#define TAB_RULE_TYPE_SHIFT 0
#define TAB_RULE_STYLE_MASK (31 << TAB_RULE_STYLE_SHIFT)
#define TAB_RULE_STYLE_SHIFT 3
-/* A table. */
-struct tab_table
- {
- struct table table;
- struct pool *container;
-
- /* Table contents.
-
- Each array element in cc[] is ordinarily a "char *" pointer to a
- string. If TAB_JOIN (defined in tab.c) is set in ct[] for the element,
- however, it is a joined cell and the corresponding element of cc[]
- points to a struct tab_joined_cell. */
- void **cc; /* Cell contents; void *[nr][nc]. */
- unsigned short *ct; /* Cell types; unsigned short[nr][nc]. */
- struct area_style *styles[8];
-
- /* Rules. */
- unsigned char *rh; /* Horiz rules; unsigned char[nr+1][nc]. */
- unsigned char *rv; /* Vert rules; unsigned char[nr][nc+1]. */
- struct cell_color *rule_colors[32];
- };
-
-struct tab_table *tab_cast (const struct table *);
-
-/* Number of rows or columns in TABLE. */
-static inline int tab_nr (const struct tab_table *table)
- { return table_nr (&table->table); }
-static inline int tab_nc (const struct tab_table *table)
- { return table_nc (&table->table); }
-
/* Tables. */
-struct tab_table *tab_create (int nc, int nr,
- int l, int r, int t, int b);
+struct table *tab_create (int nc, int nr, int hl, int hr, int ht, int hb);
/* Rules. */
-void tab_hline (struct tab_table *, int style, int x1, int x2, int y);
-void tab_vline (struct tab_table *, int style, int x, int y1, int y2);
-void tab_box (struct tab_table *, int f_h, int f_v, int i_h, int i_v,
+void tab_hline (struct table *, int style, int x1, int x2, int y);
+void tab_vline (struct table *, int style, int x, int y1, int y2);
+void tab_box (struct table *, int f_h, int f_v, int i_h, int i_v,
int x1, int y1, int x2, int y2);
/* Cells. */
-void tab_text (struct tab_table *, int c, int r, unsigned opt, const char *);
-void tab_text_format (struct tab_table *, int c, int r, unsigned opt,
+void tab_text (struct table *, int c, int r, unsigned opt, const char *);
+void tab_text_format (struct table *, int c, int r, unsigned opt,
const char *, ...)
- PRINTF_FORMAT (5, 6);
+ PRINTF_FORMAT (5, 6);
-void tab_joint_text (struct tab_table *, int x1, int y1, int x2, int y2,
+void tab_joint_text (struct table *, int x1, int y1, int x2, int y2,
unsigned opt, const char *);
-struct footnote *tab_create_footnote (struct tab_table *, size_t idx,
+struct footnote *tab_create_footnote (struct table *, size_t idx,
const char *content, const char *marker,
struct area_style *);
-void tab_add_footnote (struct tab_table *, int x, int y,
+void tab_add_footnote (struct table *, int x, int y,
const struct footnote *);
-void tab_add_style (struct tab_table *, int x, int y,
+void tab_add_style (struct table *, int x, int y,
const struct area_style *);
-bool tab_cell_is_empty (const struct tab_table *, int c, int r);
+bool tab_cell_is_empty (const struct table *, int c, int r);
/* Simple output. */
void tab_output_text (int options, const char *string);
struct table *
table_from_string (const char *text)
{
- struct tab_table *t = tab_create (1, 1, 0, 0, 0, 0);
+ struct table *t = tab_create (1, 1, 0, 0, 0, 0);
tab_text (t, 0, 0, TAB_LEFT, text);
- return &t->table;
+ return t;
}
\f
const char *
Every table is an instance of a particular table class that is responsible
for keeping track of cell data. By far the most common table class is
- struct tab_table (see output/tab.h). This header also declares some other
+ struct table (see output/tab.h). This header also declares some other
kinds of table classes, near the end of the file.
A table is not itself an output_item, and thus a table cannot by itself be
TAB_NUMERIC = 1 << 3, /* Cell contents are numeric. */
TAB_ROTATE = 1 << 4, /* Rotate cell contents 90 degrees. */
- /* Bits with values (1 << TAB_FIRST_AVAILABLE) and higher are
- not used, so they are available for subclasses to use as
- they wish. */
- TAB_FIRST_AVAILABLE = 5
+ TAB_STYLE_SHIFT = 5,
+ TAB_STYLE_MASK = 7 << TAB_STYLE_SHIFT,
+
+ /* Horizontal alignment of cell contents. */
+ TAB_RIGHT = 0 << 10,
+ TAB_LEFT = 1 << 10,
+ TAB_CENTER = 2 << 10,
+ TAB_HALIGN = 3 << 10, /* Alignment mask. */
+
+ /* Vertical alignment of cell contents. */
+ TAB_TOP = 0 << 12,
+ TAB_MIDDLE = 1 << 12,
+ TAB_BOTTOM = 2 << 12,
+ TAB_VALIGN = 3 << 12, /* Alignment mask. */
+
+ /* Internal use by tab.c only. */
+ TAB_JOIN = 1 << 14,
};
/* Styles for the rules around table cells. */
/* A table. */
struct table
{
+ struct pool *container;
+
/* Table size.
n[TABLE_HORZ]: Number of columns.
indicated by a reference count greater than 1. When this is the case,
the table must not be modified. */
int ref_cnt;
+
+ /* Table contents.
+
+ Each array element in cc[] is ordinarily a "char *" pointer to a
+ string. If TAB_JOIN (defined in tab.c) is set in ct[] for the element,
+ however, it is a joined cell and the corresponding element of cc[]
+ points to a struct tab_joined_cell. */
+ void **cc; /* Cell contents; void *[nr][nc]. */
+ unsigned short *ct; /* Cell types; unsigned short[nr][nc]. */
+ struct area_style *styles[8];
+
+ /* Rules. */
+ unsigned char *rh; /* Horiz rules; unsigned char[nr+1][nc]. */
+ unsigned char *rv; /* Vert rules; unsigned char[nr][nc+1]. */
+ struct cell_color *rule_colors[32];
};
/* Reference counting. */
struct table_item *
text_item_to_table_item (struct text_item *text_item)
{
- struct tab_table *tab = tab_create (1, 1, 0, 0, 0, 0);
+ struct table *tab = tab_create (1, 1, 0, 0, 0, 0);
struct area_style *style = pool_alloc (tab->container, sizeof *style);
*style = (struct area_style) { AREA_STYLE_INITIALIZER__,
if (text_item->type == TEXT_ITEM_SYNTAX || text_item->type == TEXT_ITEM_LOG)
opts |= TAB_FIX;
tab_text (tab, 0, 0, opts, text_item_get_text (text_item));
- struct table_item *table_item = table_item_create (&tab->table, NULL, NULL);
+ struct table_item *table_item = table_item_create (tab, NULL, NULL);
text_item_unref (text_item);
return table_item;
}
static struct table *
read_table (FILE *stream)
{
- struct tab_table *tab;
+ struct table *tab;
char buffer[1024];
int input[6];
int n_input = 0;
}
}
- return &tab->table;
+ return tab;
}
static void