From 81491aa0968e5bcab0388914f909ccb12e084e32 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 16 Jun 2019 13:55:51 -0600 Subject: [PATCH] Remove struct tui_command_info Like the previous patch, this removes tui_command_info in favor of putting it elements directly into tui_cmd_window. gdb/ChangeLog 2019-06-25 Tom Tromey * tui/tui-layout.c (show_source_disasm_command) (show_source_or_disasm_and_command): Update. * tui/tui-io.c (update_cmdwin_start_line) (tui_redisplay_readline): Update. * tui/tui-data.h (struct tui_command_info): Remove. (struct tui_win_info) : Remove command_info member. (struct tui_data_window) : New member, from tui_command_info. (TUI_CMD_WIN): Add casts. --- gdb/ChangeLog | 12 ++++++++++++ gdb/tui/tui-data.h | 11 +++-------- gdb/tui/tui-io.c | 10 +++++----- gdb/tui/tui-layout.c | 7 ++++--- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3fd6bc7..ab825d2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,17 @@ 2019-06-25 Tom Tromey + * tui/tui-layout.c (show_source_disasm_command) + (show_source_or_disasm_and_command): Update. + * tui/tui-io.c (update_cmdwin_start_line) + (tui_redisplay_readline): Update. + * tui/tui-data.h (struct tui_command_info): Remove. + (struct tui_win_info) : Remove command_info member. + (struct tui_data_window) : New member, from + tui_command_info. + (TUI_CMD_WIN): Add casts. + +2019-06-25 Tom Tromey + * tui/tui-winsource.c (tui_update_source_window) (tui_refill_source_window) (tui_source_window_base::do_scroll_horizontal) diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 4aef2f5..91d0c94 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -238,12 +238,6 @@ struct tui_data_info }; -struct tui_command_info -{ - int start_line; -}; - - /* This defines information about each logical window. */ struct tui_win_info { @@ -287,7 +281,6 @@ public: union { struct tui_data_info data_display_info; - struct tui_command_info command_info; } detail; @@ -395,6 +388,8 @@ struct tui_cmd_window : public tui_win_info void clear_detail () override; + int start_line; + protected: void do_scroll_vertical (enum tui_scroll_direction, @@ -420,7 +415,7 @@ extern struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS]; #define TUI_SRC_WIN ((tui_source_window_base *) tui_win_list[SRC_WIN]) #define TUI_DISASM_WIN ((tui_source_window_base *) tui_win_list[DISASSEM_WIN]) #define TUI_DATA_WIN tui_win_list[DATA_WIN] -#define TUI_CMD_WIN tui_win_list[CMD_WIN] +#define TUI_CMD_WIN ((tui_cmd_window *) tui_win_list[CMD_WIN]) /* Data Manipulation Functions. */ extern void tui_initialize_static_data (void); diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index 31c1c76..cdb14bf 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -179,7 +179,7 @@ do_tui_putc (WINDOW *w, char c) static void update_cmdwin_start_line () { - TUI_CMD_WIN->detail.command_info.start_line + TUI_CMD_WIN->start_line = getcury (TUI_CMD_WIN->generic.handle); } @@ -539,7 +539,7 @@ tui_redisplay_readline (void) c_pos = -1; c_line = -1; w = TUI_CMD_WIN->generic.handle; - start_line = TUI_CMD_WIN->detail.command_info.start_line; + start_line = TUI_CMD_WIN->start_line; wmove (w, start_line, 0); prev_col = 0; height = 1; @@ -580,17 +580,17 @@ tui_redisplay_readline (void) waddch (w, c); } if (c == '\n') - TUI_CMD_WIN->detail.command_info.start_line = getcury (w); + TUI_CMD_WIN->start_line = getcury (w); col = getcurx (w); if (col < prev_col) height++; prev_col = col; } wclrtobot (w); - TUI_CMD_WIN->detail.command_info.start_line = getcury (w); + TUI_CMD_WIN->start_line = getcury (w); if (c_line >= 0) wmove (w, c_line, c_pos); - TUI_CMD_WIN->detail.command_info.start_line -= height - 1; + TUI_CMD_WIN->start_line -= height - 1; wrefresh (w); fflush(stdout); diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 55d737a..95b89f8 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -692,8 +692,8 @@ show_source_disasm_command (void) tui_show_source_content (TUI_DISASM_WIN); if (TUI_CMD_WIN == NULL) - TUI_CMD_WIN = make_command_window (cmd_height, - tui_term_height () - cmd_height); + tui_win_list[CMD_WIN] + = make_command_window (cmd_height, tui_term_height () - cmd_height); else { init_gen_win_info (&TUI_CMD_WIN->generic, @@ -958,7 +958,8 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type) if (TUI_CMD_WIN == NULL) { - TUI_CMD_WIN = make_command_window (cmd_height, src_height); + tui_win_list[CMD_WIN] = make_command_window (cmd_height, + src_height); tui_refresh_win (&TUI_CMD_WIN->generic); } else -- 2.7.4