Use "bool" in more spots in TUI

This changes a few spots in the TUI to use "bool" rather than "int".
Tested on x86-64 Fedora 28.

gdb/ChangeLog
2019-12-30  Tom Tromey  <tom@tromey.com>

	* tui/tui-interp.c (tui_start_enabled): Now bool.
	(_initialize_tui_interp): Update.
	* tui/tui-hooks.c (tui_refreshing_registers): Now bool.
	(tui_register_changed)
	(tui_refresh_frame_and_register_information): Update.
	* tui/tui-win.c (tui_update_variables): Return bool.
	* tui/tui-win.h (tui_update_variables): Return bool.
	* tui/tui.c (tui_get_command_dimension): Return bool.
	* tui/tui.h (tui_get_command_dimension): Return bool.

Change-Id: I55b7f2d62d2ef88da3587dc914ada9f463ad8d2b
This commit is contained in:
Tom Tromey 2019-12-30 09:07:33 -07:00
parent a7ac9aa525
commit 87d557ae1b
7 changed files with 33 additions and 23 deletions

View File

@ -1,3 +1,15 @@
2019-12-30 Tom Tromey <tom@tromey.com>
* tui/tui-interp.c (tui_start_enabled): Now bool.
(_initialize_tui_interp): Update.
* tui/tui-hooks.c (tui_refreshing_registers): Now bool.
(tui_register_changed)
(tui_refresh_frame_and_register_information): Update.
* tui/tui-win.c (tui_update_variables): Return bool.
* tui/tui-win.h (tui_update_variables): Return bool.
* tui/tui.c (tui_get_command_dimension): Return bool.
* tui/tui.h (tui_get_command_dimension): Return bool.
2019-12-29 Bernd Edlinger <bernd.edlinger@hotmail.de>
* buildsym.c (buildsym_compunit::record_line): Do no longer ignore

View File

@ -57,7 +57,7 @@ tui_new_objfile_hook (struct objfile* objfile)
}
/* Prevent recursion of deprecated_register_changed_hook(). */
static int tui_refreshing_registers = 0;
static bool tui_refreshing_registers = false;
/* Observer for the register_changed notification. */
@ -75,11 +75,11 @@ tui_register_changed (struct frame_info *frame, int regno)
up in the other. So we always use the selected frame here, and ignore
FRAME. */
fi = get_selected_frame (NULL);
if (tui_refreshing_registers == 0)
if (!tui_refreshing_registers)
{
tui_refreshing_registers = 1;
tui_refreshing_registers = true;
TUI_DATA_WIN->check_register_values (fi);
tui_refreshing_registers = 0;
tui_refreshing_registers = false;
}
}
@ -139,9 +139,9 @@ tui_refresh_frame_and_register_information ()
if (tui_is_window_visible (DATA_WIN)
&& (frame_info_changed_p || from_stack))
{
tui_refreshing_registers = 1;
tui_refreshing_registers = true;
TUI_DATA_WIN->check_register_values (fi);
tui_refreshing_registers = 0;
tui_refreshing_registers = false;
}
}
else if (!from_stack)

View File

@ -35,9 +35,9 @@
#include "inferior.h"
#include "main.h"
/* Set to 1 when the TUI mode must be activated when we first start
/* Set to true when the TUI mode must be activated when we first start
gdb. */
static int tui_start_enabled = 0;
static bool tui_start_enabled = false;
class tui_interp final : public cli_interp_base
{
@ -312,7 +312,7 @@ _initialize_tui_interp (void)
interp_factory_register (INTERP_TUI, tui_interp_factory);
if (interpreter_p && strcmp (interpreter_p, INTERP_TUI) == 0)
tui_start_enabled = 1;
tui_start_enabled = true;
if (interpreter_p && strcmp (interpreter_p, INTERP_CONSOLE) == 0)
{

View File

@ -254,23 +254,23 @@ translate (const char *name, struct tui_translate *table)
/* Update the tui internal configuration according to gdb settings.
Returns 1 if the configuration has changed and the screen should
be redrawn. */
int
tui_update_variables (void)
bool
tui_update_variables ()
{
int need_redraw = 0;
bool need_redraw = false;
struct tui_translate *entry;
entry = translate (tui_border_mode, tui_border_mode_translate);
if (tui_border_attrs != entry->value)
{
tui_border_attrs = entry->value;
need_redraw = 1;
need_redraw = true;
}
entry = translate (tui_active_border_mode, tui_border_mode_translate);
if (tui_active_border_attrs != entry->value)
{
tui_active_border_attrs = entry->value;
need_redraw = 1;
need_redraw = true;
}
/* If one corner changes, all characters are changed.
@ -280,7 +280,7 @@ tui_update_variables (void)
if (tui_border_lrcorner != (chtype) entry->value)
{
tui_border_lrcorner = (entry->value < 0) ? ACS_LRCORNER : entry->value;
need_redraw = 1;
need_redraw = true;
}
entry = translate (tui_border_kind, tui_border_kind_translate_llcorner);
tui_border_llcorner = (entry->value < 0) ? ACS_LLCORNER : entry->value;

View File

@ -44,7 +44,7 @@ extern chtype tui_border_hline;
extern int tui_border_attrs;
extern int tui_active_border_attrs;
extern int tui_update_variables (void);
extern bool tui_update_variables ();
extern void tui_initialize_win (void);

View File

@ -591,18 +591,16 @@ tui_is_window_visible (enum tui_win_type type)
return tui_win_list[type]->is_visible ();
}
int
bool
tui_get_command_dimension (unsigned int *width,
unsigned int *height)
{
if (!tui_active || (TUI_CMD_WIN == NULL))
{
return 0;
}
return false;
*width = TUI_CMD_WIN->width;
*height = TUI_CMD_WIN->height;
return 1;
return true;
}
void

View File

@ -49,8 +49,8 @@ extern CORE_ADDR tui_get_low_disassembly_address (struct gdbarch *,
CORE_ADDR, CORE_ADDR);
extern void tui_show_assembly (struct gdbarch *gdbarch, CORE_ADDR addr);
extern bool tui_is_window_visible (enum tui_win_type type);
extern int tui_get_command_dimension (unsigned int *width,
unsigned int *height);
extern bool tui_get_command_dimension (unsigned int *width,
unsigned int *height);
/* Initialize readline and configure the keymap for the switching
key shortcut. */