2004-08-27 Michael Chastain <mec.gnu@mindspring.com>
[deliverable/binutils-gdb.git] / gdb / tui / tui-io.c
index bc52ce71f5267a0046e57d93659d9ab2bf0b99fa..07926d9e9bfb79f222f506cd79cefa0347debb6e 100644 (file)
@@ -29,7 +29,6 @@
 #include "event-top.h"
 #include "command.h"
 #include "top.h"
-#include "readline/readline.h"
 #include "tui/tui.h"
 #include "tui/tui-data.h"
 #include "tui/tui-io.h"
 #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"
+
+/* This redefines CTRL if it is not already defined, so it must come
+   after terminal state releated include files like <term.h> and
+   "gdb_curses.h".  */
+#include "readline/readline.h"
 
 int
 key_is_start_sequence (int ch)
@@ -147,7 +145,7 @@ static int tui_readline_pipe[2];
    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)
@@ -322,8 +320,7 @@ tui_readline_output (int code, gdb_client_data data)
 
    Comes from readline/complete.c  */
 static char *
-printable_part (pathname)
-     char *pathname;
+printable_part (char *pathname)
 {
   char *temp;
 
@@ -360,8 +357,7 @@ printable_part (pathname)
     } 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;
@@ -376,7 +372,7 @@ print_filename (to_print, full_pathname)
 /* 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;
@@ -402,9 +398,7 @@ get_y_or_n ()
    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*);
@@ -598,7 +592,7 @@ tui_cont_sig (int sig)
 
 /* Initialize the IO for gdb in curses mode.  */
 void
-tui_initialize_io ()
+tui_initialize_io (void)
 {
 #ifdef SIGCONT
   signal (SIGCONT, tui_cont_sig);
@@ -609,8 +603,8 @@ tui_initialize_io ()
   tui_stderr = tui_fileopen (stderr);
   tui_out = tui_out_new (tui_stdout);
 
-  /* Create the default UI.  It is not created because we installed
-     init_ui_hook.  */
+  /* Create the default UI.  It is not created because we installed a
+     deprecated_init_ui_hook.  */
   tui_old_uiout = uiout = cli_out_new (gdb_stdout);
 
 #ifdef TUI_USE_PIPE_FOR_READLINE
@@ -659,7 +653,7 @@ tui_getc (FILE *fp)
 #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')
@@ -694,10 +688,6 @@ tui_getc (FILE *fp)
   
   if (ch == '\n' || ch == '\r' || ch == '\f')
     TUI_CMD_WIN->detail.command_info.curch = 0;
-#if 0
-  else
-    tuiIncrCommandCharCountBy (1);
-#endif
   if (ch == KEY_BACKSPACE)
     return '\b';
   
@@ -708,7 +698,7 @@ tui_getc (FILE *fp)
 /* 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 (tui_win_resized ())
     {
@@ -718,5 +708,5 @@ _tuiHandleResizeDuringIO (unsigned int originalCh)
       return '\n';
     }
   else
-    return originalCh;
+    return original_ch;
 }
This page took 0.025029 seconds and 4 git commands to generate.