diff options
author | Andrew Cagney <cagney@redhat.com> | 2001-05-09 01:33:10 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2001-05-09 01:33:10 +0000 |
commit | 631ec795c9246b5862348ff41c297ccb978205c2 (patch) | |
tree | e25ced47e342b1b4f17f085e5d400a0e20cfb030 /gdb | |
parent | 80f49b30cf8b59d9c3c513f399892125ad7bcb53 (diff) | |
download | gdb-631ec795c9246b5862348ff41c297ccb978205c2.zip gdb-631ec795c9246b5862348ff41c297ccb978205c2.tar.gz gdb-631ec795c9246b5862348ff41c297ccb978205c2.tar.bz2 |
Replace ui_out_list_{begin,end}() with ui_out_{begin,end}().
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 23 | ||||
-rw-r--r-- | gdb/cli-out.c | 18 | ||||
-rw-r--r-- | gdb/mi/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/mi/mi-out.c | 18 | ||||
-rw-r--r-- | gdb/ui-out.c | 83 | ||||
-rw-r--r-- | gdb/ui-out.h | 35 |
6 files changed, 144 insertions, 39 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4067ea8..1b9ab83 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,26 @@ +2001-05-08 Andrew Cagney <ac131313@redhat.com> + + * cli-out.c (cli_begin, cli_end): Replace cli_list_begin and + cli_list_end. + (cli_ui_out_impl): Update. + + * ui-out.c (default_begin, default_end): Replace + default_list_begin and default_list_end. + (default_ui_out_impl): Update. + (uo_begin, uo_end): Replace ou_list_begin and uo_list_end. + (ui_out_begin, ui_out_end): Replace ui_out_list_begin and + ui_out_list_end. + (ui_out_list_begin, ui_out_list_end): New. Compatibility + functions. + (struct ui_out_level): Add field type. + (push_level, pop_level): Update. Add type parameter. + + * ui-out.h (enum ui_out_type): Declare. + (ui_out_begin, ui_out_end): Declare. + (ui_out_begin_ftype, ui_out_end_ftype): Replace list_begin_ftype + and list_end_ftype. + (struct ui_out_impl): Update. + 2001-05-07 Andrew Cagney <ac131313@redhat.com> * ui-out.h (list_begin_ftype, list_end_ftype): Rename argument diff --git a/gdb/cli-out.c b/gdb/cli-out.c index d6fa98e..8d68e03 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -43,8 +43,9 @@ static void cli_table_body (struct ui_out *uiout); static void cli_table_end (struct ui_out *uiout); static void cli_table_header (struct ui_out *uiout, int width, enum ui_align alig, char *colhdr); -static void cli_list_begin (struct ui_out *uiout, int list_flag, char *lstid); -static void cli_list_end (struct ui_out *uiout, int list_flag); +static void cli_begin (struct ui_out *uiout, enum ui_out_type type, + int level, const char *lstid); +static void cli_end (struct ui_out *uiout, enum ui_out_type type, int level); static void cli_field_int (struct ui_out *uiout, int fldno, int width, enum ui_align alig, char *fldname, int value); static void cli_field_skip (struct ui_out *uiout, int fldno, int width, @@ -73,8 +74,8 @@ static struct ui_out_impl cli_ui_out_impl = cli_table_body, cli_table_end, cli_table_header, - cli_list_begin, - cli_list_end, + cli_begin, + cli_end, cli_field_int, cli_field_skip, cli_field_string, @@ -134,14 +135,19 @@ cli_table_header (struct ui_out *uiout, int width, enum ui_align alignment, /* Mark beginning of a list */ void -cli_list_begin (struct ui_out *uiout, int list_flag, char *lstid) +cli_begin (struct ui_out *uiout, + enum ui_out_type type, + int level, + const char *id) { } /* Mark end of a list */ void -cli_list_end (struct ui_out *uiout, int list_flag) +cli_end (struct ui_out *uiout, + enum ui_out_type type, + int level) { } diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index 1c8aa78..33cb498 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,9 @@ +2001-05-08 Andrew Cagney <ac131313@redhat.com> + + * mi-out.c (mi_begin, mi_end): Replace mi_list_begin and + mi_list_end. + (mi_ui_out_impl): Update. + 2001-03-28 Andrew Cagney <ac131313@redhat.com> * mi-main.c (mi_cmd_data_read_memory): Use xcalloc. diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index 612cdf8..6bd633f 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -43,8 +43,9 @@ static void mi_table_body (struct ui_out *uiout); static void mi_table_end (struct ui_out *uiout); static void mi_table_header (struct ui_out *uiout, int width, enum ui_align alig, char *colhdr); -static void mi_list_begin (struct ui_out *uiout, int list_flag, char *lstid); -static void mi_list_end (struct ui_out *uiout, int list_flag); +static void mi_begin (struct ui_out *uiout, enum ui_out_type type, + int level, const char *id); +static void mi_end (struct ui_out *uiout, enum ui_out_type type, int level); static void mi_field_int (struct ui_out *uiout, int fldno, int width, enum ui_align alig, char *fldname, int value); static void mi_field_skip (struct ui_out *uiout, int fldno, int width, @@ -73,8 +74,8 @@ struct ui_out_impl mi_ui_out_impl = mi_table_body, mi_table_end, mi_table_header, - mi_list_begin, - mi_list_end, + mi_begin, + mi_end, mi_field_int, mi_field_skip, mi_field_string, @@ -149,7 +150,10 @@ mi_table_header (struct ui_out *uiout, int width, int alignment, char *colhdr) /* Mark beginning of a list */ void -mi_list_begin (struct ui_out *uiout, int list_flag, char *lstid) +mi_begin (struct ui_out *uiout, + enum ui_out_type type, + int level, + const char *lstid) { struct ui_out_data *data = ui_out_data (uiout); field_separator (uiout); @@ -162,7 +166,9 @@ mi_list_begin (struct ui_out *uiout, int list_flag, char *lstid) /* Mark end of a list */ void -mi_list_end (struct ui_out *uiout, int list_flag) +mi_end (struct ui_out *uiout, + enum ui_out_type type, + int level) { struct ui_out_data *data = ui_out_data (uiout); list_close (uiout); diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 9fcabd4..696128d 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -53,6 +53,8 @@ struct ui_out_level { /* Count each field; the first element is for non-list fields */ int field_count; + /* The type of this level. */ + enum ui_out_type type; }; /* The ui_out structure */ @@ -103,24 +105,28 @@ current_level (struct ui_out *uiout) /* Create a new level, of TYPE. Return the new level's index. */ static int push_level (struct ui_out *uiout, + enum ui_out_type type, const char *id) { struct ui_out_level *current; /* We had better not overflow the buffer. */ uiout->level++; - gdb_assert (uiout->level > 0 && uiout->level < MAX_UI_OUT_LEVELS); + gdb_assert (uiout->level >= 0 && uiout->level < MAX_UI_OUT_LEVELS); current = current_level (uiout); current->field_count = 0; + current->type = type; return uiout->level; } /* Discard the current level, return the discarded level's index. TYPE is the type of the level being discarded. */ static int -pop_level (struct ui_out *uiout) +pop_level (struct ui_out *uiout, + enum ui_out_type type) { /* We had better not underflow the buffer. */ gdb_assert (uiout->level > 0 && uiout->level < MAX_UI_OUT_LEVELS); + gdb_assert (current_level (uiout)->type == type); uiout->level--; return uiout->level + 1; } @@ -134,9 +140,12 @@ static void default_table_body (struct ui_out *uiout); static void default_table_end (struct ui_out *uiout); static void default_table_header (struct ui_out *uiout, int width, enum ui_align alig, char *colhdr); -static void default_list_begin (struct ui_out *uiout, int level, - char *lstid); -static void default_list_end (struct ui_out *uiout, int level); +static void default_begin (struct ui_out *uiout, + enum ui_out_type type, + int level, const char *id); +static void default_end (struct ui_out *uiout, + enum ui_out_type type, + int level); static void default_field_int (struct ui_out *uiout, int fldno, int width, enum ui_align alig, char *fldname, int value); static void default_field_skip (struct ui_out *uiout, int fldno, int width, @@ -162,8 +171,8 @@ struct ui_out_impl default_ui_out_impl = default_table_body, default_table_end, default_table_header, - default_list_begin, - default_list_end, + default_begin, + default_end, default_field_int, default_field_skip, default_field_string, @@ -196,8 +205,12 @@ static void uo_table_body (struct ui_out *uiout); static void uo_table_end (struct ui_out *uiout); static void uo_table_header (struct ui_out *uiout, int width, enum ui_align align, char *colhdr); -static void uo_list_begin (struct ui_out *uiout, int level, char *lstid); -static void uo_list_end (struct ui_out *uiout, int level); +static void uo_begin (struct ui_out *uiout, + enum ui_out_type type, + int level, const char *id); +static void uo_end (struct ui_out *uiout, + enum ui_out_type type, + int level); static void uo_field_int (struct ui_out *uiout, int fldno, int width, enum ui_align align, char *fldname, int value); static void uo_field_skip (struct ui_out *uiout, int fldno, int width, @@ -303,24 +316,40 @@ and before table_body."); } void -ui_out_list_begin (struct ui_out *uiout, char *lstid) +ui_out_begin (struct ui_out *uiout, + enum ui_out_type type, + const char *id) { int new_level; if (uiout->table_flag && !uiout->body_flag) internal_error (__FILE__, __LINE__, "table header or table_body expected; lists must be \ specified after table_body."); - new_level = push_level (uiout, lstid); + new_level = push_level (uiout, type, id); if (uiout->table_flag && (new_level == 1)) uiout->headercurr = uiout->headerfirst; - uo_list_begin (uiout, new_level, lstid); + uo_begin (uiout, type, new_level, id); +} + +void +ui_out_list_begin (struct ui_out *uiout, + char *id) +{ + ui_out_begin (uiout, ui_out_type_list, id); +} + +void +ui_out_end (struct ui_out *uiout, + enum ui_out_type type) +{ + int old_level = pop_level (uiout, type); + uo_end (uiout, type, old_level); } void ui_out_list_end (struct ui_out *uiout) { - int old_level = pop_level (uiout); - uo_list_end (uiout, old_level); + ui_out_end (uiout, ui_out_type_list); } static void @@ -629,12 +658,17 @@ default_table_header (struct ui_out *uiout, int width, enum ui_align alignment, } static void -default_list_begin (struct ui_out *uiout, int level, char *lstid) +default_begin (struct ui_out *uiout, + enum ui_out_type type, + int level, + const char *id) { } static void -default_list_end (struct ui_out *uiout, int level) +default_end (struct ui_out *uiout, + enum ui_out_type type, + int level) { } @@ -728,19 +762,24 @@ uo_table_header (struct ui_out *uiout, int width, enum ui_align align, char *col } void -uo_list_begin (struct ui_out *uiout, int level, char *lstid) +uo_begin (struct ui_out *uiout, + enum ui_out_type type, + int level, + const char *id) { - if (!uiout->impl->list_begin) + if (uiout->impl->begin == NULL) return; - uiout->impl->list_begin (uiout, level, lstid); + uiout->impl->begin (uiout, type, level, id); } void -uo_list_end (struct ui_out *uiout, int level) +uo_end (struct ui_out *uiout, + enum ui_out_type type, + int level) { - if (!uiout->impl->list_end) + if (uiout->impl->end == NULL) return; - uiout->impl->list_end (uiout, level); + uiout->impl->end (uiout, type, level); } void diff --git a/gdb/ui-out.h b/gdb/ui-out.h index 33c3308..a537412 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -65,6 +65,25 @@ struct ui_stream /* Prototypes for ui-out API. */ +/* A result is a recursive data structure consisting of lists and + tupples. */ + +enum ui_out_type + { + ui_out_type_tupple, + ui_out_type_list + }; + +extern void ui_out_begin (struct ui_out *uiout, + enum ui_out_type level_type, + const char *id); + +extern void ui_out_end (struct ui_out *uiout, enum ui_out_type type); + +/* A table can be considered a special tupple/list combination with + the implied structure: ``table = { hdr = { header, ... } , body = [ { + field, ... }, ... ] }'' */ + extern void ui_out_table_begin (struct ui_out *uiout, int nbrofcols, char *tblid); @@ -75,6 +94,9 @@ extern void ui_out_table_body (struct ui_out *uiout); extern void ui_out_table_end (struct ui_out *uiout); +/* Compatibility wrappers, new code should use ui_out_begin() and + ui_out_end(). */ + extern void ui_out_list_begin (struct ui_out *uiout, char *lstid); extern void ui_out_list_end (struct ui_out *uiout); @@ -164,9 +186,12 @@ typedef void (table_header_ftype) (struct ui_out * uiout, int width, enum ui_align align, char *colhdr); /* Note: level 0 is the top-level so LEVEL is always greater than zero. */ -typedef void (list_begin_ftype) (struct ui_out * uiout, - int level, char *lstid); -typedef void (list_end_ftype) (struct ui_out * uiout, int level); +typedef void (ui_out_begin_ftype) (struct ui_out *uiout, + enum ui_out_type type, + int level, const char *id); +typedef void (ui_out_end_ftype) (struct ui_out *uiout, + enum ui_out_type type, + int level); typedef void (field_int_ftype) (struct ui_out * uiout, int fldno, int width, enum ui_align align, char *fldname, int value); typedef void (field_skip_ftype) (struct ui_out * uiout, int fldno, int width, @@ -195,8 +220,8 @@ struct ui_out_impl table_body_ftype *table_body; table_end_ftype *table_end; table_header_ftype *table_header; - list_begin_ftype *list_begin; - list_end_ftype *list_end; + ui_out_begin_ftype *begin; + ui_out_end_ftype *end; field_int_ftype *field_int; field_skip_ftype *field_skip; field_string_ftype *field_string; |