}
/* 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
- fputs_unfiltered (style.to_ansi ().c_str (), stream);
+ 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 ())
{
- fputs_unfiltered (wrap_buffer.c_str (), stream);
+ 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,
wrap_here (const char *indent)
{
/* This should have been allocated, but be paranoid anyway. */
- if (!filter_initialized)
- internal_error (__FILE__, __LINE__,
- _("failed internal consistency check"));
+ gdb_assert (filter_initialized);
flush_wrap_buffer (gdb_stdout);
if (chars_per_line == UINT_MAX) /* No line overflow checking. */
|| top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ())
{
flush_wrap_buffer (stream);
- fputs_unfiltered (linebuffer, stream);
+ stream->puts (linebuffer);
return;
}
newline -- if chars_per_line is right, we
probably just overflowed anyway; if it's wrong,
let us keep going. */
- fputc_unfiltered ('\n', stream);
+ /* XXX: The ideal thing would be to call
+ 'stream->putc' here, but we can't because it
+ currently calls 'fputc_unfiltered', which ends up
+ calling us, which generates an infinite
+ recursion. */
+ stream->puts ("\n");
}
else
{
/* Now output indentation and wrapped string. */
if (wrap_column)
{
- fputs_unfiltered (wrap_indent, stream);
+ 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
wrap_here ((char *) 0); /* Spit out chars, cancel
further wraps. */
lines_printed++;
- fputc_unfiltered ('\n', stream);
+ /* XXX: The ideal thing would be to call
+ 'stream->putc' here, but we can't because it
+ currently calls 'fputc_unfiltered', which ends up
+ calling us, which generates an infinite
+ recursion. */
+ stream->puts ("\n");
lineptr++;
}
}
fputs_maybe_filtered (linebuffer, stream, 1);
}
+void
+fputs_unfiltered (const char *linebuffer, struct ui_file *stream)
+{
+ fputs_maybe_filtered (linebuffer, stream, 0);
+}
+
/* See utils.h. */
void
int
putchar_unfiltered (int c)
{
- char buf = c;
-
- ui_file_write (gdb_stdout, &buf, 1);
- return c;
+ return fputc_unfiltered (c, gdb_stdout);
}
/* Write character C to gdb_stdout using GDB's paging mechanism and return C.
int
fputc_unfiltered (int c, struct ui_file *stream)
{
- char buf = c;
+ char buf[2];
- ui_file_write (stream, &buf, 1);
+ buf[0] = c;
+ buf[1] = 0;
+ fputs_unfiltered (buf, stream);
return c;
}
buf |= *source << avail;
buf &= (1 << nbits) - 1;
- *dest = (*dest & (~0 << nbits)) | buf;
+ *dest = (*dest & (~0U << nbits)) | buf;
}
}