From bcdf15685fdb5cd64dc3026cb0f1ed7fa2e66cbe Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 19 Jan 2004 05:06:34 +0000 Subject: 2004-01-18 Andrew Cagney * tui/tui-io.c: Update copyright. (key_is_end_sequence, key_is_backspace): New functions. (key_is_command_char, key_is_start_sequence): New function. (tui_getc): Update references. * tui/tui-io.h: Update copyright. (m_tuiStartNewLine): Delete macro. (m_isBackspace, m_isDeleteChar): Delete macros. (m_isDeleteLine, m_isDeleteToEol): Delete macros. (m_isNextPage, m_isPrevPage): Delete macros. (m_isLeftArrow, m_isRightArrow): Delete macros. (m_isXdbStyleCommandChar): Delete macro. (key_is_start_sequence): Declare, replace m_isStartSequence. (key_is_end_sequence): Declare, replace m_isEndSequence. (key_is_backspace): Declare ,replace m_isBackspace. (key_is_command_char): Declare, replace m_isCommandChar. * tui/tui-command.c: Update copyright. (tuiDispatchCtrlChar): Update references. --- gdb/ChangeLog | 18 ++++++++++++++++++ gdb/tui/tui-command.c | 8 ++++---- gdb/tui/tui-io.c | 34 +++++++++++++++++++++++++++++++--- gdb/tui/tui-io.h | 38 ++++++++++++-------------------------- 4 files changed, 65 insertions(+), 33 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 50510ae..16ed293 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,23 @@ 2004-01-18 Andrew Cagney + * tui/tui-io.c: Update copyright. + (key_is_end_sequence, key_is_backspace): New functions. + (key_is_command_char, key_is_start_sequence): New function. + (tui_getc): Update references. + * tui/tui-io.h: Update copyright. + (m_tuiStartNewLine): Delete macro. + (m_isBackspace, m_isDeleteChar): Delete macros. + (m_isDeleteLine, m_isDeleteToEol): Delete macros. + (m_isNextPage, m_isPrevPage): Delete macros. + (m_isLeftArrow, m_isRightArrow): Delete macros. + (m_isXdbStyleCommandChar): Delete macro. + (key_is_start_sequence): Declare, replace m_isStartSequence. + (key_is_end_sequence): Declare, replace m_isEndSequence. + (key_is_backspace): Declare ,replace m_isBackspace. + (key_is_command_char): Declare, replace m_isCommandChar. + * tui/tui-command.c: Update copyright. + (tuiDispatchCtrlChar): Update references. + * config/djgpp/fnchange.lst: Delete tui/tuiSourceWin.c and tuiSourceWin.h. diff --git a/gdb/tui/tui-command.c b/gdb/tui/tui-command.c index 8fcf0dd..551a534 100644 --- a/gdb/tui/tui-command.c +++ b/gdb/tui/tui-command.c @@ -1,7 +1,7 @@ /* Specific command window processing. - Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, - Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software + Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -78,12 +78,12 @@ tuiDispatchCtrlChar (unsigned int ch) term = (char *) getenv ("TERM"); for (i = 0; (term && term[i]); i++) term[i] = toupper (term[i]); - if ((strcmp (term, "XTERM") == 0) && m_isStartSequence (ch)) + if ((strcmp (term, "XTERM") == 0) && key_is_start_sequence (ch)) { unsigned int pageCh = 0, tmpChar; tmpChar = 0; - while (!m_isEndSequence (tmpChar)) + while (!key_is_end_sequence (tmpChar)) { tmpChar = (int) wgetch (w); if (tmpChar == ERR) diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index e17971f..0cffd6e 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -1,7 +1,7 @@ /* TUI support I/O functions. - Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, - Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software + Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -51,6 +51,34 @@ #endif #endif +int +key_is_start_sequence (int ch) +{ + return (ch == 27); +} + +int +key_is_end_sequence (int ch) +{ + return (ch == 126); +} + +int +key_is_backspace (int ch) +{ + return (ch == 8); +} + +int +key_is_command_char (int ch) +{ + return ((ch == KEY_NPAGE) || (ch == KEY_PPAGE) + || (ch == KEY_LEFT) || (ch == KEY_RIGHT) + || (ch == KEY_UP) || (ch == KEY_DOWN) + || (ch == KEY_SF) || (ch == KEY_SR) + || (ch == (int)'\f') || key_is_start_sequence (ch)); +} + /* Use definition from readline 4.3. */ #undef CTRL_CHAR #define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0)) @@ -659,7 +687,7 @@ tui_getc (FILE *fp) } } - if (m_isCommandChar (ch)) + if (key_is_command_char (ch)) { /* Handle prev/next/up/down here */ ch = tuiDispatchCtrlChar (ch); } diff --git a/gdb/tui/tui-io.h b/gdb/tui/tui-io.h index 40970b6..06d085d 100644 --- a/gdb/tui/tui-io.h +++ b/gdb/tui/tui-io.h @@ -1,5 +1,8 @@ /* TUI support I/O functions. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + + Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software + Foundation, Inc. + Contributed by Hewlett-Packard Company. This file is part of GDB. @@ -19,10 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _TUI_IO_H -#define _TUI_IO_H +#ifndef TUI_IO_H +#define TUI_IO_H -#include +struct ui_out; /* Print the string in the curses command window. */ extern void tui_puts (const char *); @@ -34,7 +37,7 @@ extern void tui_setup_io (int mode); extern void tui_initialize_io (void); /* Get a character from the command window. */ -extern int tui_getc (FILE*); +extern int tui_getc (FILE *); /* Readline callback. Redisplay the command line with its prompt after readline has @@ -44,26 +47,9 @@ extern void tui_redisplay_readline (void); extern struct ui_out *tui_out; extern struct ui_out *tui_old_uiout; -#define m_tuiStartNewLine tuiStartNewLines(1) -#define m_isStartSequence(ch) (ch == 27) -#define m_isEndSequence(ch) (ch == 126) -#define m_isBackspace(ch) (ch == 8) -#define m_isDeleteChar(ch) (ch == KEY_DC) -#define m_isDeleteLine(ch) (ch == KEY_DL) -#define m_isDeleteToEol(ch) (ch == KEY_EOL) -#define m_isNextPage(ch) (ch == KEY_NPAGE) -#define m_isPrevPage(ch) (ch == KEY_PPAGE) -#define m_isLeftArrow(ch) (ch == KEY_LEFT) -#define m_isRightArrow(ch) (ch == KEY_RIGHT) - -#define m_isCommandChar(ch) (m_isNextPage(ch) || m_isPrevPage(ch) || \ - m_isLeftArrow(ch) || m_isRightArrow(ch) || \ - (ch == KEY_UP) || (ch == KEY_DOWN) || \ - (ch == KEY_SF) || (ch == KEY_SR) || \ - (ch == (int)'\f') || m_isStartSequence(ch)) - -#define m_isXdbStyleCommandChar(ch) (m_isNextPage(ch) || m_isPrevPage(ch)) - +extern int key_is_start_sequence (int ch); +extern int key_is_end_sequence (int ch); +extern int key_is_backspace (int ch); +extern int key_is_command_char (int ch); #endif - -- cgit v1.1