From: Andrew Cagney Date: Thu, 21 Jun 2001 19:27:50 +0000 (+0000) Subject: * mi-out.c (struct ui_out_data): Replace field first_header with X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=76fe6b98e8b345c8793dcc63ccc1fdf9d659f956;p=binutils-gdb.git * 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. --- diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index 5231b9af364..203ced4236d 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,14 @@ +2001-06-21 Andrew Cagney + + * 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 * mi-out.c (mi_open): For lists, when mi_version > 0, use ``[''. diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index b2c02e69d00..6787b528267 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -32,7 +32,7 @@ struct ui_out_data { int suppress_field_separator; - int first_header; + int suppress_output; int mi_version; struct ui_file *buffer; }; @@ -111,7 +111,12 @@ mi_table_begin (struct ui_out *uiout, int nbrofcols, { 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 */ @@ -121,8 +126,9 @@ mi_table_body (struct ui_out *uiout) { 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 */ @@ -131,6 +137,7 @@ void 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); } @@ -142,10 +149,8 @@ mi_table_header (struct ui_out *uiout, int width, int alignment, 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); } @@ -158,6 +163,8 @@ mi_begin (struct ui_out *uiout, const char *id) { struct ui_out_data *data = ui_out_data (uiout); + if (data->suppress_output) + return; mi_open (uiout, id, type); } @@ -169,6 +176,8 @@ mi_end (struct ui_out *uiout, int level) { struct ui_out_data *data = ui_out_data (uiout); + if (data->suppress_output) + return; mi_close (uiout, type); } @@ -179,6 +188,9 @@ mi_field_int (struct ui_out *uiout, int fldno, int width, int alignment, 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); @@ -190,6 +202,9 @@ void 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, ""); } @@ -205,6 +220,8 @@ mi_field_string (struct ui_out *uiout, 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); @@ -224,6 +241,8 @@ mi_field_fmt (struct ui_out *uiout, int fldno, 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);