7 * Copyright 2011-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
23 #include <babeltrace/list.h>
39 NODE_UNARY_EXPRESSION
,
42 NODE_TYPEALIAS_TARGET
,
47 NODE_TYPE_SPECIFIER_LIST
,
56 NODE_STRUCT_OR_VARIANT_DECLARATION
,
65 * Parent node is only set on demand by specific visitor.
67 struct ctf_node
*parent
;
68 struct bt_list_head siblings
;
69 struct bt_list_head tmp_head
;
70 struct bt_list_head gc
;
78 * Children nodes are ctf_expression, typedef,
79 * typealias and type_specifier_list.
81 struct bt_list_head declaration_list
;
82 struct bt_list_head trace
;
83 struct bt_list_head env
;
84 struct bt_list_head stream
;
85 struct bt_list_head event
;
86 struct bt_list_head clock
;
90 * Children nodes are ctf_expression, typedef,
91 * typealias and type_specifier_list.
93 struct bt_list_head declaration_list
;
97 * Children nodes are ctf_expression, typedef,
98 * typealias and type_specifier_list.
100 struct bt_list_head declaration_list
;
104 * Children nodes are ctf_expression, typedef,
105 * typealias and type_specifier_list.
107 struct bt_list_head declaration_list
;
111 * Children nodes are ctf_expression, typedef,
112 * typealias and type_specifier_list.
114 struct bt_list_head declaration_list
;
118 * Children nodes are ctf_expression, typedef,
119 * typealias and type_specifier_list.
121 struct bt_list_head declaration_list
;
124 struct bt_list_head left
; /* Should be string */
125 struct bt_list_head right
; /* Unary exp. or type */
131 UNARY_SIGNED_CONSTANT
,
132 UNARY_UNSIGNED_CONSTANT
,
138 * string for identifier, id_type, keywords,
139 * string literals and character constants.
142 int64_t signed_constant
;
143 uint64_t unsigned_constant
;
144 struct ctf_node
*sbrac_exp
;
145 struct ctf_node
*nested_exp
;
148 UNARY_LINK_UNKNOWN
= 0,
155 struct ctf_node
*type_specifier_list
;
156 struct bt_list_head type_declarators
;
158 /* new type is "alias", existing type "target" */
160 struct ctf_node
*type_specifier_list
;
161 struct bt_list_head type_declarators
;
164 struct ctf_node
*type_specifier_list
;
165 struct bt_list_head type_declarators
;
168 struct ctf_node
*target
;
169 struct ctf_node
*alias
;
173 TYPESPEC_UNKNOWN
= 0,
188 TYPESPEC_FLOATING_POINT
,
195 /* For struct, variant and enum */
196 struct ctf_node
*node
;
200 /* list of type_specifier */
201 struct bt_list_head head
;
202 } type_specifier_list
;
204 unsigned int const_qualifier
;
207 struct bt_list_head pointers
;
210 TYPEDEC_ID
, /* identifier */
211 TYPEDEC_NESTED
, /* (), array or sequence */
216 /* typedec has no pointer list */
217 struct ctf_node
*type_declarator
;
219 * unary expression (value) or
220 * type_specifier_list.
222 struct bt_list_head length
;
223 /* for abstract type declarator */
224 unsigned int abstract_array
;
227 struct ctf_node
*bitfield_len
;
230 /* Children nodes are ctf_expression. */
231 struct bt_list_head expressions
;
234 /* Children nodes are ctf_expression. */
235 struct bt_list_head expressions
;
238 /* Children nodes are ctf_expression. */
239 struct bt_list_head expressions
;
244 * Range list or single value node. Contains unary
247 struct bt_list_head values
;
252 * Either NULL, or points to unary expression or
253 * type_specifier_list.
255 struct ctf_node
*container_type
;
256 struct bt_list_head enumerator_list
;
260 struct ctf_node
*type_specifier_list
;
261 struct bt_list_head type_declarators
;
262 } struct_or_variant_declaration
;
266 /* list of typedef, typealias and declarations */
267 struct bt_list_head declaration_list
;
272 /* list of typedef, typealias and declarations */
273 struct bt_list_head declaration_list
;
275 struct bt_list_head min_align
; /* align() attribute */
281 struct ctf_node root
;
282 struct bt_list_head allocated_nodes
;
285 const char *node_type(struct ctf_node
*node
);
289 int ctf_visitor_print_xml(FILE *fd
, int depth
, struct ctf_node
*node
);
290 int ctf_visitor_semantic_check(FILE *fd
, int depth
, struct ctf_node
*node
);
291 int ctf_visitor_parent_links(FILE *fd
, int depth
, struct ctf_node
*node
);
292 int ctf_visitor_construct_metadata(FILE *fd
, int depth
, struct ctf_node
*node
,
293 struct ctf_trace
*trace
, int byte_order
);
295 #endif /* _CTF_AST_H */