X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Ftui%2Ftui-command.c;h=399ef85b8c552d99758ff660ce2a6e7ae9bbe478;hb=4a1bcc8c13723e35a611eef9ad475791a3d4387b;hp=551a5344417569d8a6e5398de992f1ea87c56e37;hpb=bcdf15685fdb5cd64dc3026cb0f1ed7fa2e66cbe;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/tui/tui-command.c b/gdb/tui/tui-command.c index 551a534441..399ef85b8c 100644 --- a/gdb/tui/tui-command.c +++ b/gdb/tui/tui-command.c @@ -29,13 +29,8 @@ #include "tui/tui-win.h" #include "tui/tui-io.h" -#ifdef HAVE_NCURSES_H -#include -#else -#ifdef HAVE_CURSES_H -#include -#endif -#endif +#include "gdb_curses.h" +#include "gdb_string.h" /***************************************** @@ -48,27 +43,24 @@ ** PUBLIC FUNCTIONS ** ******************************************/ -/* - ** tuiDispatchCtrlChar(). - ** Dispatch the correct tui function based upon the control character. - */ +/* Dispatch the correct tui function based upon the control character. */ unsigned int -tuiDispatchCtrlChar (unsigned int ch) +tui_dispatch_ctrl_char (unsigned int ch) { - TuiWinInfoPtr winInfo = tuiWinWithFocus (); - WINDOW *w = cmdWin->generic.handle; + struct tui_win_info *win_info = tui_win_with_focus (); + WINDOW *w = TUI_CMD_WIN->generic.handle; /* ** If the command window has the logical focus, or no-one does ** assume it is the command window; in this case, pass the ** character on through and do nothing here. */ - if (winInfo == (TuiWinInfoPtr) NULL || winInfo == cmdWin) + if (win_info == NULL || win_info == TUI_CMD_WIN) return ch; else { - unsigned int c = 0, chCopy = ch; - register int i; + unsigned int c = 0, ch_copy = ch; + int i; char *term; /* If this is an xterm, page next/prev keys aren't returned @@ -80,57 +72,58 @@ tuiDispatchCtrlChar (unsigned int ch) term[i] = toupper (term[i]); if ((strcmp (term, "XTERM") == 0) && key_is_start_sequence (ch)) { - unsigned int pageCh = 0, tmpChar; + unsigned int page_ch = 0; + unsigned int tmp_char; - tmpChar = 0; - while (!key_is_end_sequence (tmpChar)) + tmp_char = 0; + while (!key_is_end_sequence (tmp_char)) { - tmpChar = (int) wgetch (w); - if (tmpChar == ERR) + tmp_char = (int) wgetch (w); + if (tmp_char == ERR) { return ch; } - if (!tmpChar) + if (!tmp_char) break; - if (tmpChar == 53) - pageCh = KEY_PPAGE; - else if (tmpChar == 54) - pageCh = KEY_NPAGE; + if (tmp_char == 53) + page_ch = KEY_PPAGE; + else if (tmp_char == 54) + page_ch = KEY_NPAGE; else { return 0; } } - chCopy = pageCh; + ch_copy = page_ch; } - switch (chCopy) + switch (ch_copy) { case KEY_NPAGE: - tuiScrollForward (winInfo, 0); + tui_scroll_forward (win_info, 0); break; case KEY_PPAGE: - tuiScrollBackward (winInfo, 0); + tui_scroll_backward (win_info, 0); break; case KEY_DOWN: case KEY_SF: - tuiScrollForward (winInfo, 1); + tui_scroll_forward (win_info, 1); break; case KEY_UP: case KEY_SR: - tuiScrollBackward (winInfo, 1); + tui_scroll_backward (win_info, 1); break; case KEY_RIGHT: - tuiScrollLeft (winInfo, 1); + tui_scroll_left (win_info, 1); break; case KEY_LEFT: - tuiScrollRight (winInfo, 1); + tui_scroll_right (win_info, 1); break; case '\f': - tuiRefreshAll (); + tui_refresh_all_win (); break; default: - c = chCopy; + c = ch_copy; break; } return c;