Remove struct tui_command_info
authorTom Tromey <tom@tromey.com>
Sun, 16 Jun 2019 19:55:51 +0000 (13:55 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 25 Jun 2019 13:48:30 +0000 (07:48 -0600)
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  <tom@tromey.com>

* 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) <detail>: Remove command_info member.
(struct tui_data_window) <start_line>: New member, from
tui_command_info.
(TUI_CMD_WIN): Add casts.

gdb/ChangeLog
gdb/tui/tui-data.h
gdb/tui/tui-io.c
gdb/tui/tui-layout.c

index 3fd6bc73dbd416406bdbe6b651c5bc0ee2c3a0f3..ab825d2efd223651f6fc3531e42ad46e3c82295a 100644 (file)
@@ -1,3 +1,15 @@
+2019-06-25  Tom Tromey  <tom@tromey.com>
+
+       * 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) <detail>: Remove command_info member.
+       (struct tui_data_window) <start_line>: New member, from
+       tui_command_info.
+       (TUI_CMD_WIN): Add casts.
+
 2019-06-25  Tom Tromey  <tom@tromey.com>
 
        * tui/tui-winsource.c (tui_update_source_window)
index 4aef2f58ae093aee810eb4eeb01d58242fc0a7fd..91d0c94b414ddf53a1b5b0ac276d7a336fe73b20 100644 (file)
@@ -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);
index 31c1c769381fb99cab6d9774f51e802a00d32646..cdb14bf53146f4d2d4c12656db3f3bf3c5b6fb99 100644 (file)
@@ -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);
index 55d737ab315b0cb461a19c03a33ec7a78a16c92d..95b89f8583af3fc32e8eb0517dc5cd20c58fa992 100644 (file)
@@ -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