aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-data.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-06-16 16:03:54 -0600
committerTom Tromey <tom@tromey.com>2019-06-25 07:48:37 -0600
commitcb2ce89305264543a4014d98bacb26800d92d394 (patch)
treee86e884ade455bdd50ce3039924029caf588ad40 /gdb/tui/tui-data.c
parentab313b35e505ccab9c23acbe82087b6c22a2088d (diff)
downloadgdb-cb2ce89305264543a4014d98bacb26800d92d394.zip
gdb-cb2ce89305264543a4014d98bacb26800d92d394.tar.gz
gdb-cb2ce89305264543a4014d98bacb26800d92d394.tar.bz2
Derive tui_win_info from tui_gen_win_info
This changes tui_win_info to derive from tui_gen_win_info, rather than having a tui_gen_win_info as a member. This removes a layer of member access from the entire TUI, which is why this patch is so large. This change will enable further removal of switches based on window type. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_rl_other_window, tui_enable) (tui_is_window_visible, tui_get_command_dimension): Update. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_clear_source_content, tui_erase_source_content) (tui_show_source_line, tui_source_window_base::refill) (tui_source_window_base::do_scroll_horizontal) (tui_source_window_base::set_is_exec_point_at) (tui_update_breakpoint_info, tui_set_exec_info_content) (tui_alloc_source_buffer, tui_line_is_displayed) (tui_addr_is_displayed): Update. * tui/tui-wingeneral.c (tui_unhighlight_win, tui_highlight_win) (tui_check_and_display_highlight_if_needed) (tui_win_info::make_visible, tui_win_info::refresh) (tui_refresh_all): Update. * tui/tui-windata.c (tui_first_data_item_displayed) (tui_delete_data_content_windows, tui_erase_data_content) (tui_display_all_data, tui_data_window::refresh_all) (tui_check_data_values): Update. * tui/tui-win.c (window_name_completer, tui_update_gdb_sizes) (tui_set_win_focus_to, tui_win_info::forward_scroll) (tui_win_info::backward_scroll, tui_refresh_all_win) (tui_resize_all, tui_set_focus, tui_all_windows_info) (update_tab_width, tui_set_win_height, tui_adjust_win_heights) (tui_source_window_base::set_new_height) (tui_data_window::set_new_height) (make_invisible_and_set_new_height) (make_visible_with_new_height, new_height_ok) (parse_scrolling_args): Update. * tui/tui-stack.c (tui_show_frame_info): Update. * tui/tui-source.c (tui_set_source_content) (tui_set_source_content_nil, tui_source_is_displayed) (tui_source_window::do_scroll_vertical): Update. * tui/tui-regs.c (tui_show_registers, tui_show_register_group) (tui_display_registers_from, tui_display_reg_element_at_line) (tui_check_register_values, tui_reg_command): Update. * tui/tui-layout.c (tui_default_win_height) (show_source_disasm_command, show_data, init_and_make_win) (show_source_or_disasm_and_command): Update. * tui/tui-io.c (update_cmdwin_start_line, tui_putc, tui_puts) (tui_redisplay_readline, tui_mld_flush) (tui_mld_erase_entire_line, tui_mld_getc, tui_cont_sig) (tui_getc): Update. * tui/tui-disasm.c (tui_set_disassem_content) (tui_disasm_window::do_scroll_vertical): Update. * tui/tui-data.h (struct tui_gen_win_info) <~tui_gen_win_info>: Now virtual. (struct tui_win_info): Derive from tui_gen_win_info. <~tui_win_info>: Mark as override. <generic>: Remove member. * tui/tui-data.c (tui_cmd_window::clear_detail, tui_next_win) (tui_prev_win, tui_partial_win_by_name, tui_win_info) (~tui_data_window, ~tui_win_info) (tui_free_all_source_wins_content): Update. * tui/tui-command.c (tui_refresh_cmd_win): Update.
Diffstat (limited to 'gdb/tui/tui-data.c')
-rw-r--r--gdb/tui/tui-data.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 86e347f..c9f401f 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -169,7 +169,7 @@ tui_source_window_base::clear_detail ()
void
tui_cmd_window::clear_detail ()
{
- wmove (generic.handle, 0, 0);
+ wmove (handle, 0, 0);
}
/* See tui-data.h. */
@@ -268,17 +268,17 @@ tui_set_current_layout_to (enum tui_layout_type new_layout)
struct tui_win_info *
tui_next_win (struct tui_win_info *cur_win)
{
- int type = cur_win->generic.type;
+ int type = cur_win->type;
struct tui_win_info *next_win = NULL;
- if (cur_win->generic.type == CMD_WIN)
+ if (cur_win->type == CMD_WIN)
type = SRC_WIN;
else
- type = cur_win->generic.type + 1;
- while (type != cur_win->generic.type && (next_win == NULL))
+ type = cur_win->type + 1;
+ while (type != cur_win->type && (next_win == NULL))
{
if (tui_win_list[type]
- && tui_win_list[type]->generic.is_visible)
+ && tui_win_list[type]->is_visible)
next_win = tui_win_list[type];
else
{
@@ -298,17 +298,17 @@ tui_next_win (struct tui_win_info *cur_win)
struct tui_win_info *
tui_prev_win (struct tui_win_info *cur_win)
{
- int type = cur_win->generic.type;
+ int type = cur_win->type;
struct tui_win_info *prev = NULL;
- if (cur_win->generic.type == SRC_WIN)
+ if (cur_win->type == SRC_WIN)
type = CMD_WIN;
else
- type = cur_win->generic.type - 1;
- while (type != cur_win->generic.type && (prev == NULL))
+ type = cur_win->type - 1;
+ while (type != cur_win->type && (prev == NULL))
{
if (tui_win_list[type]
- && tui_win_list[type]->generic.is_visible)
+ && tui_win_list[type]->is_visible)
prev = tui_win_list[type];
else
{
@@ -337,8 +337,7 @@ tui_partial_win_by_name (const char *name)
{
if (tui_win_list[i] != 0)
{
- const char *cur_name =
- tui_win_name (&tui_win_list[i]->generic);
+ const char *cur_name = tui_win_name (tui_win_list[i]);
if (strlen (name) <= strlen (cur_name)
&& startswith (cur_name, name))
@@ -457,7 +456,7 @@ init_content_element (struct tui_win_element *element,
}
tui_win_info::tui_win_info (enum tui_win_type type)
- : generic (type)
+ : tui_gen_win_info (type)
{
}
@@ -569,7 +568,7 @@ tui_source_window_base::~tui_source_window_base ()
tui_data_window::~tui_data_window ()
{
- if (generic.content != NULL)
+ if (content != NULL)
{
tui_free_data_content (regs_content, regs_content_count);
regs_content = NULL;
@@ -579,21 +578,21 @@ tui_data_window::~tui_data_window ()
data_content_count = 0;
regs_column_count = 1;
display_regs = false;
- generic.content = NULL;
- generic.content_size = 0;
+ content = NULL;
+ content_size = 0;
}
}
tui_win_info::~tui_win_info ()
{
- if (generic.handle != NULL)
+ if (handle != NULL)
{
- tui_delete_win (generic.handle);
- generic.handle = NULL;
- tui_free_win_content (&generic);
+ tui_delete_win (handle);
+ handle = NULL;
+ tui_free_win_content (this);
}
- if (generic.title)
- xfree (generic.title);
+ if (title)
+ xfree (title);
}
@@ -602,7 +601,7 @@ tui_free_all_source_wins_content ()
{
for (tui_source_window_base *win_info : tui_source_windows ())
{
- tui_free_win_content (&(win_info->generic));
+ tui_free_win_content (win_info);
tui_free_win_content (win_info->execution_info);
}
}