aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-06-10 01:16:14 +0000
committerAndrew Cagney <cagney@redhat.com>2001-06-10 01:16:14 +0000
commitd5e8ba6212966d21e4ff3fbdb396f240b8b1185f (patch)
tree163113b36b537ea2b51ab2a50e68ccd85b5cdbd7 /gdb/mi
parent5e173cfd821df155d4faa950090912fc4a82fdb5 (diff)
downloadgdb-d5e8ba6212966d21e4ff3fbdb396f240b8b1185f.zip
gdb-d5e8ba6212966d21e4ff3fbdb396f240b8b1185f.tar.gz
gdb-d5e8ba6212966d21e4ff3fbdb396f240b8b1185f.tar.bz2
Move supress_field_separator logic into mi_open() and mi_close().
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/ChangeLog10
-rw-r--r--gdb/mi/mi-out.c28
2 files changed, 21 insertions, 17 deletions
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog
index 94bcef6..b66c373 100644
--- a/gdb/mi/ChangeLog
+++ b/gdb/mi/ChangeLog
@@ -1,5 +1,15 @@
2001-06-09 Andrew Cagney <ac131313@redhat.com>
+ * mi-out.c (mi_table_end, mi_table_begin, mi_begin, mi_end): Move
+ supress_field_separator updates from here.
+ (mi_open, mi_close): To here.
+ (mi_open): Add parameter name. Output a field_separator.
+ (mi_table_begin): Update.
+ (mi_table_header):
+ (mi_begin): Update.
+
+2001-06-09 Andrew Cagney <ac131313@redhat.com>
+
* mi-out.c (mi_table_begin): Make char* parameters constant.
(mi_table_header): Ditto.
(mi_field_int): Ditto.
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index 1063d57..71188f2 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -94,7 +94,8 @@ struct ui_out_impl mi_ui_out_impl =
extern void _initialize_mi_out (void);
static void field_separator (struct ui_out *uiout);
-static void mi_open (struct ui_out *uiout, enum ui_out_type type);
+static void mi_open (struct ui_out *uiout, const char *name,
+ enum ui_out_type type);
static void mi_close (struct ui_out *uiout, enum ui_out_type type);
static void out_field_fmt (struct ui_out *uiout, int fldno, char *fldname,
@@ -107,12 +108,8 @@ mi_table_begin (struct ui_out *uiout, int nbrofcols,
const char *tblid)
{
struct ui_out_data *data = ui_out_data (uiout);
- field_separator (uiout);
- if (tblid)
- fprintf_unfiltered (data->buffer, "%s=", tblid);
- mi_open (uiout, ui_out_type_tuple);
+ mi_open (uiout, tblid, ui_out_type_tuple);
data->first_header = 0;
- data->supress_field_separator = 1;
}
/* Mark beginning of a table body */
@@ -133,8 +130,6 @@ mi_table_end (struct ui_out *uiout)
{
struct ui_out_data *data = ui_out_data (uiout);
mi_close (uiout, ui_out_type_tuple);
- /* If table was empty this flag did not get reset yet */
- data->supress_field_separator = 0;
}
/* Specify table header */
@@ -146,8 +141,7 @@ mi_table_header (struct ui_out *uiout, int width, int alignment,
struct ui_out_data *data = ui_out_data (uiout);
if (!data->first_header++)
{
- fputs_unfiltered ("hdr=", data->buffer);
- mi_open (uiout, ui_out_type_tuple);
+ mi_open (uiout, "hdr", ui_out_type_tuple);
}
mi_field_string (uiout, 0, width, alignment, 0, colhdr);
}
@@ -161,11 +155,7 @@ mi_begin (struct ui_out *uiout,
const char *id)
{
struct ui_out_data *data = ui_out_data (uiout);
- field_separator (uiout);
- data->supress_field_separator = 1;
- if (id)
- fprintf_unfiltered (data->buffer, "%s=", id);
- mi_open (uiout, type);
+ mi_open (uiout, id, type);
}
/* Mark end of a list */
@@ -177,8 +167,6 @@ mi_end (struct ui_out *uiout,
{
struct ui_out_data *data = ui_out_data (uiout);
mi_close (uiout, type);
- /* If list was empty this flag did not get reset yet */
- data->supress_field_separator = 0;
}
/* output an int field */
@@ -313,9 +301,14 @@ field_separator (struct ui_out *uiout)
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->supress_field_separator = 1;
+ if (name)
+ fprintf_unfiltered (data->buffer, "%s=", name);
switch (type)
{
case ui_out_type_tuple:
@@ -345,6 +338,7 @@ mi_close (struct ui_out *uiout,
default:
internal_error (__FILE__, __LINE__, "bad switch");
}
+ data->supress_field_separator = 0;
}
/* add a string to the buffer */