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]

[patch] Add col_name to ui_out_table_header()


Hello,

This patch adds a ``col_name'' argument to the ui_out_table_header() 
call.  This lets MI include the col_name/field_name in both the table 
header and table body.

	Andrew
? diffs
? new-gdbarch.c
? gdbarch.log
? new-gdbarch.h
? new-gdbarch.log
? mi/diffs
? testsuite/gdb.mi/diffs
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.1366
diff -p -r1.1366 ChangeLog
*** ChangeLog	2001/06/19 20:30:10	1.1366
--- ChangeLog	2001/06/21 15:29:53
***************
*** 1,3 ****
--- 1,17 ----
+ 2001-06-20  Andrew Cagney  <ac131313@redhat.com>
+ 
+ 	* ui-out.h (ui_out_table_header): Add parameter ``col_name''.
+ 	(table_header_ftype): Ditto.
+ 	* cli-out.c (cli_table_header): Update.
+ 	* ui-out.c (ui_out_table_header): Update.
+ 	(uo_table_header): Update.
+ 	(default_table_header): Update.
+ 	(append_header_to_list): Update.
+ 	(struct ui_out_header): Add field ``col_name''.
+ 	(append_header_to_list): Use xstrdup.  Initialize col_name.
+ 	* breakpoint.c (breakpoint_1): Pass COL_NAME to
+ 	ui_out_table_header.
+ 
  2001-06-19  Andrew Cagney  <ac131313@redhat.com>
  
  	* cli-out.c: Include "gdb_assert.h'.
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.45
diff -p -r1.45 breakpoint.c
*** breakpoint.c	2001/06/19 20:30:11	1.45
--- breakpoint.c	2001/06/21 15:29:55
*************** breakpoint_1 (int bnum, int allflag)
*** 3601,3623 ****
      {
        annotate_breakpoints_headers ();
        annotate_field (0);
!       ui_out_table_header (uiout, 3, ui_left, "Num");	/* 1 */
        annotate_field (1);
!       ui_out_table_header (uiout, 14, ui_left, "Type");	/* 2 */
        annotate_field (2);
!       ui_out_table_header (uiout, 4, ui_left, "Disp");	/* 3 */
        annotate_field (3);
!       ui_out_table_header (uiout, 3, ui_left, "Enb");	/* 4 */
        if (addressprint)
  	{
  	  annotate_field (4);
  	  if (TARGET_ADDR_BIT <= 32)
! 	    ui_out_table_header (uiout, 10, ui_left, "Address");	/* 5 */
  	  else
! 	    ui_out_table_header (uiout, 18, ui_left, "Address");	/* 5 */
  	}
        annotate_field (5);
!       ui_out_table_header (uiout, 40, ui_noalign, "What");	/* 6 */
        ui_out_table_body (uiout);
        annotate_breakpoints_table ();
      }
--- 3601,3623 ----
      {
        annotate_breakpoints_headers ();
        annotate_field (0);
!       ui_out_table_header (uiout, 3, ui_left, "number", "Num");		/* 1 */
        annotate_field (1);
!       ui_out_table_header (uiout, 14, ui_left, "type", "Type");		/* 2 */
        annotate_field (2);
!       ui_out_table_header (uiout, 4, ui_left, "disp", "Disp");		/* 3 */
        annotate_field (3);
!       ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb");	/* 4 */
        if (addressprint)
  	{
  	  annotate_field (4);
  	  if (TARGET_ADDR_BIT <= 32)
! 	    ui_out_table_header (uiout, 10, ui_left, "addr", "Address");/* 5 */
  	  else
! 	    ui_out_table_header (uiout, 18, ui_left, "addr", "Address");/* 5 */
  	}
        annotate_field (5);
!       ui_out_table_header (uiout, 40, ui_noalign, "what", "What");	/* 6 */
        ui_out_table_body (uiout);
        annotate_breakpoints_table ();
      }
Index: cli-out.c
===================================================================
RCS file: /cvs/src/src/gdb/cli-out.c,v
retrieving revision 1.10
diff -p -r1.10 cli-out.c
*** cli-out.c	2001/06/19 20:30:11	1.10
--- cli-out.c	2001/06/21 15:29:55
*************** static void cli_table_begin (struct ui_o
*** 45,51 ****
  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,
  			      const char *colhdr);
  static void cli_begin (struct ui_out *uiout, enum ui_out_type type,
  		       int level, const char *lstid);
--- 45,51 ----
  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, const char *col_name,
  			      const char *colhdr);
  static void cli_begin (struct ui_out *uiout, enum ui_out_type type,
  		       int level, const char *lstid);
*************** cli_table_end (struct ui_out *uiout)
*** 147,152 ****
--- 147,153 ----
  
  void
  cli_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
+ 		  const char *col_name,
  		  const char *colhdr)
  {
    struct ui_out_data *data = ui_out_data (uiout);
Index: ui-out.c
===================================================================
RCS file: /cvs/src/src/gdb/ui-out.c,v
retrieving revision 1.16
diff -p -r1.16 ui-out.c
*** ui-out.c	2001/06/19 16:19:15	1.16
--- ui-out.c	2001/06/21 15:29:55
*************** struct ui_out_hdr
*** 39,44 ****
--- 39,45 ----
      int colno;
      int width;
      int alignment;
+     char *col_name;
      char *colhdr;
      struct ui_out_hdr *next;
    };
*************** static void default_table_begin (struct 
*** 139,145 ****
  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,
  				  const char *colhdr);
  static void default_begin (struct ui_out *uiout,
  			   enum ui_out_type type,
--- 140,146 ----
  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, const char *col_name,
  				  const char *colhdr);
  static void default_begin (struct ui_out *uiout,
  			   enum ui_out_type type,
*************** static void uo_table_begin (struct ui_ou
*** 213,219 ****
  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, const char *colhdr);
  static void uo_begin (struct ui_out *uiout,
  		      enum ui_out_type type,
  		      int level, const char *id);
--- 214,221 ----
  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, const char *col_name,
! 			     const char *colhdr);
  static void uo_begin (struct ui_out *uiout,
  		      enum ui_out_type type,
  		      int level, const char *id);
*************** static void uo_flush (struct ui_out *uio
*** 241,247 ****
  
  extern void _initialize_ui_out (void);
  static void append_header_to_list (struct ui_out *uiout, int width,
! 				   int alignment, const char *colhdr);
  static int get_curr_header (struct ui_out *uiout, int *colno, int *width,
  			    int *alignment, char **colhdr);
  static void clear_header_list (struct ui_out *uiout);
--- 243,250 ----
  
  extern void _initialize_ui_out (void);
  static void append_header_to_list (struct ui_out *uiout, int width,
! 				   int alignment, const char *col_name,
! 				   const char *colhdr);
  static int get_curr_header (struct ui_out *uiout, int *colno, int *width,
  			    int *alignment, char **colhdr);
  static void clear_header_list (struct ui_out *uiout);
*************** ui_out_table_end (struct ui_out *uiout)
*** 316,321 ****
--- 319,325 ----
  
  void
  ui_out_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
+ 		     const char *col_name,
  		     const char *colhdr)
  {
    if (!uiout->table_flag || uiout->body_flag)
*************** ui_out_table_header (struct ui_out *uiou
*** 323,331 ****
  		    "table header must be specified after table_begin \
  and before table_body.");
  
!   append_header_to_list (uiout, width, alignment, colhdr);
  
!   uo_table_header (uiout, width, alignment, colhdr);
  }
  
  void
--- 327,335 ----
  		    "table header must be specified after table_begin \
  and before table_body.");
  
!   append_header_to_list (uiout, width, alignment, col_name, colhdr);
  
!   uo_table_header (uiout, width, alignment, col_name, colhdr);
  }
  
  void
*************** default_table_end (struct ui_out *uiout)
*** 729,734 ****
--- 733,739 ----
  
  static void
  default_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
+ 		      const char *col_name,
  		      const char *colhdr)
  {
  }
*************** uo_table_end (struct ui_out *uiout)
*** 837,847 ****
  
  void
  uo_table_header (struct ui_out *uiout, int width, enum ui_align align,
  		 const char *colhdr)
  {
    if (!uiout->impl->table_header)
      return;
!   uiout->impl->table_header (uiout, width, align, colhdr);
  }
  
  void
--- 842,853 ----
  
  void
  uo_table_header (struct ui_out *uiout, int width, enum ui_align align,
+ 		 const char *col_name,
  		 const char *colhdr)
  {
    if (!uiout->impl->table_header)
      return;
!   uiout->impl->table_header (uiout, width, align, col_name, colhdr);
  }
  
  void
*************** static void
*** 972,977 ****
--- 978,984 ----
  append_header_to_list (struct ui_out *uiout,
  		       int width,
  		       int alignment,
+ 		       const char *col_name,
  		       const char *colhdr)
  {
    struct ui_out_hdr *temphdr;
*************** append_header_to_list (struct ui_out *ui
*** 981,990 ****
    temphdr->alignment = alignment;
    /* we have to copy the column title as the original may be an automatic */
    if (colhdr != NULL)
!     {
!       temphdr->colhdr = xmalloc (strlen (colhdr) + 1);
!       strcpy (temphdr->colhdr, colhdr);
!     }
    temphdr->next = NULL;
    if (uiout->headerfirst == NULL)
      {
--- 988,1000 ----
    temphdr->alignment = alignment;
    /* we have to copy the column title as the original may be an automatic */
    if (colhdr != NULL)
!     temphdr->colhdr = xstrdup (colhdr);
!   else
!     temphdr->colhdr = NULL;
!   if (col_name != NULL)
!     temphdr->col_name = xstrdup (colhdr);
!   else
!     temphdr->col_name = xstrdup (colhdr);
    temphdr->next = NULL;
    if (uiout->headerfirst == NULL)
      {
Index: ui-out.h
===================================================================
RCS file: /cvs/src/src/gdb/ui-out.h,v
retrieving revision 1.13
diff -p -r1.13 ui-out.h
*** ui-out.h	2001/06/19 16:19:15	1.13
--- ui-out.h	2001/06/21 15:29:55
*************** extern void ui_out_table_begin (struct u
*** 93,99 ****
  				int nr_rows, const char *tblid);
  
  extern void ui_out_table_header (struct ui_out *uiout, int width,
! 				 enum ui_align align, const char *colhdr);
  
  extern void ui_out_table_body (struct ui_out *uiout);
  
--- 93,100 ----
  				int nr_rows, const char *tblid);
  
  extern void ui_out_table_header (struct ui_out *uiout, int width,
! 				 enum ui_align align, const char *col_name,
! 				 const char *colhdr);
  
  extern void ui_out_table_body (struct ui_out *uiout);
  
*************** typedef void (table_begin_ftype) (struct
*** 197,203 ****
  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,
  				   const char *colhdr);
  /* Note: level 0 is the top-level so LEVEL is always greater than
     zero. */
--- 198,204 ----
  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, const char *col_name,
  				   const char *colhdr);
  /* Note: level 0 is the top-level so LEVEL is always greater than
     zero. */
Index: mi/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/mi/ChangeLog,v
retrieving revision 1.28
diff -p -r1.28 ChangeLog
*** ChangeLog	2001/06/19 16:19:16	1.28
--- ChangeLog	2001/06/21 15:29:56
***************
*** 1,3 ****
--- 1,7 ----
+ 2001-06-20  Andrew Cagney  <ac131313@redhat.com>
+ 
+ 	* mi-out.c (mi_table_header): Add parameter ``col_name''.
+ 
  2001-06-18  Andrew Cagney  <ac131313@redhat.com>
  
  	* mi-out.c: Include "gdb_assert.h".
Index: mi/mi-out.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-out.c,v
retrieving revision 1.15
diff -p -r1.15 mi-out.c
*** mi-out.c	2001/06/19 16:19:16	1.15
--- mi-out.c	2001/06/21 15:29:56
*************** static void mi_table_begin (struct ui_ou
*** 44,50 ****
  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,
  			     const char *colhdr);
  static void mi_begin (struct ui_out *uiout, enum ui_out_type type,
  		      int level, const char *id);
--- 44,50 ----
  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, const char *col_name,
  			     const char *colhdr);
  static void mi_begin (struct ui_out *uiout, enum ui_out_type type,
  		      int level, const char *id);
*************** mi_table_end (struct ui_out *uiout)
*** 138,143 ****
--- 138,144 ----
  
  void
  mi_table_header (struct ui_out *uiout, int width, int alignment,
+ 		 const char *col_name,
  		 const char *colhdr)
  {
    struct ui_out_data *data = ui_out_data (uiout);

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