+2020-02-11  Tom Tromey  <tromey@adacore.com>
+
+       * remote.c (remote_console_output): Update.
+       * printcmd.c (printf_command): Update.
+       * event-loop.c (gdb_wait_for_event): Update.
+       * linux-nat.c (sigchld_handler): Update.
+       * remote-sim.c (gdb_os_write_stdout): Update.
+       (gdb_os_flush_stdout): Update.
+       (gdb_os_flush_stderr): Update.
+       (gdb_os_write_stderr): Update.
+       * exceptions.c (print_exception): Update.
+       * remote-fileio.c (remote_fileio_func_read): Update.
+       (remote_fileio_func_write): Update.
+       * tui/tui.c (tui_enable): Update.
+       * tui/tui-interp.c (tui_interp::init): Update.
+       * utils.c (init_page_info): Update.
+       (putchar_unfiltered, fputc_unfiltered): Update.
+       (gdb_flush): Update.
+       (emit_style_escape): Update.
+       (flush_wrap_buffer, fputs_maybe_filtered): Update.
+       * ui-file.c (ui_file_isatty, ui_file_read, ui_file_write)
+       (ui_file_write_async_safe, ui_file_flush, ui_file_puts): Remove.
+       (stderr_file::write): Update.
+       (stderr_file::puts): Update.
+       * ui-file.h (ui_file_isatty, ui_file_write)
+       (ui_file_write_async_safe, ui_file_read, ui_file_flush)
+       (ui_file_puts): Don't declare.
+
 2020-02-10  Tom de Vries  <tdevries@suse.de>
 
        * dwarf2/read.c (process_psymtab_comp_unit_reader): Cast concat NULL
 
   int num_found = 0;
 
   /* Make sure all output is done before getting another event.  */
-  ui_file_flush (gdb_stdout);
-  ui_file_flush (gdb_stderr);
+  gdb_stdout->flush ();
+  gdb_stderr->flush ();
 
   if (gdb_notifier.num_fds == 0)
     return -1;
 
       else
        {
          end++;
-         ui_file_write (file, start, end - start);
+         file->write (start, end - start);
        }
     }                                      
   fprintf_filtered (file, "\n");
 
   gdb_flush (gdb_stdout);
   gdb_flush (gdb_stderr);
 
-  count = ui_file_read (gdb_stdin, (char *) pt->read_buf, pt->read_buf_size);
+  count = gdb_stdin->read ((char *) pt->read_buf, pt->read_buf_size);
   if (count == -1)
     scm_syserror (FUNC_NAME);
   if (count == 0)
 
   int old_errno = errno;
 
   if (debug_linux_nat)
-    ui_file_write_async_safe (gdb_stdlog,
-                             "sigchld\n", sizeof ("sigchld\n") - 1);
+    gdb_stdlog->write_async_safe ("sigchld\n", sizeof ("sigchld\n") - 1);
 
   if (signo == SIGCHLD
       && linux_nat_event_pipe[0] != -1)
 
   ui_printf (arg, gdb_stdout);
   reset_terminal_style (gdb_stdout);
   wrap_here ("");
-  ui_file_flush (gdb_stdout);
+  gdb_stdout->flush ();
 }
 
 /* Implement the "eval" command.  */
 
                 limit this read to something smaller than that - by a
                 safe margin, in case the limit depends on system
                 resources or version.  */
-             ret = ui_file_read (gdb_stdtargin, (char *) buffer, 16383);
+             ret = gdb_stdtargin->read ((char *) buffer, 16383);
              if (ret > 0 && (size_t)ret > length)
                {
                  remaining_buf = (char *) xmalloc (ret - length);
        xfree (buffer);
        return;
       case FIO_FD_CONSOLE_OUT:
-       ui_file_write (target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr,
-                      (char *) buffer, length);
-       ui_file_flush (target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr);
-       ret = length;
+       {
+         ui_file *file = target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr;
+         file->write ((char *) buffer, length);
+         file->flush ();
+         ret = length;
+       }
        break;
       default:
        ret = write (fd, buffer, length);
 
 static int
 gdb_os_write_stdout (host_callback *p, const char *buf, int len)
 {
-  ui_file_write (gdb_stdtarg, buf, len);
+  gdb_stdtarg->write (buf, len);
   return len;
 }
 
 static void
 gdb_os_flush_stdout (host_callback *p)
 {
-  ui_file_flush (gdb_stdtarg);
+  gdb_stdtarg->flush ();
 }
 
 /* GDB version of os_write_stderr callback.  */
     {
       b[0] = buf[i];
       b[1] = 0;
-      ui_file_puts (gdb_stdtargerr, b);
+      gdb_stdtargerr->puts (b);
     }
   return len;
 }
 static void
 gdb_os_flush_stderr (host_callback *p)
 {
-  ui_file_flush (gdb_stdtargerr);
+  gdb_stdtargerr->flush ();
 }
 
 /* GDB version of printf_filtered callback.  */
 
 
       tb[0] = c;
       tb[1] = 0;
-      ui_file_puts (gdb_stdtarg, tb);
+      gdb_stdtarg->puts (tb);
     }
-  ui_file_flush (gdb_stdtarg);
+  gdb_stdtarg->flush ();
 }
 
 struct stop_reply : public notif_event
 
 
   tui_initialize_io ();
   tui_initialize_win ();
-  if (ui_file_isatty (gdb_stdout))
+  if (gdb_stdout->isatty ())
     tui_initialize_readline ();
 }
 
 
 
       /* Don't try to setup curses (and print funny control
         characters) if we're not outputting to a terminal.  */
-      if (!ui_file_isatty (gdb_stdout))
+      if (!gdb_stderr->isatty ())
        error (_("Cannot enable the TUI when output is not a terminal"));
 
       s = newterm (NULL, stdout, stdin);
 
 
 \f
 
-void
-ui_file_flush (struct ui_file *file)
-{
-  file->flush ();
-}
-
-int
-ui_file_isatty (struct ui_file *file)
-{
-  return file->isatty ();
-}
-
 /* true if the gdb terminal supports styling, and styling is enabled.  */
 
 static bool
   return true;
 }
 
-
-void
-ui_file_write (struct ui_file *file,
-               const char *buf,
-               long length_buf)
-{
-  file->write (buf, length_buf);
-}
-
-void
-ui_file_write_async_safe (struct ui_file *file,
-                         const char *buf,
-                         long length_buf)
-{
-  file->write_async_safe (buf, length_buf);
-}
-
-long
-ui_file_read (struct ui_file *file, char *buf, long length_buf)
-{
-  return file->read (buf, length_buf);
-}
-
-void
-ui_file_puts (struct ui_file *file, const char *buf)
-{
-  file->puts (buf);
-}
-
 \f
 
 string_file::~string_file ()
 void
 stderr_file::write (const char *buf, long length_buf)
 {
-  ui_file_flush (gdb_stdout);
+  gdb_stdout->flush ();
   stdio_file::write (buf, length_buf);
 }
 
 void
 stderr_file::puts (const char *linebuffer)
 {
-  ui_file_flush (gdb_stdout);
+  gdb_stdout->flush ();
   stdio_file::puts (linebuffer);
 }
 
 
 /* A preallocated null_file stream.  */
 extern null_file null_stream;
 
-extern void ui_file_flush (ui_file *);
-
-extern int ui_file_isatty (struct ui_file *);
-
-extern void ui_file_write (struct ui_file *file, const char *buf,
-                          long length_buf);
-
-extern void ui_file_write_async_safe (struct ui_file *file, const char *buf,
-                                     long length_buf);
-
-extern long ui_file_read (struct ui_file *file, char *buf, long length_buf);
-
-extern void ui_file_puts (struct ui_file *file, const char *buf);
-
 extern int gdb_console_fputs (const char *, FILE *);
 
 /* A std::string-based ui_file.  Can be used as a scratch buffer for
 
        }
 
       /* If the output is not a terminal, don't paginate it.  */
-      if (!ui_file_isatty (gdb_stdout))
+      if (!gdb_stdout->isatty ())
        lines_per_page = UINT_MAX;
 #endif
     }
   if (stream == nullptr)
     wrap_buffer.append (style.to_ansi ());
   else
-    ui_file_puts (stream, style.to_ansi ().c_str ());
+    stream->puts (style.to_ansi ().c_str ());
 }
 
 /* Set the current output style.  This will affect future uses of the
 {
   if (stream == gdb_stdout && !wrap_buffer.empty ())
     {
-      ui_file_puts (stream, wrap_buffer.c_str ());
+      stream->puts (wrap_buffer.c_str ());
       wrap_buffer.clear ();
     }
 }
 gdb_flush (struct ui_file *stream)
 {
   flush_wrap_buffer (stream);
-  ui_file_flush (stream);
+  stream->flush ();
 }
 
 /* Indicate that if the next sequence of characters overflows the line,
       || top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ())
     {
       flush_wrap_buffer (stream);
-      ui_file_puts (stream, linebuffer);
+      stream->puts (linebuffer);
       return;
     }
 
              /* Now output indentation and wrapped string.  */
              if (wrap_column)
                {
-                 ui_file_puts (stream, wrap_indent);
+                 stream->puts (wrap_indent);
                  if (stream->can_emit_style_escape ())
                    emit_style_escape (save_style, stream);
                  /* FIXME, this strlen is what prevents wrap_indent from
 {
   char buf = c;
 
-  ui_file_write (gdb_stdout, &buf, 1);
+  gdb_stdout->write (&buf, 1);
   return c;
 }
 
 {
   char buf = c;
 
-  ui_file_write (stream, &buf, 1);
+  stream->write (&buf, 1);
   return c;
 }