Add environment (env {}) parser-level support
[babeltrace.git] / formats / ctf / metadata / ctf-visitor-xml.c
index 49fa992817906dfd66d93d14b33b1de3794f9a42..66b375615f925915fcaf25e74f58bead0fe4ac74 100644 (file)
@@ -24,7 +24,7 @@
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <babeltrace/babeltrace.h>
+#include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/list.h>
 #include "ctf-scanner.h"
 #include "ctf-parser.h"
@@ -313,7 +313,12 @@ int ctf_visitor_print_type_declarator(FILE *fd, int depth, struct ctf_node *node
                        print_tabs(fd, depth);
                        fprintf(fd, "</type_declarator>\n");
                }
-               if (!cds_list_empty(&node->u.type_declarator.u.nested.length)) {
+               if (node->u.type_declarator.u.nested.abstract_array) {
+                       print_tabs(fd, depth);
+                       fprintf(fd, "<length>\n");
+                       print_tabs(fd, depth);
+                       fprintf(fd, "</length>\n");
+               } else if (!cds_list_empty(&node->u.type_declarator.u.nested.length)) {
                        print_tabs(fd, depth);
                        fprintf(fd, "<length>\n");
                        cds_list_for_each_entry(iter, &node->u.type_declarator.u.nested.length,
@@ -325,12 +330,6 @@ int ctf_visitor_print_type_declarator(FILE *fd, int depth, struct ctf_node *node
                        print_tabs(fd, depth);
                        fprintf(fd, "</length>\n");
                }
-               if (node->u.type_declarator.u.nested.abstract_array) {
-                       print_tabs(fd, depth);
-                       fprintf(fd, "<length>\n");
-                       print_tabs(fd, depth);
-                       fprintf(fd, "</length>\n");
-               }
                if (node->u.type_declarator.bitfield_len) {
                        print_tabs(fd, depth);
                        fprintf(fd, "<bitfield_len>\n");
@@ -411,6 +410,17 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node)
                print_tabs(fd, depth);
                fprintf(fd, "</stream>\n");
                break;
+       case NODE_ENV:
+               print_tabs(fd, depth);
+               fprintf(fd, "<env>\n");
+               cds_list_for_each_entry(iter, &node->u.env.declaration_list, siblings) {
+                       ret = ctf_visitor_print_xml(fd, depth + 1, iter);
+                       if (ret)
+                               return ret;
+               }
+               print_tabs(fd, depth);
+               fprintf(fd, "</env>\n");
+               break;
        case NODE_TRACE:
                print_tabs(fd, depth);
                fprintf(fd, "<trace>\n");
@@ -422,6 +432,18 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node)
                print_tabs(fd, depth);
                fprintf(fd, "</trace>\n");
                break;
+       case NODE_CLOCK:
+               print_tabs(fd, depth);
+               fprintf(fd, "<clock>\n");
+               cds_list_for_each_entry(iter, &node->u.clock.declaration_list, siblings) {
+                       ret = ctf_visitor_print_xml(fd, depth + 1, iter);
+                       if (ret)
+                               return ret;
+               }
+               print_tabs(fd, depth);
+               fprintf(fd, "</clock>\n");
+               break;
+
 
        case NODE_CTF_EXPRESSION:
                print_tabs(fd, depth);
This page took 0.023492 seconds and 4 git commands to generate.