gdb/tui/tui-out.c - gdb
Global variables defined
Data types defined
Functions defined
Source code
#include "defs.h"
#include "ui-out.h"
#include "cli-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;
static struct ui_out_impl tui_ui_out_impl;
static void
tui_field_int (struct ui_out *uiout,
int fldno, int width,
enum ui_align alignment,
const char *fldname,
int value)
{
tui_out_data *data = ui_out_data (uiout);
if (data->base.suppress_output)
return;
if (data->start_of_line == 0 && strcmp (fldname, "line") == 0)
{
data->start_of_line ++;
data->line = value;
return;
}
data->start_of_line ++;
(*cli_ui_out_impl.field_int) (uiout, fldno,
width, alignment, fldname, value);
}
static void
tui_field_string (struct ui_out *uiout,
int fldno, int width,
enum ui_align align,
const char *fldname,
const char *string)
{
tui_out_data *data = ui_out_data (uiout);
if (data->base.suppress_output)
return;
if (fldname && data->line > 0 && strcmp (fldname, "fullname") == 0)
{
data->start_of_line ++;
if (data->line > 0)
{
tui_show_source (string, data->line);
}
return;
}
data->start_of_line++;
(*cli_ui_out_impl.field_string) (uiout, fldno,
width, align,
fldname, string);
}
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)
{
tui_out_data *data = ui_out_data (uiout);
if (data->base.suppress_output)
return;
data->start_of_line++;
(*cli_ui_out_impl.field_fmt) (uiout, fldno,
width, align,
fldname, format, args);
}
static void
tui_text (struct ui_out *uiout, const char *string)
{
tui_out_data *data = ui_out_data (uiout);
if (data->base.suppress_output)
return;
data->start_of_line ++;
if (data->line > 0)
{
if (strchr (string, '\n') != 0)
{
data->line = -1;
data->start_of_line = 0;
}
return;
}
if (strchr (string, '\n'))
data->start_of_line = 0;
(*cli_ui_out_impl.text) (uiout, string);
}
struct ui_out *
tui_out_new (struct ui_file *stream)
{
int flags = 0;
tui_out_data *data = XNEW (tui_out_data);
cli_out_data_ctor (&data->base, stream);
data->line = -1;
data->start_of_line = 0;
return ui_out_new (&tui_ui_out_impl, data, flags);
}
extern void _initialize_tui_out (void);
void
_initialize_tui_out (void)
{
tui_ui_out_impl = cli_ui_out_impl;
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;
}