#include "ctf-parser.h"
#include "ctf-ast.h"
-#define printf_dbg(fmt, args...) fprintf(stderr, "%s: " fmt, __func__, ## args)
+#define fprintf_dbg(fd, fmt, args...) fprintf(fd, "%s: " fmt, __func__, ## args)
static
void print_tabs(FILE *fd, int depth)
fprintf(fd, "bool");
break;
case TYPESPEC_COMPLEX:
- fprintf(fd, "complex");
+ fprintf(fd, "_Complex");
+ break;
+ case TYPESPEC_IMAGINARY:
+ fprintf(fd, "_Imaginary");
break;
case TYPESPEC_CONST:
fprintf(fd, "const");
print_tabs(fd, depth);
fprintf(fd, "</type_declarator>\n");
}
- if (node->u.type_declarator.u.nested.length) {
+ if (!cds_list_empty(&node->u.type_declarator.u.nested.length)) {
print_tabs(fd, depth);
fprintf(fd, "<length>\n");
- ret = ctf_visitor_print_xml(fd, depth + 1,
- node->u.type_declarator.u.nested.length);
+ }
+ cds_list_for_each_entry(iter, &node->u.type_declarator.u.nested.length,
+ siblings) {
+ ret = ctf_visitor_print_xml(fd, depth + 1, iter);
if (ret)
return ret;
+ }
+ if (!cds_list_empty(&node->u.type_declarator.u.nested.length)) {
print_tabs(fd, depth);
fprintf(fd, "</length>\n");
}
fprintf(fd, "<enum >\n");
depth++;
- if (node->u._enum.container_type) {
+ if (!cds_list_empty(&node->u._enum.container_type)) {
print_tabs(fd, depth);
fprintf(fd, "<container_type>\n");
- ret = ctf_visitor_print_xml(fd, depth + 1, node->u._enum.container_type);
+ }
+
+ cds_list_for_each_entry(iter, &node->u._enum.container_type,
+ siblings) {
+ ret = ctf_visitor_print_xml(fd, depth + 1, iter);
if (ret)
return ret;
+ }
+ if (!cds_list_empty(&node->u._enum.container_type)) {
print_tabs(fd, depth);
fprintf(fd, "</container_type>\n");
}