aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-out.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/tui/tui-out.c')
-rw-r--r--gdb/tui/tui-out.c143
1 files changed, 44 insertions, 99 deletions
diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c
index a5f0541..90c581c 100644
--- a/gdb/tui/tui-out.c
+++ b/gdb/tui/tui-out.c
@@ -22,156 +22,101 @@
#include "defs.h"
#include "ui-out.h"
-#include "cli-out.h"
+#include "tui-out.h"
#include "tui.h"
-struct tui_ui_out_data
- {
- struct cli_ui_out_data base;
-
- int line;
- int start_of_line;
- };
-typedef struct tui_ui_out_data tui_out_data;
-
-/* This is the TUI ui-out implementation functions vector. It is
- initialized below in _initialize_tui_out, inheriting the CLI
- version, and overriding a few methods. */
-
-static struct ui_out_impl tui_ui_out_impl;
/* Output an int field. */
-static void
-tui_field_int (struct ui_out *uiout,
- int fldno, int width,
- enum ui_align alignment,
- const char *fldname,
- int value)
+void
+tui_ui_out::do_field_int (int fldno, int width, ui_align alignment,
+ const char *fldname, int value)
{
- tui_out_data *data = (tui_out_data *) ui_out_data (uiout);
-
- if (data->base.suppress_output)
+ if (suppress_output ())
return;
/* Don't print line number, keep it for later. */
- if (data->start_of_line == 0 && strcmp (fldname, "line") == 0)
+ if (m_start_of_line == 0 && strcmp (fldname, "line") == 0)
{
- data->start_of_line ++;
- data->line = value;
+ m_start_of_line++;
+ m_line = value;
return;
}
- data->start_of_line ++;
+ m_start_of_line++;
- (*cli_ui_out_impl.field_int) (uiout, fldno,
- width, alignment, fldname, value);
+ cli_ui_out::do_field_int (fldno, width, alignment, fldname, value);
}
/* Other cli_field_* end up here so alignment and field separators are
both handled by tui_field_string. */
-static void
-tui_field_string (struct ui_out *uiout,
- int fldno, int width,
- enum ui_align align,
- const char *fldname,
- const char *string)
+void
+tui_ui_out::do_field_string (int fldno, int width, ui_align align,
+ const char *fldname, const char *string)
{
- tui_out_data *data = (tui_out_data *) ui_out_data (uiout);
-
- if (data->base.suppress_output)
+ if (suppress_output ())
return;
- if (fldname && data->line > 0 && strcmp (fldname, "fullname") == 0)
+ if (fldname && m_line > 0 && strcmp (fldname, "fullname") == 0)
{
- data->start_of_line ++;
- if (data->line > 0)
+ m_start_of_line++;
+ if (m_line > 0)
{
- tui_show_source (string, data->line);
+ tui_show_source (string, m_line);
}
return;
}
- data->start_of_line++;
+ m_start_of_line++;
- (*cli_ui_out_impl.field_string) (uiout, fldno,
- width, align,
- fldname, string);
+ cli_ui_out::do_field_string (fldno, width, align, fldname, string);
}
/* This is the only field function that does not align. */
-static void
-tui_field_fmt (struct ui_out *uiout, int fldno,
- int width, enum ui_align align,
- const char *fldname,
- const char *format,
- va_list args)
+void
+tui_ui_out::do_field_fmt (int fldno, int width, ui_align align,
+ const char *fldname, const char *format,
+ va_list args)
{
- tui_out_data *data = (tui_out_data *) ui_out_data (uiout);
-
- if (data->base.suppress_output)
+ if (suppress_output ())
return;
- data->start_of_line++;
+ m_start_of_line++;
- (*cli_ui_out_impl.field_fmt) (uiout, fldno,
- width, align,
- fldname, format, args);
+ cli_ui_out::do_field_fmt (fldno, width, align, fldname, format, args);
}
-static void
-tui_text (struct ui_out *uiout, const char *string)
+void
+tui_ui_out::do_text (const char *string)
{
- tui_out_data *data = (tui_out_data *) ui_out_data (uiout);
-
- if (data->base.suppress_output)
+ if (suppress_output ())
return;
- data->start_of_line ++;
- if (data->line > 0)
+
+ m_start_of_line++;
+ if (m_line > 0)
{
if (strchr (string, '\n') != 0)
{
- data->line = -1;
- data->start_of_line = 0;
+ m_line = -1;
+ m_start_of_line = 0;
}
return;
}
if (strchr (string, '\n'))
- data->start_of_line = 0;
+ m_start_of_line = 0;
- (*cli_ui_out_impl.text) (uiout, string);
+ cli_ui_out::do_text (string);
}
-struct ui_out *
-tui_out_new (struct ui_file *stream)
+tui_ui_out::tui_ui_out (ui_file *stream)
+: cli_ui_out (stream, 0),
+ m_line (0),
+ m_start_of_line (-1)
{
- ui_out_flags flags = 0;
-
- tui_out_data *data = new tui_out_data ();
-
- /* Initialize base "class". */
- cli_out_data_ctor (&data->base, stream);
-
- /* Initialize our fields. */
- data->line = -1;
- data->start_of_line = 0;
-
- return ui_out_new (&tui_ui_out_impl, data, flags);
}
-/* Standard gdb initialization hook. */
-
-extern void _initialize_tui_out (void);
-
-void
-_initialize_tui_out (void)
+tui_ui_out *
+tui_out_new (struct ui_file *stream)
{
- /* Inherit the CLI version. */
- tui_ui_out_impl = cli_ui_out_impl;
-
- /* Override a few methods. */
- tui_ui_out_impl.field_int = tui_field_int;
- tui_ui_out_impl.field_string = tui_field_string;
- tui_ui_out_impl.field_fmt = tui_field_fmt;
- tui_ui_out_impl.text = tui_text;
+ return new tui_ui_out (stream);
}