table: Delete some functions that were unused or barely used.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 27 Dec 2020 04:26:37 +0000 (20:26 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 27 Dec 2020 04:26:37 +0000 (20:26 -0800)
src/language/data-io/print.c
src/output/ascii.c
src/output/table.c
src/output/table.h

index 0cb337d42879f6c3703ff73c8d99d78f9f09274d..4a767dc3dc9a4a3704b0cc876a0e907932e0b9e4 100644 (file)
@@ -563,7 +563,8 @@ print_text_flush_records (struct print_trns *trns, struct u8_line *line,
       *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);
index 07b05580162d154f5e26bd562aa58c63f7fce258..7fd2f5e876b38952af5d770578c1d51a166314da 100644 (file)
@@ -481,13 +481,6 @@ ascii_output_table_item_unref (struct ascii_driver *a,
   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)
@@ -532,12 +525,11 @@ ascii_submit (struct output_driver *driver,
           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 =
index c27d208f72b09b4fcf5aa435b3738035618d5388..4133e036d08494a370b79501d943a83d83060d7b 100644 (file)
@@ -170,22 +170,6 @@ table_collect_footnotes (const struct table_item *item,
   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)
 {
@@ -713,36 +697,6 @@ table_cell_is_empty (const struct table *table, int c, int r)
   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).
index ed8e70123bb74b0894c32c1b6569b98c2d5d884f..77315c9b9c381befda8af2c5f24e789442220172 100644 (file)
@@ -258,12 +258,6 @@ static inline int table_ht (const struct table *t)
 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