#include <signal.h>
#include <stdio.h>
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-#endif
+#include "gdb_curses.h"
int
key_is_start_sequence (int ch)
This may be the main gdb prompt or a secondary prompt. */
static char *tui_rl_saved_prompt;
-static unsigned int _tuiHandleResizeDuringIO (unsigned int);
+static unsigned int tui_handle_resize_during_io (unsigned int);
static void
tui_putc (char c)
char c;
WINDOW *w;
- w = cmdWin->generic.handle;
+ w = TUI_CMD_WIN->generic.handle;
while ((c = *string++) != 0)
{
/* Catch annotation and discard them. We need two \032 and
else if (c == '\n')
tui_skip_line = -1;
}
- getyx (w, cmdWin->detail.commandInfo.curLine,
- cmdWin->detail.commandInfo.curch);
- cmdWin->detail.commandInfo.start_line = cmdWin->detail.commandInfo.curLine;
+ getyx (w, TUI_CMD_WIN->detail.command_info.cur_line,
+ TUI_CMD_WIN->detail.command_info.curch);
+ TUI_CMD_WIN->detail.command_info.start_line = TUI_CMD_WIN->detail.command_info.cur_line;
/* We could defer the following. */
wrefresh (w);
/* Detect when we temporarily left SingleKey and now the readline
edit buffer is empty, automatically restore the SingleKey mode. */
- if (tui_current_key_mode == tui_one_command_mode && rl_end == 0)
- tui_set_key_mode (tui_single_key_mode);
+ if (tui_current_key_mode == TUI_ONE_COMMAND_MODE && rl_end == 0)
+ tui_set_key_mode (TUI_SINGLE_KEY_MODE);
- if (tui_current_key_mode == tui_single_key_mode)
+ if (tui_current_key_mode == TUI_SINGLE_KEY_MODE)
prompt = "";
else
prompt = tui_rl_saved_prompt;
c_pos = -1;
c_line = -1;
- w = cmdWin->generic.handle;
- start_line = cmdWin->detail.commandInfo.start_line;
+ w = TUI_CMD_WIN->generic.handle;
+ start_line = TUI_CMD_WIN->detail.command_info.start_line;
wmove (w, start_line, 0);
prev_col = 0;
height = 1;
}
if (c == '\n')
{
- getyx (w, cmdWin->detail.commandInfo.start_line,
- cmdWin->detail.commandInfo.curch);
+ getyx (w, TUI_CMD_WIN->detail.command_info.start_line,
+ TUI_CMD_WIN->detail.command_info.curch);
}
getyx (w, line, col);
if (col < prev_col)
prev_col = col;
}
wclrtobot (w);
- getyx (w, cmdWin->detail.commandInfo.start_line,
- cmdWin->detail.commandInfo.curch);
+ getyx (w, TUI_CMD_WIN->detail.command_info.start_line,
+ TUI_CMD_WIN->detail.command_info.curch);
if (c_line >= 0)
{
wmove (w, c_line, c_pos);
- cmdWin->detail.commandInfo.curLine = c_line;
- cmdWin->detail.commandInfo.curch = c_pos;
+ TUI_CMD_WIN->detail.command_info.cur_line = c_line;
+ TUI_CMD_WIN->detail.command_info.curch = c_pos;
}
- cmdWin->detail.commandInfo.start_line -= height - 1;
+ TUI_CMD_WIN->detail.command_info.start_line -= height - 1;
wrefresh (w);
fflush(stdout);
Comes from readline/complete.c */
static char *
-printable_part (pathname)
- char *pathname;
+printable_part (char *pathname)
{
char *temp;
} while (0)
static int
-print_filename (to_print, full_pathname)
- char *to_print, *full_pathname;
+print_filename (char *to_print, char *full_pathname)
{
int printed_len = 0;
char *s;
/* The user must press "y" or "n". Non-zero return means "y" pressed.
Comes from readline/complete.c */
static int
-get_y_or_n ()
+get_y_or_n (void)
{
extern int _rl_abort_internal ();
int c;
Comes from readline/complete.c and modified to write in
the TUI command window using tui_putc/tui_puts. */
static void
-tui_rl_display_match_list (matches, len, max)
- char **matches;
- int len, max;
+tui_rl_display_match_list (char **matches, int len, int max)
{
typedef int QSFUNC (const void *, const void *);
extern int _rl_qsort_string_compare (const void*, const void*);
char *temp;
/* Screen dimension correspond to the TUI command window. */
- int screenwidth = cmdWin->generic.width;
+ int screenwidth = TUI_CMD_WIN->generic.width;
/* If there are many items, then ask the user if she really wants to
see them all. */
tui_refresh_all_win ();
/* Update cursor position on the screen. */
- wmove (cmdWin->generic.handle,
- cmdWin->detail.commandInfo.start_line,
- cmdWin->detail.commandInfo.curch);
- wrefresh (cmdWin->generic.handle);
+ wmove (TUI_CMD_WIN->generic.handle,
+ TUI_CMD_WIN->detail.command_info.start_line,
+ TUI_CMD_WIN->detail.command_info.curch);
+ wrefresh (TUI_CMD_WIN->generic.handle);
}
signal (sig, tui_cont_sig);
}
/* Initialize the IO for gdb in curses mode. */
void
-tui_initialize_io ()
+tui_initialize_io (void)
{
#ifdef SIGCONT
signal (SIGCONT, tui_cont_sig);
int ch;
WINDOW *w;
- w = cmdWin->generic.handle;
+ w = TUI_CMD_WIN->generic.handle;
#ifdef TUI_USE_PIPE_FOR_READLINE
/* Flush readline output. */
#endif
ch = wgetch (w);
- ch = _tuiHandleResizeDuringIO (ch);
+ ch = tui_handle_resize_during_io (ch);
/* The \n must be echoed because it will not be printed by readline. */
if (ch == '\n')
user we recognized the command. */
if (rl_end == 0)
{
- wmove (w, cmdWin->detail.commandInfo.curLine, 0);
+ wmove (w, TUI_CMD_WIN->detail.command_info.cur_line, 0);
/* Clear the line. This will blink the gdb prompt since
it will be redrawn at the same line. */
}
else
{
- wmove (w, cmdWin->detail.commandInfo.curLine,
- cmdWin->detail.commandInfo.curch);
+ wmove (w, TUI_CMD_WIN->detail.command_info.cur_line,
+ TUI_CMD_WIN->detail.command_info.curch);
waddch (w, ch);
}
}
}
if (ch == '\n' || ch == '\r' || ch == '\f')
- cmdWin->detail.commandInfo.curch = 0;
-#if 0
- else
- tuiIncrCommandCharCountBy (1);
-#endif
+ TUI_CMD_WIN->detail.command_info.curch = 0;
if (ch == KEY_BACKSPACE)
return '\b';
/* Cleanup when a resize has occured.
Returns the character that must be processed. */
static unsigned int
-_tuiHandleResizeDuringIO (unsigned int originalCh)
+tui_handle_resize_during_io (unsigned int original_ch)
{
- if (tuiWinResized ())
+ if (tui_win_resized ())
{
tui_refresh_all_win ();
dont_repeat ();
- tuiSetWinResizedTo (FALSE);
+ tui_set_win_resized_to (FALSE);
return '\n';
}
else
- return originalCh;
+ return original_ch;
}