Remove the ui_out_style_kind enum
authorTom Tromey <tom@tromey.com>
Wed, 5 Jun 2019 22:21:24 +0000 (16:21 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 1 Oct 2019 21:12:37 +0000 (15:12 -0600)
This removes the ui_out_style_kind enum, in favor of simply using
ui_file_style references.  This simplifies the code somewhat.

gdb/ChangeLog
2019-10-01  Tom Tromey  <tom@tromey.com>

* ui-out.h (enum class ui_out_style_kind): Remove.
(class ui_out) <field_string, field_stsream, do_field_string>:
Change type of "style".
* ui-out.c (ui_out::field_core_addr, ui_out::field_stream)
(ui_out::field_string): Update.
* tui/tui-out.h (class tui_ui_out) <do_field_string>: Change type
of "style".
* tui/tui-out.c (tui_ui_out::do_field_string): Update.
* tracepoint.c (print_one_static_tracepoint_marker): Update.
* stack.c (print_frame_arg, print_frame_info, print_frame):
Update.
* source.c (print_source_lines_base): Update.
* solib.c (info_sharedlibrary_command): Update.
* skip.c (info_skip_command): Update.
* record-btrace.c (btrace_call_history_src_line)
(btrace_call_history): Update.
* python/py-framefilter.c (py_print_frame): Update.
* mi/mi-out.h (class mi_ui_out) <do_field_string>: Change type of
"style".
* mi/mi-out.c (mi_ui_out::do_table_header)
(mi_ui_out::do_field_signed, mi_ui_out::do_field_unsigned)
(mi_ui_out::do_field_string): Update.
* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
Update.
* cli-out.h (class cli_ui_out) <do_field_string>: Change type of
"style".
* cli-out.c (cli_ui_out::do_table_header)
(cli_ui_out::do_field_signed, cli_ui_out::do_field_unsigned)
(cli_ui_out::do_field_skip, cli_ui_out::do_field_string)
(cli_ui_out::do_field_fmt): Update.
* breakpoint.c (print_breakpoint_location): Update.
(update_static_tracepoint): Update.

18 files changed:
gdb/ChangeLog
gdb/breakpoint.c
gdb/cli-out.c
gdb/cli-out.h
gdb/disasm.c
gdb/mi/mi-out.c
gdb/mi/mi-out.h
gdb/python/py-framefilter.c
gdb/record-btrace.c
gdb/skip.c
gdb/solib.c
gdb/source.c
gdb/stack.c
gdb/tracepoint.c
gdb/tui/tui-out.c
gdb/tui/tui-out.h
gdb/ui-out.c
gdb/ui-out.h

index 72855150de421eccc4c88186b0e782dc7715c20a..dd196d7e4f15faf02ff54154098286ca6368d7ca 100644 (file)
@@ -1,3 +1,38 @@
+2019-10-01  Tom Tromey  <tom@tromey.com>
+
+       * ui-out.h (enum class ui_out_style_kind): Remove.
+       (class ui_out) <field_string, field_stsream, do_field_string>:
+       Change type of "style".
+       * ui-out.c (ui_out::field_core_addr, ui_out::field_stream)
+       (ui_out::field_string): Update.
+       * tui/tui-out.h (class tui_ui_out) <do_field_string>: Change type
+       of "style".
+       * tui/tui-out.c (tui_ui_out::do_field_string): Update.
+       * tracepoint.c (print_one_static_tracepoint_marker): Update.
+       * stack.c (print_frame_arg, print_frame_info, print_frame):
+       Update.
+       * source.c (print_source_lines_base): Update.
+       * solib.c (info_sharedlibrary_command): Update.
+       * skip.c (info_skip_command): Update.
+       * record-btrace.c (btrace_call_history_src_line)
+       (btrace_call_history): Update.
+       * python/py-framefilter.c (py_print_frame): Update.
+       * mi/mi-out.h (class mi_ui_out) <do_field_string>: Change type of
+       "style".
+       * mi/mi-out.c (mi_ui_out::do_table_header)
+       (mi_ui_out::do_field_signed, mi_ui_out::do_field_unsigned)
+       (mi_ui_out::do_field_string): Update.
+       * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
+       Update.
+       * cli-out.h (class cli_ui_out) <do_field_string>: Change type of
+       "style".
+       * cli-out.c (cli_ui_out::do_table_header)
+       (cli_ui_out::do_field_signed, cli_ui_out::do_field_unsigned)
+       (cli_ui_out::do_field_skip, cli_ui_out::do_field_string)
+       (cli_ui_out::do_field_fmt): Update.
+       * breakpoint.c (print_breakpoint_location): Update.
+       (update_static_tracepoint): Update.
+
 2019-10-01  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
        * main.c (relocate_gdbinit_path_maybe_in_datadir): Remove std::string
index 838c9d136fd131eff5d2a80630b1f2fb3f5b17e4..dd8fe4c86208543fe42acb92b88ab6cb1bf19f01 100644 (file)
@@ -5823,14 +5823,14 @@ print_breakpoint_location (struct breakpoint *b,
        {
          uiout->text ("in ");
          uiout->field_string ("func", SYMBOL_PRINT_NAME (sym),
-                              ui_out_style_kind::FUNCTION);
+                              function_name_style.style ());
          uiout->text (" ");
          uiout->wrap_hint (wrap_indent_at_field (uiout, "what"));
          uiout->text ("at ");
        }
       uiout->field_string ("file",
                           symtab_to_filename_for_display (loc->symtab),
-                          ui_out_style_kind::FILE);
+                          file_name_style.style ());
       uiout->text (":");
 
       if (uiout->is_mi_like_p ())
@@ -13317,12 +13317,12 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
          if (sym)
            {
              uiout->field_string ("func", SYMBOL_PRINT_NAME (sym),
-                                  ui_out_style_kind::FUNCTION);
+                                  function_name_style.style ());
              uiout->text (" at ");
            }
          uiout->field_string ("file",
                               symtab_to_filename_for_display (sal2.symtab),
-                              ui_out_style_kind::FILE);
+                              file_name_style.style ());
          uiout->text (":");
 
          if (uiout->is_mi_like_p ())
index 549d518d60f8299203a573038c48f2f893de6cca..fa72a1d344f41afc281d8414aa0544a2626fc0f7 100644 (file)
@@ -73,7 +73,7 @@ cli_ui_out::do_table_header (int width, ui_align alignment,
     return;
 
   do_field_string (0, width, alignment, 0, col_hdr.c_str (),
-                  ui_out_style_kind::DEFAULT);
+                  ui_file_style ());
 }
 
 /* Mark beginning of a list */
@@ -100,7 +100,7 @@ cli_ui_out::do_field_signed (int fldno, int width, ui_align alignment,
     return;
 
   do_field_string (fldno, width, alignment, fldname, plongest (value),
-                  ui_out_style_kind::DEFAULT);
+                  ui_file_style ());
 }
 
 /* output an unsigned field */
@@ -113,7 +113,7 @@ cli_ui_out::do_field_unsigned (int fldno, int width, ui_align alignment,
     return;
 
   do_field_string (fldno, width, alignment, fldname, pulongest (value),
-                  ui_out_style_kind::DEFAULT);
+                  ui_file_style ());
 }
 
 /* used to omit a field */
@@ -126,7 +126,7 @@ cli_ui_out::do_field_skip (int fldno, int width, ui_align alignment,
     return;
 
   do_field_string (fldno, width, alignment, fldname, "",
-                  ui_out_style_kind::DEFAULT);
+                  ui_file_style ());
 }
 
 /* other specific cli_field_* end up here so alignment and field
@@ -135,7 +135,7 @@ cli_ui_out::do_field_skip (int fldno, int width, ui_align alignment,
 void
 cli_ui_out::do_field_string (int fldno, int width, ui_align align,
                             const char *fldname, const char *string,
-                            ui_out_style_kind style)
+                            const ui_file_style &style)
 {
   int before = 0;
   int after = 0;
@@ -170,31 +170,7 @@ cli_ui_out::do_field_string (int fldno, int width, ui_align align,
     spaces (before);
 
   if (string)
-    {
-      ui_file_style fstyle;
-      switch (style)
-       {
-       case ui_out_style_kind::DEFAULT:
-         /* Nothing.  */
-         break;
-       case ui_out_style_kind::FILE:
-         /* Nothing.  */
-         fstyle = file_name_style.style ();
-         break;
-       case ui_out_style_kind::FUNCTION:
-         fstyle = function_name_style.style ();
-         break;
-       case ui_out_style_kind::VARIABLE:
-         fstyle = variable_name_style.style ();
-         break;
-       case ui_out_style_kind::ADDRESS:
-         fstyle = address_style.style ();
-         break;
-       default:
-         gdb_assert_not_reached ("missing case");
-       }
-      fputs_styled (string, fstyle, m_streams.back ());
-    }
+    fputs_styled (string, style, m_streams.back ());
 
   if (after)
     spaces (after);
@@ -216,7 +192,7 @@ cli_ui_out::do_field_fmt (int fldno, int width, ui_align align,
   std::string str = string_vprintf (format, args);
 
   do_field_string (fldno, width, align, fldname, str.c_str (),
-                  ui_out_style_kind::DEFAULT);
+                  ui_file_style ());
 }
 
 void
index f38c1cc0571d0559215cea2647d2ee77f1d2f027..bc8b781d605d749adb28a4224b985ba87da08d0f 100644 (file)
@@ -57,7 +57,7 @@ protected:
   virtual void do_field_string (int fldno, int width, ui_align align,
                                const char *fldname,
                                const char *string,
-                               ui_out_style_kind style) override;
+                               const ui_file_style &style) override;
   virtual void do_field_fmt (int fldno, int width, ui_align align,
                             const char *fldname, const char *format,
                             va_list args)
index 68da682c15e7faefb1f9ab2e3e4caca4ba729e41..f483a5e5cd0ccffb4f13a960a7c28cc49b51d182 100644 (file)
@@ -31,6 +31,7 @@
 #include <algorithm>
 #include "gdbsupport/gdb_optional.h"
 #include "valprint.h"
+#include "cli/cli-style.h"
 
 /* Disassemble functions.
    FIXME: We should get rid of all the duplicate code in gdb that does
@@ -245,7 +246,7 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn
        m_uiout->text (" <");
        if (!omit_fname)
          m_uiout->field_string ("func-name", name.c_str (),
-                                ui_out_style_kind::FUNCTION);
+                                function_name_style.style ());
        /* For negative offsets, avoid displaying them as +-N; the sign of
           the offset takes the place of the "+" here.  */
        if (offset >= 0)
index a6687178259560411e623be0d95fbd821d5e86b4..0b930738f1dd5dbda118f441e5f24cde42ab5ebf 100644 (file)
@@ -70,9 +70,9 @@ mi_ui_out::do_table_header (int width, ui_align alignment,
   do_field_signed (0, 0, ui_center, "width", width);
   do_field_signed (0, 0, ui_center, "alignment", alignment);
   do_field_string (0, 0, ui_center, "col_name", col_name.c_str (),
-                  ui_out_style_kind::DEFAULT);
+                  ui_file_style ());
   do_field_string (0, width, alignment, "colhdr", col_hdr.c_str (),
-                  ui_out_style_kind::DEFAULT);
+                  ui_file_style ());
   close (ui_out_type_tuple);
 }
 
@@ -99,7 +99,7 @@ mi_ui_out::do_field_signed (int fldno, int width, ui_align alignment,
                            const char *fldname, LONGEST value)
 {
   do_field_string (fldno, width, alignment, fldname, plongest (value),
-                  ui_out_style_kind::DEFAULT);
+                  ui_file_style ());
 }
 
 /* Output an unsigned field.  */
@@ -109,7 +109,7 @@ mi_ui_out::do_field_unsigned (int fldno, int width, ui_align alignment,
                              const char *fldname, ULONGEST value)
 {
   do_field_string (fldno, width, alignment, fldname, pulongest (value),
-                  ui_out_style_kind::DEFAULT);
+                  ui_file_style ());
 }
 
 /* Used to omit a field.  */
@@ -126,7 +126,7 @@ mi_ui_out::do_field_skip (int fldno, int width, ui_align alignment,
 void
 mi_ui_out::do_field_string (int fldno, int width, ui_align align,
                            const char *fldname, const char *string,
-                           ui_out_style_kind style)
+                           const ui_file_style &style)
 {
   ui_file *stream = m_streams.back ();
   field_separator ();
index fe96658b59b37e0989622b59c89995b12b7baecc..90528fd4e84d270ca4d877270130c50a6bbe031c 100644 (file)
@@ -66,7 +66,7 @@ protected:
                           const char *fldname) override;
   virtual void do_field_string (int fldno, int width, ui_align align,
                                const char *fldname, const char *string,
-                               ui_out_style_kind style) override;
+                               const ui_file_style &style) override;
   virtual void do_field_fmt (int fldno, int width, ui_align align,
                          const char *fldname, const char *format, va_list args)
     override ATTRIBUTE_PRINTF (6,0);
index ecd633ab6950d6d2fc52fe307d53ff941897540d..f82a239c2a85e1f6aa8f4c19e66a547ab4563b9b 100644 (file)
@@ -33,6 +33,7 @@
 #include "mi/mi-cmds.h"
 #include "python-internal.h"
 #include "gdbsupport/gdb_optional.h"
+#include "cli/cli-style.h"
 
 enum mi_print_types
 {
@@ -947,7 +948,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
          if (function == NULL)
            out->field_skip ("func");
          else
-           out->field_string ("func", function, ui_out_style_kind::FUNCTION);
+           out->field_string ("func", function, function_name_style.style ());
        }
     }
 
@@ -987,7 +988,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
              out->text (" at ");
              annotate_frame_source_file ();
              out->field_string ("file", filename.get (),
-                                ui_out_style_kind::FILE);
+                                file_name_style.style ());
              annotate_frame_source_file_end ();
            }
        }
index b55459e4ad1a9198f710f979e3fdc8b35bd7a938..c923b365c48d1a178256ba793c5430c0ac508b66 100644 (file)
@@ -42,6 +42,7 @@
 #include "inferior.h"
 #include <algorithm>
 #include "gdbarch.h"
+#include "cli/cli-style.h"
 
 static const target_info record_btrace_target_info = {
   "record-btrace",
@@ -1084,7 +1085,7 @@ btrace_call_history_src_line (struct ui_out *uiout,
 
   uiout->field_string ("file",
                       symtab_to_filename_for_display (symbol_symtab (sym)),
-                      ui_out_style_kind::FILE);
+                      file_name_style.style ());
 
   btrace_compute_src_line_range (bfun, &begin, &end);
   if (end < begin)
@@ -1176,13 +1177,13 @@ btrace_call_history (struct ui_out *uiout,
 
       if (sym != NULL)
        uiout->field_string ("function", SYMBOL_PRINT_NAME (sym),
-                            ui_out_style_kind::FUNCTION);
+                            function_name_style.style ());
       else if (msym != NULL)
        uiout->field_string ("function", MSYMBOL_PRINT_NAME (msym),
-                            ui_out_style_kind::FUNCTION);
+                            function_name_style.style ());
       else if (!uiout->is_mi_like_p ())
        uiout->field_string ("function", "??",
-                            ui_out_style_kind::FUNCTION);
+                            function_name_style.style ());
 
       if ((flags & RECORD_PRINT_INSN_RANGE) != 0)
        {
index a549aca897c8489e60cdc1fafd798851d15d9500..fcf41bf79a732d05ac7a4eebf12d2feeaf08e662 100644 (file)
@@ -36,6 +36,7 @@
 #include "gdb_regex.h"
 #include "gdbsupport/gdb_optional.h"
 #include <list>
+#include "cli/cli-style.h"
 
 /* True if we want to print debug printouts related to file/function
    skipping. */
@@ -414,7 +415,7 @@ info_skip_command (const char *arg, int from_tty)
       current_uiout->field_string ("file",
                                   e.file ().empty () ? "<none>"
                                   : e.file ().c_str (),
-                                  ui_out_style_kind::FILE); /* 4 */
+                                  file_name_style.style ()); /* 4 */
       if (e.function_is_regexp ())
        current_uiout->field_string ("regexp", "y"); /* 5 */
       else
@@ -423,7 +424,7 @@ info_skip_command (const char *arg, int from_tty)
       current_uiout->field_string ("function",
                                   e.function ().empty () ? "<none>"
                                   : e.function ().c_str (),
-                                  ui_out_style_kind::FUNCTION); /* 6 */
+                                  function_name_style.style ()); /* 6 */
 
       current_uiout->text ("\n");
     }
index 5b1246929b5b1346447f43de8954a0001bb1b93a..db6a52d2c147fccd8cb7004753354d35e1f7ff42 100644 (file)
@@ -47,6 +47,7 @@
 #include "gdb_bfd.h"
 #include "gdbsupport/filestuff.h"
 #include "source.h"
+#include "cli/cli-style.h"
 
 /* Architecture-specific operations.  */
 
@@ -1104,7 +1105,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
        else
          uiout->field_string ("syms-read", so->symbols_loaded ? "Yes" : "No");
 
-       uiout->field_string ("name", so->so_name, ui_out_style_kind::FILE);
+       uiout->field_string ("name", so->so_name, file_name_style.style ());
 
        uiout->text ("\n");
       }
index 0171f2748b42b51f37715c429a2ef1e266089c26..ff2181894951a16739ee562d531dbcb74c08befc 100644 (file)
@@ -46,6 +46,7 @@
 #include <algorithm>
 #include "gdbsupport/pathstuff.h"
 #include "source-cache.h"
+#include "cli/cli-style.h"
 
 #define OPEN_MODE (O_RDONLY | O_BINARY)
 #define FDOPEN_MODE FOPEN_RB
@@ -1235,7 +1236,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
             not for TUI.  */
          if (uiout->is_mi_like_p () || uiout->test_flags (ui_source_list))
            uiout->field_string ("file", symtab_to_filename_for_display (s),
-                                ui_out_style_kind::FILE);
+                                file_name_style.style ());
          if (uiout->is_mi_like_p () || !uiout->test_flags (ui_source_list))
            {
              const char *s_fullname = symtab_to_fullname (s);
index 0f7fbf5e6efc531aaad968edaf34916be2642061..4899d0f416984f3a7237ea8959f57ce5bb53c2bf 100644 (file)
@@ -54,6 +54,7 @@
 #include "observable.h"
 #include "gdbsupport/def-vector.h"
 #include "cli/cli-option.h"
+#include "cli/cli-style.h"
 
 /* The possible choices of "set print frame-arguments", and the value
    of this setting.  */
@@ -381,7 +382,7 @@ print_frame_arg (const frame_print_options &fp_opts,
   if (arg->entry_kind == print_entry_values_only
       || arg->entry_kind == print_entry_values_compact)
     stb.puts ("@entry");
-  uiout->field_stream ("name", stb, ui_out_style_kind::VARIABLE);
+  uiout->field_stream ("name", stb, variable_name_style.style ());
   annotate_arg_name_end ();
   uiout->text ("=");
 
@@ -1005,18 +1006,18 @@ print_frame_info (const frame_print_options &fp_opts,
         {
           annotate_function_call ();
           uiout->field_string ("func", "<function called from gdb>",
-                              ui_out_style_kind::FUNCTION);
+                              function_name_style.style ());
        }
       else if (get_frame_type (frame) == SIGTRAMP_FRAME)
         {
          annotate_signal_handler_caller ();
           uiout->field_string ("func", "<signal handler called>",
-                              ui_out_style_kind::FUNCTION);
+                              function_name_style.style ());
         }
       else if (get_frame_type (frame) == ARCH_FRAME)
         {
           uiout->field_string ("func", "<cross-architecture call>",
-                              ui_out_style_kind::FUNCTION);
+                              function_name_style.style ());
        }
       uiout->text ("\n");
       annotate_frame_end ();
@@ -1310,7 +1311,7 @@ print_frame (const frame_print_options &fp_opts,
            print_pc (uiout, gdbarch, frame, pc);
          else
            uiout->field_string ("addr", "<unavailable>",
-                                ui_out_style_kind::ADDRESS);
+                                address_style.style ());
          annotate_frame_address_end ();
          uiout->text (" in ");
        }
@@ -1319,7 +1320,7 @@ print_frame (const frame_print_options &fp_opts,
     string_file stb;
     fprintf_symbol_filtered (&stb, funname ? funname.get () : "??",
                             funlang, DMGL_ANSI);
-    uiout->field_stream ("func", stb, ui_out_style_kind::FUNCTION);
+    uiout->field_stream ("func", stb, function_name_style.style ());
     uiout->wrap_hint ("   ");
     annotate_frame_args ();
 
@@ -1361,7 +1362,8 @@ print_frame (const frame_print_options &fp_opts,
        uiout->wrap_hint ("   ");
        uiout->text (" at ");
        annotate_frame_source_file ();
-       uiout->field_string ("file", filename_display, ui_out_style_kind::FILE);
+       uiout->field_string ("file", filename_display,
+                            file_name_style.style ());
        if (uiout->is_mi_like_p ())
          {
            const char *fullname = symtab_to_fullname (sal.symtab);
index c2c5f4224622b3c141c819b0d26432309acd3bd3..2f91e49efd3f21450495542145bfe11fe3bdc020 100644 (file)
@@ -57,6 +57,7 @@
 #include "tracefile.h"
 #include "location.h"
 #include <algorithm>
+#include "cli/cli-style.h"
 
 #include <unistd.h>
 
@@ -3683,7 +3684,7 @@ print_one_static_tracepoint_marker (int count,
     {
       uiout->text ("in ");
       uiout->field_string ("func", SYMBOL_PRINT_NAME (sym),
-                          ui_out_style_kind::FUNCTION);
+                          function_name_style.style ());
       uiout->wrap_hint (wrap_indent);
       uiout->text (" at ");
     }
@@ -3694,7 +3695,7 @@ print_one_static_tracepoint_marker (int count,
     {
       uiout->field_string ("file",
                           symtab_to_filename_for_display (sal.symtab),
-                          ui_out_style_kind::FILE);
+                          file_name_style.style ());
       uiout->text (":");
 
       if (uiout->is_mi_like_p ())
index 50865ba0465a952fbe32c0a33d6cecf1110d24ec..d415e7b64a0404dbbe38fb78fde4c1b86e09c51a 100644 (file)
@@ -52,7 +52,7 @@ tui_ui_out::do_field_signed (int fldno, int width, ui_align alignment,
 void
 tui_ui_out::do_field_string (int fldno, int width, ui_align align,
                             const char *fldname, const char *string,
-                            ui_out_style_kind style)
+                            const ui_file_style &style)
 {
   if (suppress_output ())
     return;
index 083094ba75eb2d8ae96e5bcc61146e7bfd71bea6..9df9e93aa9df676a5068c387cbee30ac11bd429c 100644 (file)
@@ -35,7 +35,7 @@ protected:
   void do_field_signed (int fldno, int width, ui_align align, const char *fldname,
                        LONGEST value) override;
   void do_field_string (int fldno, int width, ui_align align, const char *fldname,
-                       const char *string, ui_out_style_kind style) override;
+                       const char *string, const ui_file_style &style) override;
   void do_field_fmt (int fldno, int width, ui_align align, const char *fldname,
                  const char *format, va_list args) override
     ATTRIBUTE_PRINTF (6,0);
index 91662fac4a22f3493e08d8182cd4caaa10e40534..e8fe44c8268e31ab0a3818581a4a4bc0c832d8f4 100644 (file)
@@ -24,6 +24,8 @@
 #include "expression.h"                /* For language.h */
 #include "language.h"
 #include "ui-out.h"
+#include "gdbsupport/format.h"
+#include "cli/cli-style.h"
 
 #include <vector>
 #include <memory>
@@ -483,12 +485,12 @@ ui_out::field_core_addr (const char *fldname, struct gdbarch *gdbarch,
                         CORE_ADDR address)
 {
   field_string (fldname, print_core_address (gdbarch, address),
-               ui_out_style_kind::ADDRESS);
+               address_style.style ());
 }
 
 void
 ui_out::field_stream (const char *fldname, string_file &stream,
-                     ui_out_style_kind style)
+                     const ui_file_style &style)
 {
   if (!stream.empty ())
     field_string (fldname, stream.c_str (), style);
@@ -513,7 +515,7 @@ ui_out::field_skip (const char *fldname)
 
 void
 ui_out::field_string (const char *fldname, const char *string,
-                     ui_out_style_kind style)
+                     const ui_file_style &style)
 {
   int fldno;
   int width;
index 7041d9690e59854deaf8d133675797bfc5625c8d..6732f04671915bdede5b83de8df580c1e70b5819 100644 (file)
@@ -26,6 +26,7 @@
 #include <vector>
 
 #include "gdbsupport/enum-flags.h"
+#include "ui-style.h"
 
 class ui_out_level;
 class ui_out_table;
@@ -67,22 +68,6 @@ enum ui_out_type
     ui_out_type_list
   };
 
-/* Possible kinds of styling.  */
-
-enum class ui_out_style_kind
-{
-  /* The default (plain) style.  */
-  DEFAULT,
-  /* File name.  */
-  FILE,
-  /* Function name.  */
-  FUNCTION,
-  /* Variable name.  */
-  VARIABLE,
-  /* Address.  */
-  ADDRESS
-};
-
 class ui_out
 {
  public:
@@ -115,10 +100,10 @@ class ui_out
   void field_core_addr (const char *fldname, struct gdbarch *gdbarch,
                        CORE_ADDR address);
   void field_string (const char *fldname, const char *string,
-                    ui_out_style_kind style = ui_out_style_kind::DEFAULT);
+                    const ui_file_style &style = ui_file_style ());
   void field_string (const char *fldname, const std::string &string);
   void field_stream (const char *fldname, string_file &stream,
-                    ui_out_style_kind style = ui_out_style_kind::DEFAULT);
+                    const ui_file_style &style = ui_file_style ());
   void field_skip (const char *fldname);
   void field_fmt (const char *fldname, const char *format, ...)
     ATTRIBUTE_PRINTF (3, 4);
@@ -169,7 +154,7 @@ class ui_out
                              const char *fldname) = 0;
   virtual void do_field_string (int fldno, int width, ui_align align,
                                const char *fldname, const char *string,
-                               ui_out_style_kind style) = 0;
+                               const ui_file_style &style) = 0;
   virtual void do_field_fmt (int fldno, int width, ui_align align,
                             const char *fldname, const char *format,
                             va_list args)