int colno;
int width;
int alignment;
+ char *col_name;
char *colhdr;
struct ui_out_hdr *next;
};
/* These are the default implementation functions */
static void default_table_begin (struct ui_out *uiout, int nbrofcols,
- char *tblid);
+ int nr_rows, const char *tblid);
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);
+ enum ui_align alig, const char *col_name,
+ const char *colhdr);
static void default_begin (struct ui_out *uiout,
enum ui_out_type type,
int level, const char *id);
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);
+ enum ui_align alig,
+ const char *fldname,
+ int value);
static void default_field_skip (struct ui_out *uiout, int fldno, int width,
- enum ui_align alig, char *fldname);
+ enum ui_align alig,
+ const char *fldname);
static void default_field_string (struct ui_out *uiout, int fldno, int width,
- enum ui_align align, char *fldname,
+ enum ui_align align,
+ const char *fldname,
const char *string);
static void default_field_fmt (struct ui_out *uiout, int fldno,
int width, enum ui_align align,
- char *fldname, char *format, va_list args);
+ const char *fldname,
+ const char *format,
+ va_list args);
static void default_spaces (struct ui_out *uiout, int numspaces);
-static void default_text (struct ui_out *uiout, char *string);
-static void default_message (struct ui_out *uiout, int verbosity, char *format,
+static void default_text (struct ui_out *uiout, const char *string);
+static void default_message (struct ui_out *uiout, int verbosity,
+ const char *format,
va_list args);
static void default_wrap_hint (struct ui_out *uiout, char *identstring);
static void default_flush (struct ui_out *uiout);
/* These are the interfaces to implementation functions */
-static void uo_table_begin (struct ui_out *uiout, int nbrofcols, char *tblid);
+static void uo_table_begin (struct ui_out *uiout, int nbrofcols,
+ int nr_rows, const char *tblid);
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);
+ 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);
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);
+ enum ui_align align, const char *fldname, int value);
static void uo_field_skip (struct ui_out *uiout, int fldno, int width,
- enum ui_align align, char *fldname);
+ enum ui_align align, const char *fldname);
static void uo_field_string (struct ui_out *uiout, int fldno, int width,
- enum ui_align align, char *fldname, const char *string);
+ enum ui_align align, const char *fldname,
+ const char *string);
static void uo_field_fmt (struct ui_out *uiout, int fldno, int width,
- enum ui_align align, char *fldname,
- char *format, va_list args);
+ enum ui_align align, const char *fldname,
+ const char *format, va_list args);
static void uo_spaces (struct ui_out *uiout, int numspaces);
-static void uo_text (struct ui_out *uiout, char *string);
+static void uo_text (struct ui_out *uiout, const char *string);
static void uo_message (struct ui_out *uiout, int verbosity,
- char *format, va_list args);
+ const char *format, va_list args);
static void uo_wrap_hint (struct ui_out *uiout, char *identstring);
static void uo_flush (struct ui_out *uiout);
/* Prototypes for local functions */
extern void _initialize_ui_out (void);
-static void append_header_to_list (struct ui_out *uiout, int width, int alignment, char *colhdr);
+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);
/* Mark beginning of a table */
void
-ui_out_table_begin (struct ui_out *uiout, int nbrofcols, char *tblid)
+ui_out_table_begin (struct ui_out *uiout, int nbrofcols,
+ int nr_rows,
+ const char *tblid)
{
if (uiout->table_flag)
internal_error (__FILE__, __LINE__,
uiout->table_id = NULL;
clear_header_list (uiout);
- uo_table_begin (uiout, nbrofcols, uiout->table_id);
+ uo_table_begin (uiout, nbrofcols, nr_rows, uiout->table_id);
}
void
void
ui_out_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
- char *colhdr)
+ const char *col_name,
+ const char *colhdr)
{
if (!uiout->table_flag || uiout->body_flag)
internal_error (__FILE__, __LINE__,
"table header must be specified after table_begin \
and before table_body.");
- append_header_to_list (uiout, width, alignment, colhdr);
+ append_header_to_list (uiout, width, alignment, col_name, colhdr);
- uo_table_header (uiout, width, alignment, colhdr);
+ uo_table_header (uiout, width, alignment, col_name, colhdr);
}
void
}
void
-ui_out_list_begin (struct ui_out *uiout)
+ui_out_list_begin (struct ui_out *uiout,
+ const char *id)
{
- ui_out_begin (uiout, ui_out_type_list, NULL);
+ ui_out_begin (uiout, ui_out_type_list, id);
}
void
}
struct cleanup *
-make_cleanup_ui_out_list_begin_end (struct ui_out *uiout)
+make_cleanup_ui_out_list_begin_end (struct ui_out *uiout,
+ const char *id)
{
+ ui_out_list_begin (uiout, id);
return make_cleanup_ui_out_end (uiout, ui_out_type_list);
}
void
-ui_out_field_int (struct ui_out *uiout, char *fldname, int value)
+ui_out_field_int (struct ui_out *uiout,
+ const char *fldname,
+ int value)
{
int fldno;
int width;
}
void
-ui_out_field_core_addr (struct ui_out *uiout, char *fldname, CORE_ADDR address)
+ui_out_field_core_addr (struct ui_out *uiout,
+ const char *fldname,
+ CORE_ADDR address)
{
char addstr[20];
}
void
-ui_out_field_stream (struct ui_out *uiout, char *fldname, struct ui_stream *buf)
+ui_out_field_stream (struct ui_out *uiout,
+ const char *fldname,
+ struct ui_stream *buf)
{
long length;
char *buffer = ui_file_xstrdup (buf->stream, &length);
/* used to ommit a field */
void
-ui_out_field_skip (struct ui_out *uiout, char *fldname)
+ui_out_field_skip (struct ui_out *uiout,
+ const char *fldname)
{
int fldno;
int width;
void
ui_out_field_string (struct ui_out *uiout,
- char *fldname,
+ const char *fldname,
const char *string)
{
int fldno;
/* VARARGS */
void
-ui_out_field_fmt (struct ui_out *uiout, char *fldname, char *format,...)
+ui_out_field_fmt (struct ui_out *uiout,
+ const char *fldname,
+ const char *format, ...)
{
va_list args;
int fldno;
}
void
-ui_out_text (struct ui_out *uiout, char *string)
+ui_out_text (struct ui_out *uiout,
+ const char *string)
{
uo_text (uiout, string);
}
void
-ui_out_message (struct ui_out *uiout, int verbosity, char *format,...)
+ui_out_message (struct ui_out *uiout, int verbosity,
+ const char *format,...)
{
va_list args;
/* default gdb-out hook functions */
static void
-default_table_begin (struct ui_out *uiout, int nbrofcols, char *tblid)
+default_table_begin (struct ui_out *uiout, int nbrofcols,
+ int nr_rows,
+ const char *tblid)
{
}
static void
default_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
- char *colhdr)
+ const char *col_name,
+ const char *colhdr)
{
}
static void
default_field_int (struct ui_out *uiout, int fldno, int width,
- enum ui_align align, char *fldname, int value)
+ enum ui_align align,
+ const char *fldname, int value)
{
}
static void
default_field_skip (struct ui_out *uiout, int fldno, int width,
- enum ui_align align, char *fldname)
+ enum ui_align align, const char *fldname)
{
}
int fldno,
int width,
enum ui_align align,
- char *fldname,
+ const char *fldname,
const char *string)
{
}
static void
default_field_fmt (struct ui_out *uiout, int fldno, int width,
- enum ui_align align, char *fldname, char *format,
+ enum ui_align align,
+ const char *fldname,
+ const char *format,
va_list args)
{
}
}
static void
-default_text (struct ui_out *uiout, char *string)
+default_text (struct ui_out *uiout, const char *string)
{
}
static void
-default_message (struct ui_out *uiout, int verbosity, char *format,
+default_message (struct ui_out *uiout, int verbosity,
+ const char *format,
va_list args)
{
}
/* Interface to the implementation functions */
void
-uo_table_begin (struct ui_out *uiout, int nbrofcols, char *tblid)
+uo_table_begin (struct ui_out *uiout, int nbrofcols,
+ int nr_rows,
+ const char *tblid)
{
if (!uiout->impl->table_begin)
return;
- uiout->impl->table_begin (uiout, nbrofcols, tblid);
+ uiout->impl->table_begin (uiout, nbrofcols, nr_rows, tblid);
}
void
}
void
-uo_table_header (struct ui_out *uiout, int width, enum ui_align align, char *colhdr)
+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, colhdr);
+ uiout->impl->table_header (uiout, width, align, col_name, colhdr);
}
void
}
void
-uo_field_int (struct ui_out *uiout, int fldno, int width, enum ui_align align, char *fldname, int value)
+uo_field_int (struct ui_out *uiout, int fldno, int width, enum ui_align align,
+ const char *fldname,
+ int value)
{
if (!uiout->impl->field_int)
return;
}
void
-uo_field_skip (struct ui_out *uiout, int fldno, int width, enum ui_align align, char *fldname)
+uo_field_skip (struct ui_out *uiout, int fldno, int width, enum ui_align align,
+ const char *fldname)
{
if (!uiout->impl->field_skip)
return;
void
uo_field_string (struct ui_out *uiout, int fldno, int width,
- enum ui_align align, char *fldname, const char *string)
+ enum ui_align align,
+ const char *fldname,
+ const char *string)
{
if (!uiout->impl->field_string)
return;
}
void
-uo_field_fmt (struct ui_out *uiout, int fldno, int width, enum ui_align align, char *fldname, char *format, va_list args)
+uo_field_fmt (struct ui_out *uiout, int fldno, int width, enum ui_align align,
+ const char *fldname,
+ const char *format,
+ va_list args)
{
if (!uiout->impl->field_fmt)
return;
}
void
-uo_text (struct ui_out *uiout, char *string)
+uo_text (struct ui_out *uiout,
+ const char *string)
{
if (!uiout->impl->text)
return;
}
void
-uo_message (struct ui_out *uiout, int verbosity, char *format, va_list args)
+uo_message (struct ui_out *uiout, int verbosity,
+ const char *format,
+ va_list args)
{
if (!uiout->impl->message)
return;
append_header_to_list (struct ui_out *uiout,
int width,
int alignment,
- char *colhdr)
+ const char *col_name,
+ const char *colhdr)
{
struct ui_out_hdr *temphdr;
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->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)
{