-tab_joint_text (struct tab_table *table, int x1, int y1, int x2, int y2,
- unsigned opt, const char *text)
-{
- do_tab_joint_text (table, x1, y1, x2, y2, opt,
- pool_strdup (table->container, text));
-}
-
-/* Joins cells (X1,X2)-(Y1,Y2) inclusive in TABLE, and sets them
- with options OPT to have text value FORMAT, which is formatted
- as if passed to printf. */
-void
-tab_joint_text_format (struct tab_table *table, int x1, int y1, int x2, int y2,
- unsigned opt, const char *format, ...)
-{
- va_list args;
-
- va_start (args, format);
- do_tab_joint_text (table, x1, y1, x2, y2, opt,
- pool_vasprintf (table->container, format, args));
- va_end (args);
-}
-\f
-/* Miscellaneous. */
-
-/* Sets the widths of all the columns and heights of all the rows in
- table T for driver D. */
-static void
-nowrap_dim (struct tab_rendering *r, void *aux UNUSED)
-{
- r->w[0] = tab_natural_width (r, 0);
- r->h[0] = r->driver->font_height;
-}
-
-/* Sets the widths of all the columns and heights of all the rows in
- table T for driver D. */
-static void
-wrap_dim (struct tab_rendering *r, void *aux UNUSED)
-{
- r->w[0] = tab_natural_width (r, 0);
- r->h[0] = tab_natural_height (r, 0);
-}
-
-static void
-do_tab_output_text (struct tab_table *t, int options, char *text)
-{
- do_tab_text (t, 0, 0, options, text);
- tab_flags (t, SOMF_NO_TITLE | SOMF_NO_SPACING);
- tab_dim (t, options & TAT_NOWRAP ? nowrap_dim : wrap_dim, NULL, NULL);
- tab_submit (t);
-}
-
-/* Outputs TEXT as a table with a single cell having cell options
- OPTIONS, which is a combination of the TAB_* and TAT_*
- constants. */
-void
-tab_output_text (int options, const char *text)
-{
- struct tab_table *table = tab_create (1, 1);
- do_tab_output_text (table, options, pool_strdup (table->container, text));
-}
-
-/* Outputs FORMAT as a table with a single cell having cell
- options OPTIONS, which is a combination of the TAB_* and TAT_*
- constants. FORMAT is formatted as if it was passed through
- printf. */
-void
-tab_output_text_format (int options, const char *format, ...)
-{
- struct tab_table *table;
- va_list args;
-
- table = tab_create (1, 1);
-
- va_start (args, format);
- do_tab_output_text (table, options,
- pool_vasprintf (table->container, format, args));
- va_end (args);
-}
-
-/* Set table flags to FLAGS. */
-void
-tab_flags (struct tab_table *t, unsigned flags)
-{
- assert (t != NULL);
- t->flags = flags;
-}
-
-/* Easy, type-safe way to submit a tab table to som. */
-void
-tab_submit (struct tab_table *t)
+table_cell_free (struct table_cell *cell)
+{
+ if (cell->destructor != NULL)
+ cell->destructor (cell->destructor_aux);
+}
+
+/* Returns one of the TAL_* enumeration constants (declared in output/table.h)
+ representing a rule running alongside one of the cells in TABLE.
+
+ Suppose NC is the number of columns in TABLE and NR is the number of rows.
+ Then, if AXIS is TABLE_HORZ, then 0 <= X <= NC and 0 <= Y < NR. If (X,Y) =
+ (0,0), the return value is the rule that runs vertically on the left side of
+ cell (0,0); if (X,Y) = (1,0), it is the vertical rule between that cell and
+ cell (1,0); and so on, up to (NC,0), which runs vertically on the right of
+ cell (NC-1,0).
+
+ The following diagram illustrates the meaning of (X,Y) for AXIS = TABLE_HORZ
+ within a 7x7 table. The '|' characters at the intersection of the X labels
+ and Y labels show the rule whose style would be returned by calling
+ table_get_rule with those X and Y values:
+
+ 0 1 2 3 4 5 6 7
+ +--+--+--+--+--+--+--+
+ 0 | | | | | | | |
+ +--+--+--+--+--+--+--+
+ 1 | | | | | | | |
+ +--+--+--+--+--+--+--+
+ 2 | | | | | | | |
+ +--+--+--+--+--+--+--+
+ 3 | | | | | | | |
+ +--+--+--+--+--+--+--+
+ 4 | | | | | | | |
+ +--+--+--+--+--+--+--+
+ 5 | | | | | | | |
+ +--+--+--+--+--+--+--+
+ 6 | | | | | | | |
+ +--+--+--+--+--+--+--+
+
+ Similarly, if AXIS is TABLE_VERT, then 0 <= X < NC and 0 <= Y <= NR. If
+ (X,Y) = (0,0), the return value is the rule that runs horizontally above
+ the top of cell (0,0); if (X,Y) = (0,1), it is the horizontal rule
+ between that cell and cell (0,1); and so on, up to (0,NR), which runs
+ horizontally below cell (0,NR-1). */
+int
+table_get_rule (const struct table *table, enum table_axis axis, int x, int y,
+ struct cell_color *color)