- 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,
- const char *format, ...)
-{
- va_list args;
-
- va_start (args, format);
- do_tab_text (table, c, r, opt,
- pool_vasprintf (table->container, format, args));
- va_end (args);
-}
-
-static void
-do_tab_joint_text (struct tab_table *table, int x1, int y1, int x2, int y2,
- unsigned opt, char *text)
-{
- struct tab_joined_cell *j;
-
- assert (x1 + table->col_ofs >= 0);
- assert (y1 + table->row_ofs >= 0);
- assert (y2 >= y1);
- assert (x2 >= x1);
- assert (y2 + table->row_ofs < tab_nr (table));
- assert (x2 + table->col_ofs < tab_nc (table));
-
-#if DEBUGGING
- if (x1 + table->col_ofs < 0 || x1 + table->col_ofs >= tab_nc (table)
- || y1 + table->row_ofs < 0 || y1 + table->row_ofs >= tab_nr (table)
- || x2 < x1 || x2 + table->col_ofs >= tab_nc (table)
- || y2 < y2 || y2 + table->row_ofs >= tab_nr (table))
- {
- printf ("tab_joint_text(): bad cell "
- "(%d+%d=%d,%d+%d=%d)-(%d+%d=%d,%d+%d=%d) in table size (%d,%d)\n",
- x1, table->col_ofs, x1 + table->col_ofs,
- y1, table->row_ofs, y1 + table->row_ofs,
- x2, table->col_ofs, x2 + table->col_ofs,
- y2, table->row_ofs, y2 + table->row_ofs,
- tab_nc (table), tab_nr (table));
- return;
- }
-#endif
-
- tab_box (table, -1, -1, TAL_0, TAL_0, x1, y1, x2, y2);
-
- j = pool_alloc (table->container, sizeof *j);
- j->x1 = x1 + table->col_ofs;
- j->y1 = y1 + table->row_ofs;
- j->x2 = ++x2 + table->col_ofs;
- j->y2 = ++y2 + table->row_ofs;
- j->contents = ss_cstr (text);
-
- opt |= TAB_JOIN;
-
- {
- struct substring *cc = &table->cc[x1 + y1 * table->cf];
- unsigned char *ct = &table->ct[x1 + y1 * table->cf];
- const int ofs = table->cf - (x2 - x1);
-
- int y;
-
- for (y = y1; y < y2; y++)
- {
- int x;
-
- for (x = x1; x < x2; x++)
- {
- *cc++ = ss_buffer ((char *) j, 0);
- *ct++ = opt;
- }
-
- cc += ofs;
- ct += ofs;
- }
- }
-}
-
-/* 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,
- 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);
-}
-
-/* Sets cell (C,R) in TABLE, with options OPT, to contents STRING. */
-void
-tab_raw (struct tab_table *table, int c, int r, unsigned opt,
- struct substring *string)
-{
- assert (table != NULL && string != NULL);
-
-#if DEBUGGING
- if (c + table->col_ofs < 0 || r + table->row_ofs < 0
- || c + table->col_ofs >= tab_nc (table)
- || r + table->row_ofs >= tab_nr (table))
- {
- printf ("tab_raw(): bad cell (%d+%d=%d,%d+%d=%d) in table size "
- "(%d,%d)\n",
- c, table->col_ofs, c + table->col_ofs,
- r, table->row_ofs, r + table->row_ofs,
- tab_nc (table), tab_nr (table));
- return;
- }
-#endif
-
- table->cc[c + r * table->cf] = *string;
- table->ct[c + r * table->cf] = opt;