+2001-06-21 Andrew Cagney <ac131313@redhat.com>
+
+ * mi-out.c (struct ui_out_data): Replace field first_header with
+ suppress_output.
+ (mi_begin, mi_end): Check suppress_header.
+ (mi_field_int, mi_field_skip): Ditto.
+ (mi_field_string, mi_field_fmt): Ditto.
+ (mi_table_begin): When nr_rows is zero, set suppress_header else,
+ output the start of the header.
+ (mi_table_body): Clear suppress header.
+
2001-06-21 Andrew Cagney <ac131313@redhat.com>
* mi-out.c (mi_open): For lists, when mi_version > 0, use ``[''.
struct ui_out_data
{
int suppress_field_separator;
- int first_header;
+ int suppress_output;
int mi_version;
struct ui_file *buffer;
};
{
struct ui_out_data *data = ui_out_data (uiout);
mi_open (uiout, tblid, ui_out_type_tuple);
- data->first_header = 0;
+ if (nr_rows == 0)
+ {
+ data->suppress_output = 1;
+ return;
+ }
+ mi_open (uiout, "hdr", ui_out_type_tuple);
}
/* Mark beginning of a table body */
{
struct ui_out_data *data = ui_out_data (uiout);
/* close the table header line if there were any headers */
- if (data->first_header)
- mi_close (uiout, ui_out_type_tuple);
+ if (data->suppress_output)
+ return;
+ mi_close (uiout, ui_out_type_tuple);
}
/* Mark end of a table */
mi_table_end (struct ui_out *uiout)
{
struct ui_out_data *data = ui_out_data (uiout);
+ data->suppress_output = 0;
mi_close (uiout, ui_out_type_tuple);
}
const char *colhdr)
{
struct ui_out_data *data = ui_out_data (uiout);
- if (!data->first_header++)
- {
- mi_open (uiout, "hdr", ui_out_type_tuple);
- }
+ if (data->suppress_output)
+ return;
mi_field_string (uiout, 0, width, alignment, 0, colhdr);
}
const char *id)
{
struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
mi_open (uiout, id, type);
}
int level)
{
struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
mi_close (uiout, type);
}
const char *fldname, int value)
{
char buffer[20]; /* FIXME: how many chars long a %d can become? */
+ struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
sprintf (buffer, "%d", value);
mi_field_string (uiout, fldno, width, alignment, fldname, buffer);
mi_field_skip (struct ui_out *uiout, int fldno, int width, int alignment,
const char *fldname)
{
+ struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
mi_field_string (uiout, fldno, width, alignment, 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);
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);