This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[rfc/mi] ui_list_* to ui_*


Hello,

The attached patch introduces:

	ui_begin (...type...)
	ui_end (...type...)

where type is either UI_OUT_TUPPLE or UI_OUT_LIST.  The interface:

	ui_list_begin()
	ui_list_end()

remains but it is re-implemented using ui_begin/ui_end.

This is step 1 in updating MI's syntax.

	Andrew
2001-03-23  Andrew Cagney  <ac131313@redhat.com>

	* ui-out.h (enum ui_out_type): Declare.
	(ui_out_begin, ui_out_begin, ui_out_begin_cleanup_end): Declare.
	(begin_ftype, end_ftype): Replace list_begin_ftype and
	list_end_ftype.
	(struct ui_out_impl): Update.
	(MAX_UI_OUT_LEVELS): Declare.

	* ui-out.c: Include "gdb_assert.h".
	(struct ui_out_level): Define.
	(struct ui_out): Replace ``list_flag'' and ``field_count'' with
	``level'' and ``levels''.
	(top_level, push_level, pop_level): New functions.
	(default_begin, default_end): Replace default_list_begin and
	default_list_end.
	(ou_begin, ou_end): Replace ou_list_begin, ou_list_end.
	(ui_out_begin, ui_out_end, ui_out_begin_cleanup_end): New
	functions.
	(ui_out_list_begin, ui_out_list_end): Call ui_out_begin and
	ui_out_end.
	(ui_out_field_int, ui_out_field_skip)
	(ui_out_field_string, ui_out_field_fmt, ui_out_new): Update

	* cli-out.c (cli_begin, cli_end): Replace cli_list_begin and
	cli_list_end.

Index: cli-out.c
===================================================================
RCS file: /cvs/src/src/gdb/cli-out.c,v
retrieving revision 1.6
diff -p -r1.6 cli-out.c
*** cli-out.c	2001/03/06 08:21:06	1.6
--- cli-out.c	2001/03/24 02:33:31
*************** static void cli_table_body (struct ui_ou
*** 43,50 ****
  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_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,
--- 43,50 ----
  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_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,
*************** static struct ui_out_impl cli_ui_out_imp
*** 73,80 ****
    cli_table_body,
    cli_table_end,
    cli_table_header,
!   cli_list_begin,
!   cli_list_end,
    cli_field_int,
    cli_field_skip,
    cli_field_string,
--- 73,80 ----
    cli_table_body,
    cli_table_end,
    cli_table_header,
!   cli_begin,
!   cli_end,
    cli_field_int,
    cli_field_skip,
    cli_field_string,
*************** cli_table_header (struct ui_out *uiout, 
*** 134,147 ****
  /* Mark beginning of a list */
  
  void
! cli_list_begin (struct ui_out *uiout, int list_flag, char *lstid)
  {
  }
  
  /* Mark end of a list */
  
  void
! cli_list_end (struct ui_out *uiout, int list_flag)
  {
  }
  
--- 134,148 ----
  /* Mark beginning of a list */
  
  void
! cli_begin (struct ui_out *uiout, enum ui_out_type type, int level,
! 	   const char *lstid)
  {
  }
  
  /* Mark end of a list */
  
  void
! cli_end (struct ui_out *uiout, enum ui_out_type type, int level)
  {
  }
  
Index: ui-out.c
===================================================================
RCS file: /cvs/src/src/gdb/ui-out.c,v
retrieving revision 1.8
diff -p -r1.8 ui-out.c
*** ui-out.c	2001/02/08 06:03:54	1.8
--- ui-out.c	2001/03/24 02:33:31
***************
*** 25,30 ****
--- 25,31 ----
  #include "expression.h"		/* For language.h */
  #include "language.h"
  #include "ui-out.h"
+ #include "gdb_assert.h"
  
  /* Convenience macro for allocting typesafe memory. */
  
*************** struct ui_out_hdr
*** 42,47 ****
--- 43,56 ----
      struct ui_out_hdr *next;
    };
  
+ struct ui_out_level
+   {
+     enum ui_out_type type;
+ 
+     /* we count each field; the first element is for non-list fields */
+     int field_count;
+   };
+ 
  /* The ui_out structure */
  /* Any change here requires a corresponding one in the initialization
     of the default uiout, which is statically initialized */
*************** struct ui_out_hdr
*** 49,58 ****
--- 58,72 ----
  struct ui_out
    {
      int flags;
+ 
      /* specific implementation of ui-out */
      struct ui_out_impl *impl;
      struct ui_out_data *data;
  
+     /* Sub structure tracking the table depth. */
+     int level;
+     struct ui_out_level levels[MAX_UI_OUT_LEVELS];
+ 
      /* if on, a table is being generated */
      int table_flag;
  
*************** struct ui_out
*** 65,76 ****
      /* strinf identifying the table (as specified in the table_begin call) */
      char *table_id;
  
-     /* if on, a list is being generated.  The value is the level of nesting */
-     int list_flag;
- 
-     /* we count each field; the first element is for non-list fields */
-     int field_count[5];
- 
      /* points to the first header (if any) */
      struct ui_out_hdr *headerfirst;
  
--- 79,84 ----
*************** struct ui_out
*** 82,87 ****
--- 90,130 ----
  
    };
  
+ static struct ui_out_level *
+ top_level (struct ui_out *uiout)
+ {
+   return &uiout->levels[uiout->level];
+ }
+ 
+ /* Create a new level, return that levels index. */
+ 
+ static int
+ push_level (struct ui_out *uiout,
+ 	    enum ui_out_type type,
+ 	    const char *id)
+ {
+   /* We had better not underflow the buffer. */
+   gdb_assert (uiout->level < MAX_UI_OUT_LEVELS - 1);
+   uiout->level++;
+   top_level (uiout)->type = type;
+   top_level (uiout)->field_count = 0;
+   return uiout->level;
+ }
+ 
+ /* Discard the current level, return the discarded levels index */
+ 
+ static int
+ pop_level (struct ui_out *uiout,
+ 	   enum ui_out_type type)
+ {
+   /* We had better not underflow the buffer. */
+   gdb_assert (uiout->level > 0);
+   gdb_assert (top_level (uiout)->type == type);
+   uiout->level--;
+   return uiout->level + 1;
+ }
+ 
+ 
  /* These are the default implementation functions */
  
  static void default_table_begin (struct ui_out *uiout, int nbrofcols,
*************** static void default_table_body (struct u
*** 90,98 ****
  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 list_flag,
! 				char *lstid);
! static void default_list_end (struct ui_out *uiout, int list_flag);
  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,
--- 133,142 ----
  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 depth, char *lstid);
! static void default_list_end (struct ui_out *uiout, int depth);
! 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,
*************** struct ui_out_impl default_ui_out_impl =
*** 118,125 ****
    default_table_body,
    default_table_end,
    default_table_header,
!   default_list_begin,
!   default_list_end,
    default_field_int,
    default_field_skip,
    default_field_string,
--- 162,169 ----
    default_table_body,
    default_table_end,
    default_table_header,
!   default_begin,
!   default_end,
    default_field_int,
    default_field_skip,
    default_field_string,
*************** static void uo_table_body (struct ui_out
*** 152,159 ****
  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 list_flag, char *lstid);
! static void uo_list_end (struct ui_out *uiout, int list_flag);
  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,
--- 196,203 ----
  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_begin (struct ui_out *uiout, enum ui_out_type, int level, const char *lstid);
! static void uo_end (struct ui_out *uiout, enum ui_out_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,
*************** and before table_body.");
*** 259,305 ****
  }
  
  void
! ui_out_list_begin (struct ui_out *uiout, char *lstid)
  {
    if (uiout->table_flag && !uiout->body_flag)
      internal_error (__FILE__, __LINE__,
  		    "table header or table_body expected; lists must be \
  specified after table_body.");
!   if (uiout->list_flag >= 4)
!     internal_error (__FILE__, __LINE__,
! 		    "list depth exceeded; only 4 levels of lists can be \
! nested.");
! 
!   uiout->list_flag++;
!   uiout->field_count[uiout->list_flag] = 0;
!   if (uiout->table_flag && (uiout->list_flag == 1))
      uiout->headercurr = uiout->headerfirst;
  
!   uo_list_begin (uiout, uiout->list_flag, lstid);
  }
  
  void
! ui_out_list_end (struct ui_out *uiout)
  {
!   if (!uiout->list_flag)
!     internal_error (__FILE__, __LINE__,
! 		    "misplaced list_end; there is no list to be closed.");
  
!   uo_list_end (uiout, uiout->list_flag);
  
!   uiout->list_flag--;
  }
  
! static void
! do_list_end (void *uiout)
  {
!   ui_out_list_end (uiout);
  }
  
  struct cleanup *
  make_cleanup_ui_out_list_end (struct ui_out *uiout)
  {
!   return make_cleanup (do_list_end, uiout);
  }
  
  void
--- 303,381 ----
  }
  
  void
! ui_out_begin (struct ui_out *uiout,
! 	      enum ui_out_type type,
! 	      const char *id)
  {
+   int 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.");
!   level = push_level (uiout, type, id);
!   if (uiout->table_flag && (level == 1))
      uiout->headercurr = uiout->headerfirst;
  
!   uo_begin (uiout, type, level, id);
  }
  
  void
! ui_out_end (struct ui_out *uiout, enum ui_out_type type)
  {
!   int level = pop_level (uiout, type);
!   uo_end (uiout, type, level);
! }
  
! struct ui_out_end_cleanup_data
! {
!   struct ui_out *uiout;
!   enum ui_out_type type;
! };
  
! static void
! do_cleanup_end (void *data)
! {
!   struct ui_out_end_cleanup_data *end_cleanup_data = data;
!   ui_out_end (end_cleanup_data->uiout, end_cleanup_data->type);
!   xfree (end_cleanup_data);
! }
! 
! static struct cleanup *
! make_cleanup_ui_out_end (struct ui_out *uiout,
! 			 enum ui_out_type type)
! {
!   struct ui_out_end_cleanup_data *end_cleanup_data;
!   end_cleanup_data = XMALLOC (struct ui_out_end_cleanup_data);
!   end_cleanup_data->uiout = uiout;
!   end_cleanup_data->type = type;
!   return make_cleanup (do_cleanup_end, end_cleanup_data);
  }
  
! struct cleanup *
! ui_out_begin_cleanup_end (struct ui_out *uiout,
! 			  enum ui_out_type type,
! 			  const char *id)
! {
!   ui_out_begin (uiout, type, id);
!   return make_cleanup_ui_out_end (uiout, type);
! }
! 
! void
! ui_out_list_begin (struct ui_out *uiout, char *id)
! {
!   ui_out_begin (uiout, UI_OUT_LIST, id);
! }
! 
! void
! ui_out_list_end (struct ui_out *uiout)
  {
!   ui_out_end (uiout, UI_OUT_LIST);
  }
  
  struct cleanup *
  make_cleanup_ui_out_list_end (struct ui_out *uiout)
  {
!   return make_cleanup_ui_out_end (uiout, UI_OUT_LIST);
  }
  
  void
*************** ui_out_field_int (struct ui_out *uiout, 
*** 311,318 ****
  
    verify_field_proper_position (uiout);
  
!   uiout->field_count[uiout->list_flag] += 1;
!   fldno = uiout->field_count[uiout->list_flag];
  
    verify_field_alignment (uiout, fldno, &width, &align);
  
--- 387,394 ----
  
    verify_field_proper_position (uiout);
  
!   top_level (uiout)->field_count += 1;
!   fldno = top_level (uiout)->field_count;
  
    verify_field_alignment (uiout, fldno, &width, &align);
  
*************** ui_out_field_skip (struct ui_out *uiout,
*** 356,363 ****
  
    verify_field_proper_position (uiout);
  
!   uiout->field_count[uiout->list_flag] += 1;
!   fldno = uiout->field_count[uiout->list_flag];
  
    verify_field_alignment (uiout, fldno, &width, &align);
  
--- 432,439 ----
  
    verify_field_proper_position (uiout);
  
!   top_level (uiout)->field_count += 1;
!   fldno = top_level (uiout)->field_count;
  
    verify_field_alignment (uiout, fldno, &width, &align);
  
*************** ui_out_field_string (struct ui_out *uiou
*** 375,382 ****
  
    verify_field_proper_position (uiout);
  
!   uiout->field_count[uiout->list_flag] += 1;
!   fldno = uiout->field_count[uiout->list_flag];
  
    verify_field_alignment (uiout, fldno, &width, &align);
  
--- 451,458 ----
  
    verify_field_proper_position (uiout);
  
!   top_level (uiout)->field_count += 1;
!   fldno = top_level (uiout)->field_count;
  
    verify_field_alignment (uiout, fldno, &width, &align);
  
*************** ui_out_field_fmt (struct ui_out *uiout, 
*** 394,401 ****
  
    verify_field_proper_position (uiout);
  
!   uiout->field_count[uiout->list_flag] += 1;
!   fldno = uiout->field_count[uiout->list_flag];
  
    /* will not align, but has to call anyway */
    verify_field_alignment (uiout, fldno, &width, &align);
--- 470,477 ----
  
    verify_field_proper_position (uiout);
  
!   top_level (uiout)->field_count += 1;
!   fldno = top_level (uiout)->field_count;
  
    /* will not align, but has to call anyway */
    verify_field_alignment (uiout, fldno, &width, &align);
*************** default_table_header (struct ui_out *uio
*** 592,603 ****
  }
  
  static void
! default_list_begin (struct ui_out *uiout, int list_flag, char *lstid)
  {
  }
  
  static void
! default_list_end (struct ui_out *uiout, int list_flag)
  {
  }
  
--- 668,679 ----
  }
  
  static void
! default_begin (struct ui_out *uiout, enum ui_out_type type, int level, const char *lstid)
  {
  }
  
  static void
! default_end (struct ui_out *uiout, enum ui_out_type type, int level)
  {
  }
  
*************** uo_table_header (struct ui_out *uiout, i
*** 691,709 ****
  }
  
  void
! uo_list_begin (struct ui_out *uiout, int list_flag, char *lstid)
  {
!   if (!uiout->impl->list_begin)
      return;
!   uiout->impl->list_begin (uiout, list_flag, lstid);
  }
  
  void
! uo_list_end (struct ui_out *uiout, int list_flag)
  {
!   if (!uiout->impl->list_end)
      return;
!   uiout->impl->list_end (uiout, list_flag);
  }
  
  void
--- 767,785 ----
  }
  
  void
! uo_begin (struct ui_out *uiout, enum ui_out_type type, int level, const char *id)
  {
!   if (uiout->impl->begin == NULL)
      return;
!   uiout->impl->begin (uiout, type, level, id);
  }
  
  void
! uo_end (struct ui_out *uiout, enum ui_out_type type, int level)
  {
!   if (uiout->impl->end == NULL)
      return;
!   uiout->impl->end (uiout, type, level);
  }
  
  void
*************** verify_field_proper_position (struct ui_
*** 862,868 ****
  	internal_error (__FILE__, __LINE__,
  			"table_body missing; table fields must be \
  specified after table_body and inside a list.");
!       if (!uiout->list_flag)
  	internal_error (__FILE__, __LINE__,
  			"list_begin missing; table fields must be \
  specified after table_body and inside a list.");
--- 938,944 ----
  	internal_error (__FILE__, __LINE__,
  			"table_body missing; table fields must be \
  specified after table_body and inside a list.");
!       if (!uiout->level)
  	internal_error (__FILE__, __LINE__,
  			"list_begin missing; table fields must be \
  specified after table_body and inside a list.");
*************** ui_out_new (struct ui_out_impl *impl,
*** 922,929 ****
    uiout->flags = flags;
    uiout->table_flag = 0;
    uiout->body_flag = 0;
!   uiout->list_flag = 0;
!   uiout->field_count[0] = 0;
    uiout->headerfirst = NULL;
    uiout->headerlast = NULL;
    uiout->headercurr = NULL;
--- 998,1005 ----
    uiout->flags = flags;
    uiout->table_flag = 0;
    uiout->body_flag = 0;
!   uiout->level = 0;
!   top_level (uiout)->field_count = 0;
    uiout->headerfirst = NULL;
    uiout->headerlast = NULL;
    uiout->headercurr = NULL;
Index: ui-out.h
===================================================================
RCS file: /cvs/src/src/gdb/ui-out.h,v
retrieving revision 1.5
diff -p -r1.5 ui-out.h
*** ui-out.h	2001/03/14 16:42:30	1.5
--- ui-out.h	2001/03/24 02:33:31
*************** enum ui_flags
*** 51,56 ****
--- 51,58 ----
      ui_source_list = 2
    };
  
+ /* Max nr of levels that ui-out object can be nested. */
+ enum { MAX_UI_OUT_LEVELS = 5 };
  
  /* The ui_out stream structure. */
  /* NOTE: cagney/2000-02-01: The ui_stream object can be subsumed by
*************** struct ui_stream
*** 62,68 ****
      struct ui_file *stream;
    };
  
- 
  /* Prototypes for ui-out API. */
  
  extern void ui_out_table_begin (struct ui_out *uiout, int nbrofcols,
--- 64,69 ----
*************** extern void ui_out_table_body (struct ui
*** 75,80 ****
--- 76,101 ----
  
  extern void ui_out_table_end (struct ui_out *uiout);
  
+ /* Level categories. */
+ enum ui_out_type
+   {
+     UI_OUT_TUPPLE,
+     UI_OUT_LIST
+   };
+ 
+ extern void ui_out_begin (struct ui_out *uiout,
+ 			  enum ui_out_type level_type,
+ 			  const char *lstid);
+ 
+ extern void ui_out_end (struct ui_out *uiout, enum ui_out_type type);
+ 
+ extern struct cleanup *ui_out_begin_cleanup_end (struct ui_out *uiout,
+ 						 enum ui_out_type level_type,
+ 						 const char *id);
+ 
+ /* 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);
*************** extern void ui_out_error_begin (struct u
*** 142,153 ****
  extern void ui_out_error_end (struct ui_out *uiout);
  #endif
  
- #if 0
- extern void gdb_error (struct ui_out *uiout, int severity, char *format, ...);
- 
- extern void gdb_query (struct ui_out *uiout, int qflags, char *qprompt);
- #endif
- 
  /* From here on we have things that are only needed by implementation
     routines and main.c.   We should pehaps have a separate file for that,
     like a  ui-out-impl.h  file */
--- 163,168 ----
*************** extern void gdb_query (struct ui_out *ui
*** 156,170 ****
  
  /* Type definition of all implementation functions. */
  
  typedef void (table_begin_ftype) (struct ui_out * uiout,
  				  int nbrofcols, char *tblid);
  typedef void (table_body_ftype) (struct ui_out * uiout);
  typedef void (table_end_ftype) (struct ui_out * uiout);
  typedef void (table_header_ftype) (struct ui_out * uiout, int width,
  				   enum ui_align align, char *colhdr);
! typedef void (list_begin_ftype) (struct ui_out * uiout,
! 				 int list_flag, char *lstid);
! typedef void (list_end_ftype) (struct ui_out * uiout, int list_flag);
  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,
--- 171,191 ----
  
  /* Type definition of all implementation functions. */
  
+ /* A table is a special tupple/list combination.  It can be thought of
+    as ``body = { hdr = { header, ... } , body = [ { field, ... },
+    ... ] }'' */
  typedef void (table_begin_ftype) (struct ui_out * uiout,
  				  int nbrofcols, char *tblid);
  typedef void (table_body_ftype) (struct ui_out * uiout);
  typedef void (table_end_ftype) (struct ui_out * uiout);
  typedef void (table_header_ftype) (struct ui_out * uiout, int width,
  				   enum ui_align align, char *colhdr);
! /* NOTE: level > 0 (0 is reserved). */
! typedef void (begin_ftype) (struct ui_out * uiout,
! 			    enum ui_out_type type,
! 			    int level, const char *lstid);
! typedef void (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,
*************** struct ui_out_impl
*** 193,200 ****
      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;
      field_int_ftype *field_int;
      field_skip_ftype *field_skip;
      field_string_ftype *field_string;
--- 214,221 ----
      table_body_ftype *table_body;
      table_end_ftype *table_end;
      table_header_ftype *table_header;
!     begin_ftype *begin;
!     end_ftype *end;
      field_int_ftype *field_int;
      field_skip_ftype *field_skip;
      field_string_ftype *field_string;
Index: mi/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/mi/ChangeLog,v
retrieving revision 1.13
diff -p -r1.13 ChangeLog
*** ChangeLog	2001/03/20 17:19:04	1.13
--- ChangeLog	2001/03/24 02:33:34
***************
*** 1,3 ****
--- 1,9 ----
+ 2001-03-23  Andrew Cagney  <ac131313@redhat.com>
+ 
+ 	* mi-out.c (mi_begin, mi_end): Replace mi_list_begin and
+ 	mi_list_end.
+ 	(mi_open, mi_close): Replace list_open and list_close.
+ 
  2001-03-20  Andrew Cagney  <ac131313@redhat.com>
  
  	* mi-cmd-disas.c (mi_cmd_disassemble): Initialize ``file_string''
Index: mi/mi-out.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-out.c,v
retrieving revision 1.6
diff -p -r1.6 mi-out.c
*** mi-out.c	2001/03/06 08:21:45	1.6
--- mi-out.c	2001/03/24 02:33:34
*************** static void mi_table_body (struct ui_out
*** 43,50 ****
  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_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,
--- 43,50 ----
  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_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,
*************** struct ui_out_impl mi_ui_out_impl =
*** 73,80 ****
    mi_table_body,
    mi_table_end,
    mi_table_header,
!   mi_list_begin,
!   mi_list_end,
    mi_field_int,
    mi_field_skip,
    mi_field_string,
--- 73,80 ----
    mi_table_body,
    mi_table_end,
    mi_table_header,
!   mi_begin,
!   mi_end,
    mi_field_int,
    mi_field_skip,
    mi_field_string,
*************** struct ui_out_impl mi_ui_out_impl =
*** 90,97 ****
  
  extern void _initialize_mi_out (void);
  static void field_separator (struct ui_out *uiout);
! static void list_open (struct ui_out *uiout);
! static void list_close (struct ui_out *uiout);
  
  static void out_field_fmt (struct ui_out *uiout, int fldno, char *fldname,
  			   char *format,...);
--- 90,97 ----
  
  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_close (struct ui_out *uiout, enum ui_out_type type);
  
  static void out_field_fmt (struct ui_out *uiout, int fldno, char *fldname,
  			   char *format,...);
*************** mi_table_begin (struct ui_out *uiout, in
*** 105,111 ****
    field_separator (uiout);
    if (tblid)
      fprintf_unfiltered (data->buffer, "%s=", tblid);
!   list_open (uiout);
    data->first_header = 0;
    data->supress_field_separator = 1;
  }
--- 105,111 ----
    field_separator (uiout);
    if (tblid)
      fprintf_unfiltered (data->buffer, "%s=", tblid);
!   mi_open (uiout, UI_OUT_TUPPLE);
    data->first_header = 0;
    data->supress_field_separator = 1;
  }
*************** mi_table_body (struct ui_out *uiout)
*** 118,124 ****
    struct ui_out_data *data = ui_out_data (uiout);
    /* close the table header line if there were any headers */
    if (data->first_header)
!     list_close (uiout);
  }
  
  /* Mark end of a table */
--- 118,124 ----
    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_TUPPLE);
  }
  
  /* Mark end of a table */
*************** void
*** 127,133 ****
  mi_table_end (struct ui_out *uiout)
  {
    struct ui_out_data *data = ui_out_data (uiout);
!   list_close (uiout);
    /* If table was empty this flag did not get reset yet */
    data->supress_field_separator = 0;
  }
--- 127,133 ----
  mi_table_end (struct ui_out *uiout)
  {
    struct ui_out_data *data = ui_out_data (uiout);
!   mi_close (uiout, UI_OUT_TUPPLE);
    /* If table was empty this flag did not get reset yet */
    data->supress_field_separator = 0;
  }
*************** mi_table_header (struct ui_out *uiout, i
*** 141,147 ****
    if (!data->first_header++)
      {
        fputs_unfiltered ("hdr=", data->buffer);
!       list_open (uiout);
      }
    mi_field_string (uiout, 0, width, alignment, 0, colhdr);
  }
--- 141,147 ----
    if (!data->first_header++)
      {
        fputs_unfiltered ("hdr=", data->buffer);
!       mi_open (uiout, UI_OUT_TUPPLE);
      }
    mi_field_string (uiout, 0, width, alignment, 0, colhdr);
  }
*************** mi_table_header (struct ui_out *uiout, i
*** 149,171 ****
  /* Mark beginning of a list */
  
  void
! mi_list_begin (struct ui_out *uiout, int list_flag, char *lstid)
  {
    struct ui_out_data *data = ui_out_data (uiout);
    field_separator (uiout);
    data->supress_field_separator = 1;
    if (lstid)
      fprintf_unfiltered (data->buffer, "%s=", lstid);
!   list_open (uiout);
  }
  
  /* Mark end of a list */
  
  void
! mi_list_end (struct ui_out *uiout, int list_flag)
  {
    struct ui_out_data *data = ui_out_data (uiout);
!   list_close (uiout);
    /* If list was empty this flag did not get reset yet */
    data->supress_field_separator = 0;
  }
--- 149,171 ----
  /* Mark beginning of a list */
  
  void
! 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);
    data->supress_field_separator = 1;
    if (lstid)
      fprintf_unfiltered (data->buffer, "%s=", lstid);
!   mi_open (uiout, type);
  }
  
  /* Mark end of a list */
  
  void
! mi_end (struct ui_out *uiout, enum ui_out_type type, int level)
  {
    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;
  }
*************** field_separator (struct ui_out *uiout)
*** 297,310 ****
  }
  
  static void
! list_open (struct ui_out *uiout)
  {
    struct ui_out_data *data = ui_out_data (uiout);
    fputc_unfiltered ('{', data->buffer);
  }
  
  static void
! list_close (struct ui_out *uiout)
  {
    struct ui_out_data *data = ui_out_data (uiout);
    fputc_unfiltered ('}', data->buffer);
--- 297,312 ----
  }
  
  static void
! mi_open (struct ui_out *uiout,
! 	 enum ui_out_type type)
  {
    struct ui_out_data *data = ui_out_data (uiout);
    fputc_unfiltered ('{', data->buffer);
  }
  
  static void
! mi_close (struct ui_out *uiout,
! 	  enum ui_out_type type)
  {
    struct ui_out_data *data = ui_out_data (uiout);
    fputc_unfiltered ('}', data->buffer);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]