Update pretty-print
[babeltrace.git] / formats / ctf-text / types / integer.c
index 7dcca27e1f364c15417584ff9d0d0d9c6bc841f5..f25f4540cbc8e67348962e46a06009a657d354fd 100644 (file)
@@ -21,7 +21,7 @@
 #include <inttypes.h>
 #include <stdint.h>
 
-void ctf_text_integer_write(struct stream_pos *ppos, struct definition *definition)
+int ctf_text_integer_write(struct stream_pos *ppos, struct definition *definition)
 {
        struct definition_integer *integer_definition =
                container_of(definition, struct definition_integer, p);
@@ -30,15 +30,36 @@ void ctf_text_integer_write(struct stream_pos *ppos, struct definition *definiti
        struct ctf_text_stream_pos *pos = ctf_text_pos(ppos);
 
        if (pos->dummy)
-               return;
-       print_pos_tabs(pos);
+               return 0;
+
+       if (definition->index != 0 && definition->index != INT_MAX)
+               fprintf(pos->fp, ",");
+       if (definition->index != INT_MAX)
+               fprintf(pos->fp, " ");
+       if (pos->print_names)
+               fprintf(pos->fp, "%s = ",
+                       g_quark_to_string(definition->name));
+
+       //print_pos_tabs(pos);
+
+       if (!compare_definition_path(definition, g_quark_from_static_string("stream.event.header.timestamp"))) {
+               if (!pos->print_names)
+                       fprintf(pos->fp, "[%" PRIu64 "]",
+                               integer_definition->value._unsigned);
+               else
+                       fprintf(pos->fp, "%" PRIu64,
+                               integer_definition->value._unsigned);
+               return 0;
+       }
+
        if (!integer_declaration->signedness) {
-               fprintf(pos->fp, "%" PRIu64" (0x%" PRIX64 ")\n",
+               fprintf(pos->fp, "%" PRIu64" (0x%" PRIX64 ")",
                        integer_definition->value._unsigned,
                        integer_definition->value._unsigned);
        } else {
-               fprintf(pos->fp, "%" PRId64" (0x%" PRIX64 ")\n",
+               fprintf(pos->fp, "%" PRId64" (0x%" PRIX64 ")",
                        integer_definition->value._signed,
                        integer_definition->value._signed);
        }
+       return 0;
 }
This page took 0.026015 seconds and 4 git commands to generate.