/* TUI layout window management.
- Copyright (C) 1998-2017 Free Software Foundation, Inc.
+ Copyright (C) 1998-2019 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
static void show_data (enum tui_layout_type);
static enum tui_layout_type next_layout (void);
static enum tui_layout_type prev_layout (void);
-static void tui_layout_command (char *, int);
+static void tui_layout_command (const char *, int);
static void extract_display_start_addr (struct gdbarch **, CORE_ADDR *);
/* Complete possible layout names. TEXT is the complete text entered so
far, WORD is the word currently being completed. */
-static VEC (char_ptr) *
+static void
layout_completer (struct cmd_list_element *ignore,
+ completion_tracker &tracker,
const char *text, const char *word)
{
static const char *layout_names [] =
{ "src", "asm", "split", "regs", "next", "prev", NULL };
- return complete_on_enum (layout_names, text, word);
+ complete_on_enum (tracker, layout_names, text, word);
}
/* Function to initialize gdb commands, for tui window layout
manipulation. */
-/* Provide a prototype to silence -Wmissing-prototypes. */
-extern initialize_file_ftype _initialize_tui_layout;
-
void
_initialize_tui_layout (void)
{
cmd = add_com ("layout", class_tui, tui_layout_command, _("\
Change the layout of windows.\n\
-Usage: layout prev | next | <layout_name> \n\
+Usage: layout prev | next | LAYOUT-NAME\n\
Layout names are:\n\
src : Displays source and command windows.\n\
asm : Displays disassembly and command windows.\n\
{
enum tui_status status = TUI_SUCCESS;
- if (layout_name != (char *) NULL)
+ if (layout_name != NULL)
{
int i;
- char *buf_ptr;
enum tui_layout_type new_layout = UNDEFINED_LAYOUT;
enum tui_layout_type cur_layout = tui_current_layout ();
- struct cleanup *old_chain;
- buf_ptr = (char *) xstrdup (layout_name);
- for (i = 0; (i < strlen (layout_name)); i++)
- buf_ptr[i] = toupper (buf_ptr[i]);
- old_chain = make_cleanup (xfree, buf_ptr);
+ std::string copy = layout_name;
+ for (i = 0; i < copy.size (); i++)
+ copy[i] = toupper (copy[i]);
+ const char *buf_ptr = copy.c_str ();
/* First check for ambiguous input. */
if (strlen (buf_ptr) <= 1 && *buf_ptr == 'S')
tui_set_layout (new_layout);
}
}
- do_cleanups (old_chain);
}
else
status = TUI_FAILURE;
static void
-tui_layout_command (char *arg, int from_tty)
+tui_layout_command (const char *arg, int from_tty)
{
/* Switch to the selected layout. */
if (tui_set_layout_by_name (arg) != TUI_SUCCESS)
warning (_("Invalid layout specified.\n%s"), LAYOUT_USAGE);
-
}
/* Answer the previous layout to cycle to. */