Tidy up formatting.
[deliverable/binutils-gdb.git] / gdb / event-top.c
index 4fbd6a0f001d250a287deff21ffa14cad0e5544d..34bf5dffc8c21b82bc38c5cbe0e25df6d40daf03 100644 (file)
@@ -129,17 +129,17 @@ struct prompts the_prompts;
    handlers mark these functions as ready to be executed and the event
    loop, in a later iteration, calls them. See the function
    invoke_async_signal_handler. */
-PTR sigint_token;
+void *sigint_token;
 #ifdef SIGHUP
-PTR sighup_token;
+void *sighup_token;
 #endif
-PTR sigquit_token;
-PTR sigfpe_token;
+void *sigquit_token;
+void *sigfpe_token;
 #if defined(SIGWINCH) && defined(SIGWINCH_HANDLER)
-PTR sigwinch_token;
+void *sigwinch_token;
 #endif
 #ifdef STOP_SIGNAL
-PTR sigtstp_token;
+void *sigtstp_token;
 #endif
 
 /* Structure to save a partially entered command.  This is used when
@@ -246,6 +246,13 @@ display_gdb_prompt (char *new_prompt)
   int prompt_length = 0;
   char *gdb_prompt = get_prompt ();
 
+#ifdef UI_OUT
+  /* When an alternative interpreter has been installed, do not
+     display the comand prompt. */
+  if (interpreter_p)
+    return;
+#endif
+
   if (target_executing && sync_execution)
     {
       /* This is to trick readline into not trying to display the
@@ -480,7 +487,7 @@ command_handler (char *command)
   quit_flag = 0;
   if (instream == stdin && stdin_is_tty)
     reinitialize_more_filter ();
-  old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0);
+  old_chain = make_cleanup (command_loop_marker, 0);
 
 #if defined(TUI)
   insert_mode = 0;
@@ -518,8 +525,8 @@ command_handler (char *command)
        (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
       arg1->next = arg2;
       arg2->next = NULL;
-      arg1->data = (PTR) time_at_cmd_start;
-      arg2->data = (PTR) space_at_cmd_start;
+      arg1->data.integer = time_at_cmd_start;
+      arg2->data.integer = space_at_cmd_start;
       add_continuation (command_line_handler_continuation, arg1);
     }
 
@@ -565,8 +572,8 @@ command_line_handler_continuation (struct continuation_arg *arg)
   extern int display_time;
   extern int display_space;
 
-  long time_at_cmd_start = (long) arg->data;
-  long space_at_cmd_start = (long) arg->next->data;
+  long time_at_cmd_start  = arg->data.longint;
+  long space_at_cmd_start = arg->next->data.longint;
 
   bpstat_do_actions (&stop_bpstat);
   /*do_cleanups (old_chain); *//*?????FIXME????? */
@@ -950,7 +957,7 @@ async_init_signals (void)
 }
 
 void
-mark_async_signal_handler_wrapper (PTR token)
+mark_async_signal_handler_wrapper (void *token)
 {
   mark_async_signal_handler ((struct async_signal_handler *) token);
 }
@@ -1126,9 +1133,25 @@ _initialize_event_loop (void)
 {
   if (event_loop_p)
     {
-      /* When a character is detected on instream by select or poll,
-         readline will be invoked via this callback function. */
-      call_readline = rl_callback_read_char_wrapper;
+      /* If the input stream is connected to a terminal, turn on
+         editing.  */
+      if (ISATTY (instream))
+       {
+         /* Tell gdb that we will be using the readline library. This
+            could be overwritten by a command in .gdbinit like 'set
+            editing on' or 'off'. */
+         async_command_editing_p = 1;
+         
+         /* When a character is detected on instream by select or
+            poll, readline will be invoked via this callback
+            function. */
+         call_readline = rl_callback_read_char_wrapper;
+       }
+      else
+       {
+         async_command_editing_p = 0;
+         call_readline = gdb_readline2;
+       }
 
       /* When readline has read an end-of-line character, it passes
          the complete line to gdb for processing. command_line_handler
@@ -1153,10 +1176,5 @@ _initialize_event_loop (void)
          only when it actually exists (I.e. after we say 'run' or
          after we connect to a remote target. */
       add_file_handler (input_fd, stdin_event_handler, 0);
-
-      /* Tell gdb that we will be using the readline library. This
-         could be overwritten by a command in .gdbinit like 'set
-         editing on' or 'off'. */
-      async_command_editing_p = 1;
     }
 }
This page took 0.029583 seconds and 4 git commands to generate.