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.
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,
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 */
{
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 */
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);
}
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 */
{
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 */
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:
default:
internal_error (__FILE__, __LINE__, "bad switch");
}
+ data->supress_field_separator = 0;
}
/* add a string to the buffer */