27#include "readline/readline.h"
70 const std::string &col_name,
71 const std::string &col_hdr)
98 const char *fldname, LONGEST
value)
111 const char *fldname, ULONGEST
value)
138 const char *fldname,
const char *
string,
149 before = width - strlen (
string);
177 stream->
puts (
string);
193 const char *format, va_list args)
198 std::string str = string_vprintf (format, args);
223 const char *format, va_list args)
228 std::string str = string_vprintf (format, args);
233 stream->
puts (str.c_str ());
260 if (outstream != NULL)
275#define MIN_CHARS_PER_LINE 50
276#define MAX_CHARS_PER_LINE 4096
299 double howmuch,
double total)
308 if (info.state == progress_update::START)
315 info.state = progress_update::BAR;
320 info.state = progress_update::WORKING;
324 if (info.state != progress_update::BAR
328 if (total > 0 && howmuch >= 0 && howmuch <= 1.0)
330 std::string progress = string_printf (
" %3.f%% (%.2f %s)",
331 howmuch * 100, total,
334 int max = width * howmuch;
338 for (
int i = 0; i < width; ++i)
350 using namespace std::chrono;
351 milliseconds diff = duration_cast<milliseconds>
352 (steady_clock::now () - info.last_update);
356 if (diff.count () >= 500)
361 for (
int i = 0; i < width; ++i)
363 if (i == info.pos % width
364 || i == (info.pos + 1) % width
365 || i == (info.pos + 2) % width)
373 info.last_update = steady_clock::now ();
390 scoped_restore save_pagination
434 m_suppress_output (false)
436 gdb_assert (stream != NULL);
477 putc (ch, rl_outstream);
485 fputs (s, rl_outstream);
493 fflush (rl_outstream);
519 return rl_read_key ();
530 rl_get_screen_size (&displayer.
height, &displayer.
width);
540 rl_forced_update_display ();
virtual void do_flush() override
bool can_emit_style_escape() const override
virtual void do_table_body() override
std::vector< cli_progress_info > m_progress_info
cli_ui_out(ui_file *stream, ui_out_flags flags=ui_source_list)
virtual void do_begin(ui_out_type type, const char *id) override
virtual void do_table_end() override
virtual void do_table_header(int width, ui_align align, const std::string &col_name, const std::string &col_hdr) override
void clear_progress_notify()
virtual void do_progress_start() override
virtual void virtual void do_spaces(int numspaces) override
virtual void do_field_string(int fldno, int width, ui_align align, const char *fldname, const char *string, const ui_file_style &style) override
virtual void do_field_signed(int fldno, int width, ui_align align, const char *fldname, LONGEST value) override
virtual void do_message(const ui_file_style &style, const char *format, va_list args) override ATTRIBUTE_PRINTF(3
virtual void do_progress_end() override
virtual void do_field_fmt(int fldno, int width, ui_align align, const char *fldname, const ui_file_style &style, const char *format, va_list args) override ATTRIBUTE_PRINTF(7
virtual void virtual void do_wrap_hint(int indent) override
std::vector< ui_file * > m_streams
virtual void do_text(const char *string) override
virtual void do_table_begin(int nbrofcols, int nr_rows, const char *tblid) override
ui_file * set_stream(ui_file *stream)
virtual void do_field_unsigned(int fldno, int width, ui_align align, const char *fldname, ULONGEST value) override
virtual void do_end(ui_out_type type) override
virtual void do_field_skip(int fldno, int width, ui_align align, const char *fldname) override
virtual void do_redirect(struct ui_file *outstream) override
virtual void do_progress_notify(const std::string &, const char *, double, double) override
virtual bool can_emit_style_escape()
virtual void puts(const char *str)
virtual void emit_style_escape(const ui_file_style &style)
void void void spaces(int numspaces)
void text(const char *string)
#define MAX_CHARS_PER_LINE
#define MIN_CHARS_PER_LINE
static void cli_mld_puts(const struct match_list_displayer *displayer, const char *s)
void cli_display_match_list(char **matches, int len, int max)
static void cli_mld_erase_entire_line(const struct match_list_displayer *displayer)
static void cli_mld_putch(const struct match_list_displayer *displayer, int ch)
static void cli_mld_beep(const struct match_list_displayer *displayer)
static int cli_mld_read_key(const struct match_list_displayer *displayer)
static void cli_mld_flush(const struct match_list_displayer *displayer)
static void cli_mld_crlf(const struct match_list_displayer *displayer)
EXTERN_C void _rl_erase_entire_line(void)
void gdb_display_match_list(char **matches, int len, int max, const struct match_list_displayer *displayer)
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
mld_erase_entire_line_ftype * erase_entire_line
mld_read_key_ftype * read_key
bool input_interactive_p() const
void print_spaces(int n, struct ui_file *stream)
void gdb_printf(struct ui_file *stream, const char *format,...)
void gdb_flush(struct ui_file *stream)
void gdb_puts(const char *linebuffer, struct ui_file *stream)
static unsigned int chars_per_line