void mi_ui_out::open (const char *name, ui_out_type type) { ui_file *stream = m_streams.back (); field_separator (); m_suppress_field_separator = true; if (name) fprintf_unfiltered (stream, "%s=", name); switch (type) { case ui_out_type_tuple: fputc_unfiltered ('{', stream); break; case ui_out_type_list: fputc_unfiltered ('[', stream); break; default: internal_error (__FILE__, __LINE__, _("bad switch")); } }
static void mi_open (struct ui_out *uiout, const char *name, enum ui_out_type type) { struct ui_out_data *data = ui_out_data (uiout); field_separator (uiout); data->suppress_field_separator = 1; if (name) fprintf_unfiltered (data->buffer, "%s=", name); switch (type) { case ui_out_type_tuple: fputc_unfiltered ('{', data->buffer); break; case ui_out_type_list: if (data->mi_version == 0) fputc_unfiltered ('{', data->buffer); else fputc_unfiltered ('[', data->buffer); break; default: internal_error (__FILE__, __LINE__, "bad switch"); } }
void tui_field_string (struct ui_out *uiout, int fldno, int width, enum ui_align align, const char *fldname, const char *string) { int before = 0; int after = 0; tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; if (fldname && data->line > 0 && strcmp (fldname, "file") == 0) { data->start_of_line ++; if (data->line > 0) { tui_show_source (string, data->line); } return; } data->start_of_line ++; if ((align != ui_noalign) && string) { before = width - strlen (string); if (before <= 0) before = 0; else { if (align == ui_right) after = 0; else if (align == ui_left) { after = before; before = 0; } else /* ui_center */ { after = before / 2; before -= after; } } } if (before) ui_out_spaces (uiout, before); if (string) out_field_fmt (uiout, fldno, fldname, "%s", string); if (after) ui_out_spaces (uiout, after); if (align != ui_noalign) field_separator (); }
void cli_ui_out::do_field_fmt (int fldno, int width, ui_align align, const char *fldname, const char *format, va_list args) { if (m_suppress_output) return; vfprintf_filtered (m_streams.back (), format, args); if (align != ui_noalign) field_separator (); }
void mi_ui_out::do_field_string (int fldno, int width, ui_align align, const char *fldname, const char *string) { ui_file *stream = m_streams.back (); field_separator (); if (fldname) fprintf_unfiltered (stream, "%s=", fldname); fprintf_unfiltered (stream, "\""); if (string) fputstr_unfiltered (string, '"', stream); fprintf_unfiltered (stream, "\""); }
void mi_ui_out::do_field_fmt (int fldno, int width, ui_align align, const char *fldname, const char *format, va_list args) { ui_file *stream = m_streams.back (); field_separator (); if (fldname) fprintf_unfiltered (stream, "%s=\"", fldname); else fputs_unfiltered ("\"", stream); vfprintf_unfiltered (stream, format, args); fputs_unfiltered ("\"", stream); }
void cli_field_string (struct ui_out *uiout, int fldno, int width, enum ui_align align, const char *fldname, const char *string) { int before = 0; int after = 0; struct ui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; if ((align != ui_noalign) && string) { before = width - strlen (string); if (before <= 0) before = 0; else { if (align == ui_right) after = 0; else if (align == ui_left) { after = before; before = 0; } else /* ui_center */ { after = before / 2; before -= after; } } } if (before) ui_out_spaces (uiout, before); if (string) out_field_fmt (uiout, fldno, fldname, "%s", string); if (after) ui_out_spaces (uiout, after); if (align != ui_noalign) field_separator (); }
void cli_field_fmt (struct ui_out *uiout, int fldno, int width, enum ui_align align, const char *fldname, const char *format, va_list args) { struct ui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; vfprintf_filtered (data->stream, format, args); if (align != ui_noalign) field_separator (); }
void cli_ui_out::do_field_string (int fldno, int width, ui_align align, const char *fldname, const char *string) { int before = 0; int after = 0; if (m_suppress_output) return; if ((align != ui_noalign) && string) { before = width - strlen (string); if (before <= 0) before = 0; else { if (align == ui_right) after = 0; else if (align == ui_left) { after = before; before = 0; } else /* ui_center */ { after = before / 2; before -= after; } } } if (before) spaces (before); if (string) fputs_filtered (string, m_streams.back ()); if (after) spaces (after); if (align != ui_noalign) field_separator (); }
void mi_field_fmt (struct ui_out *uiout, int fldno, int width, enum ui_align align, const char *fldname, const char *format, va_list args) { struct ui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; field_separator (uiout); if (fldname) fprintf_unfiltered (data->buffer, "%s=\"", fldname); else fputs_unfiltered ("\"", data->buffer); vfprintf_unfiltered (data->buffer, format, args); fputs_unfiltered ("\"", data->buffer); }
void mi_field_string (struct ui_out *uiout, int fldno, int width, enum ui_align align, const char *fldname, const char *string) { struct ui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; field_separator (uiout); if (fldname) fprintf_unfiltered (data->buffer, "%s=", fldname); fprintf_unfiltered (data->buffer, "\""); if (string) fputstr_unfiltered (string, '"', data->buffer); fprintf_unfiltered (data->buffer, "\""); }
/* VARARGS */ static void out_field_fmt (struct ui_out *uiout, int fldno, char *fldname, char *format,...) { struct ui_out_data *data = ui_out_data (uiout); va_list args; field_separator (uiout); if (fldname) fprintf_unfiltered (data->buffer, "%s=\"", fldname); else fputs_unfiltered ("\"", data->buffer); va_start (args, format); vfprintf_unfiltered (data->buffer, format, args); fputs_unfiltered ("\"", data->buffer); va_end (args); }