X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fmetadata%2Fctf-visitor-xml.c;h=0276f836806fa8a1f97d7c03d8a22044adee0821;hp=7115126f980d6a6b0a8021e203fd4d1b4fa0228d;hb=c462e188f3e7819c7bc74f671038cdbf36e8c3c0;hpb=98df1c9fb24d5e7e10bf628692011e130e0d8339 diff --git a/formats/ctf/metadata/ctf-visitor-xml.c b/formats/ctf/metadata/ctf-visitor-xml.c index 7115126f..0276f836 100644 --- a/formats/ctf/metadata/ctf-visitor-xml.c +++ b/formats/ctf/metadata/ctf-visitor-xml.c @@ -14,6 +14,14 @@ * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ #include @@ -24,7 +32,7 @@ #include #include #include -#include +#include #include #include "ctf-scanner.h" #include "ctf-parser.h" @@ -76,15 +84,15 @@ int ctf_visitor_print_unary_expression(FILE *fd, int depth, struct ctf_node *nod break; case UNARY_SIGNED_CONSTANT: print_tabs(fd, depth); - fprintf(fd, "u.unary_expression.u.signed_constant); - fprintf(fd, " />\n"); + fprintf(fd, "\" />\n"); break; case UNARY_UNSIGNED_CONSTANT: print_tabs(fd, depth); - fprintf(fd, "u.unary_expression.u.signed_constant); - fprintf(fd, " />\n"); + fprintf(fd, "\" />\n"); break; case UNARY_SBRAC: print_tabs(fd, depth); @@ -124,7 +132,7 @@ int ctf_visitor_print_type_specifier_list(FILE *fd, int depth, struct ctf_node * print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.type_specifier_list.head, siblings) { + bt_list_for_each_entry(iter, &node->u.type_specifier_list.head, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -137,6 +145,7 @@ int ctf_visitor_print_type_specifier_list(FILE *fd, int depth, struct ctf_node * static int ctf_visitor_print_type_specifier(FILE *fd, int depth, struct ctf_node *node) { + int ret; print_tabs(fd, depth); switch (node->u.type_specifier.type) { @@ -154,7 +163,7 @@ int ctf_visitor_print_type_specifier(FILE *fd, int depth, struct ctf_node *node) case TYPESPEC_IMAGINARY: case TYPESPEC_CONST: case TYPESPEC_ID_TYPE: - fprintf(fd, "u.type_specifier.node); + ret = ctf_visitor_print_xml(fd, depth, node->u.type_specifier.node); + if (ret) + return ret; + break; case TYPESPEC_UNKNOWN: default: fprintf(stderr, "[error] %s: unknown type specifier %d\n", __func__, @@ -252,9 +264,9 @@ int ctf_visitor_print_type_specifier(FILE *fd, int depth, struct ctf_node *node) case TYPESPEC_STRUCT: case TYPESPEC_VARIANT: case TYPESPEC_ENUM: + depth--; print_tabs(fd, depth); fprintf(fd, "\n"); - depth--; break; case TYPESPEC_UNKNOWN: default: @@ -276,10 +288,10 @@ int ctf_visitor_print_type_declarator(FILE *fd, int depth, struct ctf_node *node fprintf(fd, "\n"); depth++; - if (!cds_list_empty(&node->u.type_declarator.pointers)) { + if (!bt_list_empty(&node->u.type_declarator.pointers)) { print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.type_declarator.pointers, + bt_list_for_each_entry(iter, &node->u.type_declarator.pointers, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) @@ -293,7 +305,7 @@ int ctf_visitor_print_type_declarator(FILE *fd, int depth, struct ctf_node *node case TYPEDEC_ID: if (node->u.type_declarator.u.id) { print_tabs(fd, depth); - fprintf(fd, "u.type_declarator.u.id); fprintf(fd, "\" />\n"); } @@ -309,10 +321,15 @@ int ctf_visitor_print_type_declarator(FILE *fd, int depth, struct ctf_node *node print_tabs(fd, depth); fprintf(fd, "\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, "\n"); + print_tabs(fd, depth); + fprintf(fd, "\n"); + } else if (!bt_list_empty(&node->u.type_declarator.u.nested.length)) { print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.type_declarator.u.nested.length, + bt_list_for_each_entry(iter, &node->u.type_declarator.u.nested.length, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) @@ -321,12 +338,6 @@ int ctf_visitor_print_type_declarator(FILE *fd, int depth, struct ctf_node *node print_tabs(fd, depth); fprintf(fd, "\n"); } - if (node->u.type_declarator.u.nested.abstract_array) { - print_tabs(fd, depth); - fprintf(fd, "\n"); - print_tabs(fd, depth); - fprintf(fd, "\n"); - } if (node->u.type_declarator.bitfield_len) { print_tabs(fd, depth); fprintf(fd, "\n"); @@ -360,23 +371,23 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) case NODE_ROOT: print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.root.declaration_list, + bt_list_for_each_entry(iter, &node->u.root.declaration_list, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; } - cds_list_for_each_entry(iter, &node->u.root.trace, siblings) { + bt_list_for_each_entry(iter, &node->u.root.trace, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; } - cds_list_for_each_entry(iter, &node->u.root.stream, siblings) { + bt_list_for_each_entry(iter, &node->u.root.stream, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; } - cds_list_for_each_entry(iter, &node->u.root.event, siblings) { + bt_list_for_each_entry(iter, &node->u.root.event, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -388,7 +399,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) case NODE_EVENT: print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.event.declaration_list, siblings) { + bt_list_for_each_entry(iter, &node->u.event.declaration_list, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -399,7 +410,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) case NODE_STREAM: print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.stream.declaration_list, siblings) { + bt_list_for_each_entry(iter, &node->u.stream.declaration_list, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -407,10 +418,21 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) print_tabs(fd, depth); fprintf(fd, "\n"); break; + case NODE_ENV: + print_tabs(fd, depth); + fprintf(fd, "\n"); + bt_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, "\n"); + break; case NODE_TRACE: print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.trace.declaration_list, siblings) { + bt_list_for_each_entry(iter, &node->u.trace.declaration_list, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -418,6 +440,29 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) print_tabs(fd, depth); fprintf(fd, "\n"); break; + case NODE_CLOCK: + print_tabs(fd, depth); + fprintf(fd, "\n"); + bt_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, "\n"); + break; + case NODE_CALLSITE: + print_tabs(fd, depth); + fprintf(fd, "\n"); + bt_list_for_each_entry(iter, &node->u.callsite.declaration_list, siblings) { + ret = ctf_visitor_print_xml(fd, depth + 1, iter); + if (ret) + return ret; + } + print_tabs(fd, depth); + fprintf(fd, "\n"); + break; + case NODE_CTF_EXPRESSION: print_tabs(fd, depth); @@ -425,7 +470,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) depth++; print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.ctf_expression.left, siblings) { + bt_list_for_each_entry(iter, &node->u.ctf_expression.left, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -436,7 +481,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.ctf_expression.right, siblings) { + bt_list_for_each_entry(iter, &node->u.ctf_expression.right, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -460,7 +505,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u._typedef.type_declarators, siblings) { + bt_list_for_each_entry(iter, &node->u._typedef.type_declarators, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -482,7 +527,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.typealias_target.type_declarators, siblings) { + bt_list_for_each_entry(iter, &node->u.typealias_target.type_declarators, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -505,7 +550,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.typealias_alias.type_declarators, siblings) { + bt_list_for_each_entry(iter, &node->u.typealias_alias.type_declarators, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -557,7 +602,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) case NODE_FLOATING_POINT: print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.floating_point.expressions, siblings) { + bt_list_for_each_entry(iter, &node->u.floating_point.expressions, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -568,7 +613,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) case NODE_INTEGER: print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.integer.expressions, siblings) { + bt_list_for_each_entry(iter, &node->u.integer.expressions, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -579,7 +624,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) case NODE_STRING: print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.string.expressions, siblings) { + bt_list_for_each_entry(iter, &node->u.string.expressions, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -593,7 +638,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) if (node->u.enumerator.id) fprintf(fd, " id=\"%s\"", node->u.enumerator.id); fprintf(fd, ">\n"); - cds_list_for_each_entry(iter, &node->u.enumerator.values, siblings) { + bt_list_for_each_entry(iter, &node->u.enumerator.values, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -622,7 +667,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u._enum.enumerator_list, siblings) { + bt_list_for_each_entry(iter, &node->u._enum.enumerator_list, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -642,7 +687,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u.struct_or_variant_declaration.type_declarators, siblings) { + bt_list_for_each_entry(iter, &node->u.struct_or_variant_declaration.type_declarators, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -658,7 +703,7 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) if (node->u.variant.choice) fprintf(fd, " choice=\"%s\"", node->u.variant.choice); fprintf(fd, ">\n"); - cds_list_for_each_entry(iter, &node->u.variant.declaration_list, siblings) { + bt_list_for_each_entry(iter, &node->u.variant.declaration_list, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; @@ -673,17 +718,17 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) node->u._struct.name); else fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u._struct.declaration_list, siblings) { + bt_list_for_each_entry(iter, &node->u._struct.declaration_list, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret; } print_tabs(fd, depth); fprintf(fd, "\n"); - if (!cds_list_empty(&node->u._struct.min_align)) { + if (!bt_list_empty(&node->u._struct.min_align)) { print_tabs(fd, depth); fprintf(fd, "\n"); - cds_list_for_each_entry(iter, &node->u._struct.min_align, siblings) { + bt_list_for_each_entry(iter, &node->u._struct.min_align, siblings) { ret = ctf_visitor_print_xml(fd, depth + 1, iter); if (ret) return ret;