| www.delorie.com/gnu/docs/gdb/gdbint_21.html | search |
![]() Buy the book! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section introduces ui_out routines for building lists,
tuples and tables. The routines to output the actual data items
(fields) are presented in the next section.
To recap: A tuple is a sequence of fields, each field containing information about an object; a list is a sequence of fields where each field describes an identical object.
Use the table functions when your output consists of a list of rows (tuples) and the console output should include a heading. Use this even when you are listing just one object but you still want the header.
Tables can not be nested. Tuples and lists can be nested up to a maximum of five levels.
The overall structure of the table output code is something like this:
ui_out_table_begin
ui_out_table_header
...
ui_out_table_body
ui_out_tuple_begin
ui_out_field_*
...
ui_out_tuple_end
...
ui_out_table_end
|
Here is the description of table-, tuple- and list-related ui_out
functions:
ui_out_table_begin marks the beginning of the output
of a table. It should always be called before any other ui_out
function for a given table. nbrofcols is the number of columns in
the table. nr_rows is the number of rows in the table.
tblid is an optional string identifying the table. The string
pointed to by tblid is copied by the implementation of
ui_out_table_begin, so the application can free the string if it
was malloced.
The companion function ui_out_table_end, described below, marks
the end of the table's output.
ui_out_table_header provides the header information for a single
table column. You call this function several times, one each for every
column of the table, after ui_out_table_begin, but before
ui_out_table_body.
The value of width gives the column width in characters. The
value of alignment is one of left, center, and
right, and it specifies how to align the header: left-justify,
center, or right-justify it. colhdr points to a string that
specifies the column header; the implementation copies that string, so
column header strings in malloced storage can be freed after the
call.
There should be exactly one call to ui_out_table_end for each
call to ui_out_table_begin, otherwise the ui_out functions
will signal an internal error.
The output of the tuples that represent the table rows must follow the
call to ui_out_table_body and precede the call to
ui_out_table_end. You build a tuple by calling
ui_out_tuple_begin and ui_out_tuple_end, with suitable
calls to functions which actually output fields between them.
malloced storage can be freed
after the call.
ui_out_tuple_end for each call to
ui_out_tuple_begin, otherwise an internal GDB error will
be signaled.
struct cleanup *old_cleanup;
ui_out_tuple_begin (uiout, "...");
old_cleanup = make_cleanup ((void(*)(void *)) ui_out_tuple_end,
uiout);
|
malloced storage can be freed
after the call.
ui_out_list_end for each call to
ui_out_list_begin, otherwise an internal GDB error will
be signaled.
make_cleanup_ui_out_tuple_begin_end, this function
opens a list and then establishes cleanup (see section Cleanups)
that will close the list.list.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |