prettify output
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 7 May 2011 05:27:01 +0000 (01:27 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 7 May 2011 05:27:01 +0000 (01:27 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
converter/babeltrace-lib.c
converter/babeltrace.c
formats/ctf-text/types/struct.c
formats/ctf/metadata/ctf-parser-test.c
formats/ctf/metadata/ctf-visitor-generate-io-struct.c
formats/ctf/metadata/ctf-visitor-parent-links.c
formats/ctf/metadata/ctf-visitor-semantic-validator.c
formats/ctf/metadata/ctf-visitor-xml.c
tests/test-dummytrace.c

index 5be268ccf4371b22e94a2e28e3d1898ecc009835..bd0e11e1dd795d3da0a8d9f8b10abba9ebeb0c2a 100644 (file)
@@ -38,6 +38,9 @@ int convert_event(struct ctf_text_stream_pos *sout,
        if (sin->pos.offset == -EOF)
                return -EOF;
 
        if (sin->pos.offset == -EOF)
                return -EOF;
 
+       /* Hide event payload struct brackets */
+       sout->depth = -1;
+
        /* Read and print event header */
        if (stream_class->event_header) {
                generic_rw(&sin->pos.parent, &stream_class->event_header->p);
        /* Read and print event header */
        if (stream_class->event_header) {
                generic_rw(&sin->pos.parent, &stream_class->event_header->p);
index c0c6541af5b41b6085593b5c09605460809b101b..c888ec60dc05f71cbf4142ad1c270e0980043021 100644 (file)
@@ -171,13 +171,13 @@ int main(int argc, char **argv)
                opt_output_format ? : "ctf");
 
        if (!opt_input_format) {
                opt_output_format ? : "ctf");
 
        if (!opt_input_format) {
-               fprintf(stdout, "Error: input format autodetection not implemented yet.\n\n");
+               fprintf(stdout, "[error] Input format autodetection not implemented yet.\n\n");
                usage(stdout);
                exit(EXIT_FAILURE);
        }
        fmt_read = bt_lookup_format(g_quark_from_static_string(opt_input_format));
        if (!fmt_read) {
                usage(stdout);
                exit(EXIT_FAILURE);
        }
        fmt_read = bt_lookup_format(g_quark_from_static_string(opt_input_format));
        if (!fmt_read) {
-               fprintf(stdout, "Error: format \"%s\" is not supported.\n\n",
+               fprintf(stdout, "[error] Format \"%s\" is not supported.\n\n",
                        opt_input_format);
                exit(EXIT_FAILURE);
        }
                        opt_input_format);
                exit(EXIT_FAILURE);
        }
@@ -185,14 +185,14 @@ int main(int argc, char **argv)
                opt_output_format = "ctf";
        fmt_write = bt_lookup_format(g_quark_from_static_string(opt_output_format));
        if (!fmt_write) {
                opt_output_format = "ctf";
        fmt_write = bt_lookup_format(g_quark_from_static_string(opt_output_format));
        if (!fmt_write) {
-               fprintf(stdout, "Error: format \"%s\" is not supported.\n\n",
+               fprintf(stdout, "[error] format \"%s\" is not supported.\n\n",
                        opt_output_format);
                exit(EXIT_FAILURE);
        }
 
        td_read = fmt_read->open_trace(opt_input_path, O_RDONLY);
        if (!td_read) {
                        opt_output_format);
                exit(EXIT_FAILURE);
        }
 
        td_read = fmt_read->open_trace(opt_input_path, O_RDONLY);
        if (!td_read) {
-               fprintf(stdout, "Error opening trace \"%s\" for reading.\n\n",
+               fprintf(stdout, "[error] opening trace \"%s\" for reading.\n\n",
                        opt_input_path);
                goto error_td_read;
        }
                        opt_input_path);
                goto error_td_read;
        }
index cd63fe99551cbaaf4f45d210f10772011856cc2f..4270a21afa65bb99e87b6e5d8955c026e6606a56 100644 (file)
@@ -24,14 +24,18 @@ void ctf_text_struct_write(struct stream_pos *ppos, struct definition *definitio
        struct ctf_text_stream_pos *pos = ctf_text_pos(ppos);
 
        if (!pos->dummy) {
        struct ctf_text_stream_pos *pos = ctf_text_pos(ppos);
 
        if (!pos->dummy) {
-               print_pos_tabs(pos);
-               fprintf(pos->fp, "{\n");
+               if (pos->depth >= 0) {
+                       print_pos_tabs(pos);
+                       fprintf(pos->fp, "{\n");
+               }
                pos->depth++;
        }
        struct_rw(ppos, definition);
        if (!pos->dummy) {
                pos->depth--;
                pos->depth++;
        }
        struct_rw(ppos, definition);
        if (!pos->dummy) {
                pos->depth--;
-               print_pos_tabs(pos);
-               fprintf(pos->fp, "}\n");
+               if (pos->depth >= 0) {
+                       print_pos_tabs(pos);
+                       fprintf(pos->fp, "}\n");
+               }
        }
 }
        }
 }
index fdde409e0ee114bbb98ecc4f230e9dbc5faddeac..ab4bc30ced547f83052351e33c52078264b6802d 100644 (file)
@@ -21,6 +21,7 @@
 #include <glib.h>
 #include <errno.h>
 #include <endian.h>
 #include <glib.h>
 #include <errno.h>
 #include <endian.h>
+#include <babeltrace/babeltrace.h>
 #include <babeltrace/ctf/metadata.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
 #include <babeltrace/ctf/metadata.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
@@ -35,6 +36,7 @@ int main(int argc, char **argv)
        int ret = 0;
 
        babeltrace_debug = 1;
        int ret = 0;
 
        babeltrace_debug = 1;
+       babeltrace_verbose = 1;
        scanner = ctf_scanner_alloc(stdin);
        if (!scanner) {
                fprintf(stdout, "Error allocating scanner\n");
        scanner = ctf_scanner_alloc(stdin);
        if (!scanner) {
                fprintf(stdout, "Error allocating scanner\n");
index ca1a83dd47617910320f4d7393b765f774a88a57..033537e67d06325dde8de438c0a183005b148714 100644 (file)
@@ -25,6 +25,7 @@
 #include <inttypes.h>
 #include <endian.h>
 #include <errno.h>
 #include <inttypes.h>
 #include <endian.h>
 #include <errno.h>
+#include <babeltrace/babeltrace.h>
 #include <babeltrace/list.h>
 #include <babeltrace/types.h>
 #include <babeltrace/ctf/metadata.h>
 #include <babeltrace/list.h>
 #include <babeltrace/types.h>
 #include <babeltrace/ctf/metadata.h>
@@ -1963,7 +1964,7 @@ int ctf_visitor_construct_metadata(FILE *fd, int depth, struct ctf_node *node,
        int ret = 0;
        struct ctf_node *iter;
 
        int ret = 0;
        struct ctf_node *iter;
 
-       fprintf(fd, "CTF visitor: metadata construction... ");
+       printf_verbose("CTF visitor: metadata construction... ");
        trace->root_declaration_scope = new_declaration_scope(NULL);
        trace->byte_order = byte_order;
 
        trace->root_declaration_scope = new_declaration_scope(NULL);
        trace->byte_order = byte_order;
 
@@ -2011,6 +2012,6 @@ int ctf_visitor_construct_metadata(FILE *fd, int depth, struct ctf_node *node,
                        (int) node->type);
                return -EINVAL;
        }
                        (int) node->type);
                return -EINVAL;
        }
-       fprintf(fd, "done.\n");
+       printf_verbose("done.\n");
        return ret;
 }
        return ret;
 }
index 707f03a5c20af4e71fe626985ce68e97b958f9ee..49d067c6640c66bc97c2ab2f5436dd9e2d170604 100644 (file)
@@ -24,6 +24,7 @@
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
+#include <babeltrace/babeltrace.h>
 #include <babeltrace/list.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
 #include <babeltrace/list.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
index 6385b0bd3ffb2e76c61f3abe059083a8d53cd871..af55eb4861d7163463b2efb9af095506cc2dce10 100644 (file)
@@ -24,6 +24,7 @@
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
+#include <babeltrace/babeltrace.h>
 #include <babeltrace/list.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
 #include <babeltrace/list.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
@@ -862,15 +863,15 @@ int ctf_visitor_semantic_check(FILE *fd, int depth, struct ctf_node *node)
         * take the safe route and recreate them at each validation, just in
         * case the structure has changed.
         */
         * take the safe route and recreate them at each validation, just in
         * case the structure has changed.
         */
-       fprintf(fd, "CTF visitor: parent links creation... ");
+       printf_verbose("CTF visitor: parent links creation... ");
        ret = ctf_visitor_parent_links(fd, depth, node);
        if (ret)
                return ret;
        ret = ctf_visitor_parent_links(fd, depth, node);
        if (ret)
                return ret;
-       fprintf(fd, "done.\n");
-       fprintf(fd, "CTF visitor: semantic check... ");
+       printf_verbose("done.\n");
+       printf_verbose("CTF visitor: semantic check... ");
        ret = _ctf_visitor_semantic_check(fd, depth, node);
        if (ret)
                return ret;
        ret = _ctf_visitor_semantic_check(fd, depth, node);
        if (ret)
                return ret;
-       fprintf(fd, "done.\n");
+       printf_verbose("done.\n");
        return ret;
 }
        return ret;
 }
index 96145f8b73bf249d797218413ac80dcc942dd457..f73c367193c4030d585b9d4fe16643f5687803a1 100644 (file)
@@ -24,6 +24,7 @@
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
+#include <babeltrace/babeltrace.h>
 #include <babeltrace/list.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
 #include <babeltrace/list.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
index ca79115ff782e407c763295cfdc4683d5bf986c3..06bb695b6434266a160d2e2a97377f40162cacfc 100644 (file)
@@ -32,7 +32,7 @@
 #include <babeltrace/babeltrace.h>
 #include <babeltrace/ctf/types.h>
 
 #include <babeltrace/babeltrace.h>
 #include <babeltrace/ctf/types.h>
 
-int babeltrace_debug = 0;
+int babeltrace_debug, babeltrace_verbose;
 
 static uuid_t s_uuid;
 
 
 static uuid_t s_uuid;
 
This page took 0.028957 seconds and 4 git commands to generate.