*u8_line_reserve (line, 0, 1, 1) = leader;
if (trns->writer == NULL)
- table_output_text (TAB_FIX, ds_cstr (&line->s) + 1);
+ text_item_submit (text_item_create (TEXT_ITEM_LOG,
+ ds_cstr (&line->s) + 1));
else
{
size_t len = ds_length (&line->s);
table_item_unref (table_item);
}
-static void
-ascii_output_text (struct ascii_driver *a, const char *text)
-{
- ascii_output_table_item_unref (
- a, table_item_create (table_from_string (text), NULL, NULL, NULL));
-}
-
static void
ascii_submit (struct output_driver *driver,
const struct output_item *output_item)
a, text_item_to_table_item (text_item_ref (text_item)));
}
else if (is_message_item (output_item))
- {
- const struct message_item *message_item = to_message_item (output_item);
- char *s = msg_to_string (message_item_get_msg (message_item));
- ascii_output_text (a, s);
- free (s);
- }
+ ascii_output_table_item_unref (
+ a, text_item_to_table_item (
+ message_item_to_text_item (
+ to_message_item (
+ output_item_ref (output_item)))));
}
const struct output_driver_factory txt_driver_factory =
return n_nonnull;
}
\f
-/* Returns a table that contains a single cell, whose contents are the
- left-aligned TEXT. */
-struct table *
-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 table_area_style) {
- TABLE_AREA_STYLE_INITIALIZER__,
- .cell_style.halign = TABLE_HALIGN_LEFT,
- .cell_style.valign = TABLE_VALIGN_TOP
- };
- table_text (t, 0, 0, 0 << TAB_STYLE_SHIFT, text);
- return t;
-}
-\f
const char *
table_halign_to_string (enum table_halign halign)
{
return table->cc[c + r * table_nc (table)] == NULL;
}
\f
-/* Editing. */
-
-/* Writes STRING to the output. OPTIONS may be any valid combination of TAB_*
- bits.
-
- This function is obsolete. Please do not add new uses of it. Instead, use
- a text_item (see output/text-item.h). */
-void
-table_output_text (int options UNUSED, const char *string)
-{
- text_item_submit (text_item_create (TEXT_ITEM_LOG, string));
-}
-
-/* Same as table_output_text(), but FORMAT is passed through printf-like
- formatting before output. */
-void
-table_output_text_format (int options, const char *format, ...)
-{
- va_list args;
- char *text;
-
- va_start (args, format);
- text = xvasprintf (format, args);
- va_end (args);
-
- table_output_text (options, text);
-
- free (text);
-}
-\f
/* Initializes CELL with the contents of the table cell at column X and row Y
within TABLE. When CELL is no longer needed, the caller is responsible for
freeing it by calling table_cell_free(CELL).
static inline int table_hb (const struct table *t)
{ return t->h[TABLE_VERT][1]; }
-/* Simple kinds of output. */
-struct table *table_from_string (const char *);
-void table_output_text (int options, const char *string);
-void table_output_text_format (int options, const char *, ...)
- PRINTF_FORMAT (2, 3);
-
/* Rule masks. */
#define TAB_RULE_TYPE_MASK 7
#define TAB_RULE_TYPE_SHIFT 0