Commit | Line | Data |
---|---|---|
d79865b9 MD |
1 | #ifndef _BABELTRACE_TYPES_H |
2 | #define _BABELTRACE_TYPES_H | |
3 | ||
4 | /* | |
5 | * BabelTrace | |
6 | * | |
fc93b2bd | 7 | * Type Header |
d79865b9 | 8 | * |
c054553d | 9 | * Copyright 2010, 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
d79865b9 | 10 | * |
ccd7e1c8 MD |
11 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
12 | * of this software and associated documentation files (the "Software"), to deal | |
13 | * in the Software without restriction, including without limitation the rights | |
14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
15 | * copies of the Software, and to permit persons to whom the Software is | |
16 | * furnished to do so, subject to the following conditions: | |
d79865b9 | 17 | * |
ccd7e1c8 MD |
18 | * The above copyright notice and this permission notice shall be included in |
19 | * all copies or substantial portions of the Software. | |
d79865b9 MD |
20 | */ |
21 | ||
bed864a7 | 22 | #include <babeltrace/align.h> |
d65d8abb | 23 | #include <babeltrace/list.h> |
4c8bfb7e MD |
24 | #include <stdbool.h> |
25 | #include <stdint.h> | |
26 | #include <limits.h> | |
bed864a7 | 27 | #include <string.h> |
4c8bfb7e | 28 | #include <glib.h> |
8eab883c | 29 | #include <assert.h> |
bed864a7 | 30 | |
11796b96 MD |
31 | /* Preallocate this many fields for structures */ |
32 | #define DEFAULT_NR_STRUCT_FIELDS 8 | |
33 | ||
aa6bffae | 34 | struct ctf_stream_class; |
dd2544fd | 35 | struct stream_pos; |
4c8bfb7e | 36 | struct format; |
e1151715 | 37 | struct definition; |
4c8bfb7e | 38 | |
64893f33 | 39 | /* type scope */ |
f6625916 | 40 | struct declaration_scope { |
c13cbf74 | 41 | /* Hash table mapping type name GQuark to "struct declaration" */ |
1ee8e81d | 42 | /* Used for both typedef and typealias. */ |
f6625916 MD |
43 | GHashTable *typedef_declarations; |
44 | /* Hash table mapping struct name GQuark to "struct declaration_struct" */ | |
45 | GHashTable *struct_declarations; | |
46 | /* Hash table mapping variant name GQuark to "struct declaration_variant" */ | |
47 | GHashTable *variant_declarations; | |
c13cbf74 | 48 | /* Hash table mapping enum name GQuark to "struct type_enum" */ |
f6625916 MD |
49 | GHashTable *enum_declarations; |
50 | struct declaration_scope *parent_scope; | |
64893f33 MD |
51 | }; |
52 | ||
e1151715 MD |
53 | /* definition scope */ |
54 | struct definition_scope { | |
55 | /* Hash table mapping field name GQuark to "struct definition" */ | |
56 | GHashTable *definitions; | |
57 | struct definition_scope *parent_scope; | |
05c749e5 MD |
58 | /* |
59 | * Complete "path" leading to this definition scope. | |
9e29e16e | 60 | * Includes dynamic scope name '.' field name '.' field name '.' .... |
05c749e5 | 61 | * Array of GQuark elements (which are each separated by dots). |
9e29e16e MD |
62 | * The dynamic scope name can contain dots, and is encoded into |
63 | * a single GQuark. Thus, scope_path[0] returns the GQuark | |
64 | * identifying the dynamic scope. | |
05c749e5 MD |
65 | */ |
66 | GArray *scope_path; /* array of GQuark */ | |
6b71274a MD |
67 | }; |
68 | ||
05628561 MD |
69 | enum ctf_type_id { |
70 | CTF_TYPE_UNKNOWN = 0, | |
71 | CTF_TYPE_INTEGER, | |
72 | CTF_TYPE_FLOAT, | |
73 | CTF_TYPE_ENUM, | |
74 | CTF_TYPE_STRING, | |
75 | CTF_TYPE_STRUCT, | |
d60cb676 | 76 | CTF_TYPE_UNTAGGED_VARIANT, |
05628561 MD |
77 | CTF_TYPE_VARIANT, |
78 | CTF_TYPE_ARRAY, | |
79 | CTF_TYPE_SEQUENCE, | |
80 | NR_CTF_TYPES, | |
81 | }; | |
82 | ||
f6625916 | 83 | struct declaration { |
05628561 | 84 | enum ctf_type_id id; |
fc93b2bd | 85 | size_t alignment; /* type alignment, in bits */ |
e19c3d69 | 86 | int ref; /* number of references to the type */ |
c054553d | 87 | /* |
f6625916 | 88 | * declaration_free called with declaration ref is decremented to 0. |
c054553d | 89 | */ |
f6625916 | 90 | void (*declaration_free)(struct declaration *declaration); |
e1151715 | 91 | struct definition * |
f6625916 | 92 | (*definition_new)(struct declaration *declaration, |
05c749e5 MD |
93 | struct definition_scope *parent_scope, |
94 | GQuark field_name, int index); | |
c054553d | 95 | /* |
e1151715 | 96 | * definition_free called with definition ref is decremented to 0. |
e19c3d69 | 97 | */ |
e1151715 | 98 | void (*definition_free)(struct definition *definition); |
c054553d MD |
99 | }; |
100 | ||
e1151715 | 101 | struct definition { |
f6625916 | 102 | struct declaration *declaration; |
05c749e5 | 103 | int index; /* Position of the definition in its container */ |
b1a2f580 | 104 | GQuark name; /* Field name in its container (or 0 if unset) */ |
e1151715 | 105 | int ref; /* number of references to the definition */ |
31262354 | 106 | GQuark path; |
fc93b2bd MD |
107 | }; |
108 | ||
c5e74408 MD |
109 | typedef int (*rw_dispatch)(struct stream_pos *pos, |
110 | struct definition *definition); | |
d11e9c49 MD |
111 | |
112 | /* Parent of per-plugin positions */ | |
113 | struct stream_pos { | |
114 | /* read/write dispatch table. Specific to plugin used for stream. */ | |
115 | rw_dispatch *rw_table; /* rw dispatch table */ | |
31262354 | 116 | int (*event_cb)(struct stream_pos *pos, |
aa6bffae | 117 | struct ctf_stream_class *stream_class); |
d11e9c49 MD |
118 | }; |
119 | ||
120 | static inline | |
c5e74408 | 121 | int generic_rw(struct stream_pos *pos, struct definition *definition) |
d11e9c49 MD |
122 | { |
123 | enum ctf_type_id dispatch_id = definition->declaration->id; | |
124 | rw_dispatch call; | |
125 | ||
126 | assert(pos->rw_table[dispatch_id] != NULL); | |
127 | call = pos->rw_table[dispatch_id]; | |
c5e74408 | 128 | return call(pos, definition); |
d11e9c49 MD |
129 | } |
130 | ||
bed864a7 MD |
131 | /* |
132 | * Because we address in bits, bitfields end up being exactly the same as | |
133 | * integers, except that their read/write functions must be able to deal with | |
134 | * read/write non aligned on CHAR_BIT. | |
135 | */ | |
f6625916 MD |
136 | struct declaration_integer { |
137 | struct declaration p; | |
7fe00194 MD |
138 | size_t len; /* length, in bits. */ |
139 | int byte_order; /* byte order */ | |
140 | int signedness; | |
fc93b2bd MD |
141 | }; |
142 | ||
e1151715 MD |
143 | struct definition_integer { |
144 | struct definition p; | |
f6625916 | 145 | struct declaration_integer *declaration; |
c054553d MD |
146 | /* Last values read */ |
147 | union { | |
148 | uint64_t _unsigned; | |
149 | int64_t _signed; | |
150 | } value; | |
151 | }; | |
152 | ||
f6625916 MD |
153 | struct declaration_float { |
154 | struct declaration p; | |
155 | struct declaration_integer *sign; | |
156 | struct declaration_integer *mantissa; | |
157 | struct declaration_integer *exp; | |
fc93b2bd | 158 | int byte_order; |
0a46062b | 159 | /* TODO: we might want to express more info about NaN, +inf and -inf */ |
fc93b2bd MD |
160 | }; |
161 | ||
e1151715 MD |
162 | struct definition_float { |
163 | struct definition p; | |
f6625916 | 164 | struct declaration_float *declaration; |
d11e9c49 MD |
165 | struct definition_integer *sign; |
166 | struct definition_integer *mantissa; | |
167 | struct definition_integer *exp; | |
c054553d MD |
168 | /* Last values read */ |
169 | long double value; | |
170 | }; | |
171 | ||
d65d8abb MD |
172 | /* |
173 | * enum_val_equal assumes that signed and unsigned memory layout overlap. | |
174 | */ | |
175 | struct enum_range { | |
176 | union { | |
177 | int64_t _signed; | |
178 | uint64_t _unsigned; | |
179 | } start; /* lowest range value */ | |
180 | union { | |
181 | int64_t _signed; | |
182 | uint64_t _unsigned; | |
183 | } end; /* highest range value */ | |
184 | }; | |
185 | ||
186 | struct enum_range_to_quark { | |
187 | struct cds_list_head node; | |
188 | struct enum_range range; | |
189 | GQuark quark; | |
190 | }; | |
191 | ||
192 | /* | |
193 | * We optimize the common case (range of size 1: single value) by creating a | |
194 | * hash table mapping values to quark sets. We then lookup the ranges to | |
195 | * complete the quark set. | |
196 | * | |
197 | * TODO: The proper structure to hold the range to quark set mapping would be an | |
198 | * interval tree, with O(n) size, O(n*log(n)) build time and O(log(n)) query | |
199 | * time. Using a simple O(n) list search for now for implementation speed and | |
200 | * given that we can expect to have a _relatively_ small number of enumeration | |
201 | * ranges. This might become untrue if we are fed with symbol tables often | |
202 | * required to lookup function names from instruction pointer value. | |
203 | */ | |
448d3cc7 | 204 | struct enum_table { |
d65d8abb MD |
205 | GHashTable *value_to_quark_set; /* (value, GQuark GArray) */ |
206 | struct cds_list_head range_to_quark; /* (range, GQuark) */ | |
207 | GHashTable *quark_to_range_set; /* (GQuark, range GArray) */ | |
448d3cc7 MD |
208 | }; |
209 | ||
f6625916 MD |
210 | struct declaration_enum { |
211 | struct declaration p; | |
212 | struct declaration_integer *integer_declaration; | |
448d3cc7 | 213 | struct enum_table table; |
fc93b2bd MD |
214 | }; |
215 | ||
e1151715 MD |
216 | struct definition_enum { |
217 | struct definition p; | |
218 | struct definition_integer *integer; | |
f6625916 | 219 | struct declaration_enum *declaration; |
c054553d MD |
220 | /* Last GQuark values read. Keeping a reference on the GQuark array. */ |
221 | GArray *value; | |
222 | }; | |
223 | ||
ab4cf058 MD |
224 | enum ctf_string_encoding { |
225 | CTF_STRING_UTF8 = 0, | |
226 | CTF_STRING_ASCII, | |
227 | CTF_STRING_UNKNOWN, | |
228 | }; | |
229 | ||
f6625916 MD |
230 | struct declaration_string { |
231 | struct declaration p; | |
ab4cf058 | 232 | enum ctf_string_encoding encoding; |
c054553d MD |
233 | }; |
234 | ||
e1151715 MD |
235 | struct definition_string { |
236 | struct definition p; | |
f6625916 | 237 | struct declaration_string *declaration; |
e1151715 | 238 | char *value; /* freed at definition_string teardown */ |
d11e9c49 | 239 | size_t len, alloc_len; |
11796b96 MD |
240 | }; |
241 | ||
f6625916 | 242 | struct declaration_field { |
e19c3d69 | 243 | GQuark name; |
f6625916 | 244 | struct declaration *declaration; |
c054553d MD |
245 | }; |
246 | ||
f6625916 MD |
247 | struct declaration_struct { |
248 | struct declaration p; | |
e19c3d69 | 249 | GHashTable *fields_by_name; /* Tuples (field name, field index) */ |
f6625916 MD |
250 | struct declaration_scope *scope; |
251 | GArray *fields; /* Array of declaration_field */ | |
e19c3d69 MD |
252 | }; |
253 | ||
e1151715 MD |
254 | struct definition_struct { |
255 | struct definition p; | |
f6625916 | 256 | struct declaration_struct *declaration; |
e1151715 | 257 | struct definition_scope *scope; |
b1a2f580 | 258 | GPtrArray *fields; /* Array of pointers to struct definition */ |
c054553d MD |
259 | }; |
260 | ||
d60cb676 | 261 | struct declaration_untagged_variant { |
f6625916 | 262 | struct declaration p; |
c054553d | 263 | GHashTable *fields_by_tag; /* Tuples (field tag, field index) */ |
f6625916 MD |
264 | struct declaration_scope *scope; |
265 | GArray *fields; /* Array of declaration_field */ | |
c054553d MD |
266 | }; |
267 | ||
d60cb676 MD |
268 | struct declaration_variant { |
269 | struct declaration p; | |
270 | struct declaration_untagged_variant *untagged_variant; | |
271 | GArray *tag_name; /* Array of GQuark */ | |
272 | }; | |
273 | ||
274 | /* A variant needs to be tagged to be defined. */ | |
e1151715 MD |
275 | struct definition_variant { |
276 | struct definition p; | |
f6625916 | 277 | struct declaration_variant *declaration; |
e1151715 MD |
278 | struct definition_scope *scope; |
279 | struct definition *enum_tag; | |
b1a2f580 MD |
280 | GPtrArray *fields; /* Array of pointers to struct definition */ |
281 | struct definition *current_field; /* Last field read */ | |
11796b96 MD |
282 | }; |
283 | ||
f6625916 MD |
284 | struct declaration_array { |
285 | struct declaration p; | |
11796b96 | 286 | size_t len; |
f6625916 MD |
287 | struct declaration *elem; |
288 | struct declaration_scope *scope; | |
11796b96 MD |
289 | }; |
290 | ||
e1151715 MD |
291 | struct definition_array { |
292 | struct definition p; | |
f6625916 | 293 | struct declaration_array *declaration; |
e1151715 | 294 | struct definition_scope *scope; |
b1a2f580 | 295 | GPtrArray *elems; /* Array of pointers to struct definition */ |
c054553d MD |
296 | }; |
297 | ||
f6625916 MD |
298 | struct declaration_sequence { |
299 | struct declaration p; | |
300 | struct declaration_integer *len_declaration; | |
301 | struct declaration *elem; | |
302 | struct declaration_scope *scope; | |
e19c3d69 MD |
303 | }; |
304 | ||
e1151715 MD |
305 | struct definition_sequence { |
306 | struct definition p; | |
f6625916 | 307 | struct declaration_sequence *declaration; |
e1151715 MD |
308 | struct definition_scope *scope; |
309 | struct definition_integer *len; | |
b1a2f580 | 310 | GPtrArray *elems; /* Array of pointers to struct definition */ |
c054553d MD |
311 | }; |
312 | ||
f6625916 MD |
313 | int register_declaration(GQuark declaration_name, |
314 | struct declaration *declaration, | |
315 | struct declaration_scope *scope); | |
316 | struct declaration *lookup_declaration(GQuark declaration_name, | |
78af2bcd | 317 | struct declaration_scope *scope); |
c13cbf74 MD |
318 | |
319 | /* | |
320 | * Type scopes also contain a separate registry for struct, variant and | |
e1151715 | 321 | * enum types. Those register types rather than type definitions, so |
c13cbf74 MD |
322 | * that a named variant can be declared without specifying its target |
323 | * "choice" tag field immediately. | |
324 | */ | |
f6625916 MD |
325 | int register_struct_declaration(GQuark struct_name, |
326 | struct declaration_struct *struct_declaration, | |
327 | struct declaration_scope *scope); | |
328 | struct declaration_struct * | |
329 | lookup_struct_declaration(GQuark struct_name, | |
330 | struct declaration_scope *scope); | |
331 | int register_variant_declaration(GQuark variant_name, | |
a0720417 | 332 | struct declaration_untagged_variant *untagged_variant_declaration, |
f6625916 | 333 | struct declaration_scope *scope); |
a0720417 | 334 | struct declaration_untagged_variant *lookup_variant_declaration(GQuark variant_name, |
f6625916 MD |
335 | struct declaration_scope *scope); |
336 | int register_enum_declaration(GQuark enum_name, | |
337 | struct declaration_enum *enum_declaration, | |
338 | struct declaration_scope *scope); | |
339 | struct declaration_enum * | |
340 | lookup_enum_declaration(GQuark enum_name, | |
341 | struct declaration_scope *scope); | |
342 | ||
343 | struct declaration_scope * | |
344 | new_declaration_scope(struct declaration_scope *parent_scope); | |
345 | void free_declaration_scope(struct declaration_scope *scope); | |
c054553d | 346 | |
c13cbf74 | 347 | /* |
e1151715 MD |
348 | * field_definition is for field definitions. They are registered into |
349 | * definition scopes. | |
c13cbf74 | 350 | */ |
e1151715 | 351 | struct definition * |
05c749e5 MD |
352 | lookup_definition(GArray *cur_path, /* array of GQuark */ |
353 | GArray *lookup_path, /* array of GQuark */ | |
354 | struct definition_scope *scope); | |
e1151715 MD |
355 | int register_field_definition(GQuark field_name, |
356 | struct definition *definition, | |
357 | struct definition_scope *scope); | |
358 | struct definition_scope * | |
05c749e5 MD |
359 | new_definition_scope(struct definition_scope *parent_scope, |
360 | GQuark field_name); | |
6a36ddca MD |
361 | void set_dynamic_definition_scope(struct definition *definition, |
362 | struct definition_scope *scope, | |
d00d17d1 | 363 | const char *root_name); |
e1151715 | 364 | void free_definition_scope(struct definition_scope *scope); |
4c8bfb7e | 365 | |
31262354 MD |
366 | GQuark new_definition_path(struct definition_scope *parent_scope, GQuark field_name); |
367 | ||
368 | static inline | |
369 | int compare_definition_path(struct definition *definition, GQuark path) | |
370 | { | |
371 | return definition->path == path; | |
372 | } | |
373 | ||
f6625916 MD |
374 | void declaration_ref(struct declaration *declaration); |
375 | void declaration_unref(struct declaration *declaration); | |
64893f33 | 376 | |
e1151715 MD |
377 | void definition_ref(struct definition *definition); |
378 | void definition_unref(struct definition *definition); | |
698f0fe4 | 379 | |
add40b62 | 380 | struct declaration_integer *integer_declaration_new(size_t len, int byte_order, |
e19c3d69 | 381 | int signedness, size_t alignment); |
0a46062b | 382 | |
11d43b90 MD |
383 | /* |
384 | * mantissa_len is the length of the number of bytes represented by the mantissa | |
385 | * (e.g. result of DBL_MANT_DIG). It includes the leading 1. | |
386 | */ | |
add40b62 | 387 | struct declaration_float *float_declaration_new(size_t mantissa_len, |
e19c3d69 MD |
388 | size_t exp_len, int byte_order, |
389 | size_t alignment); | |
0a46062b | 390 | |
448d3cc7 MD |
391 | /* |
392 | * A GQuark can be translated to/from strings with g_quark_from_string() and | |
393 | * g_quark_to_string(). | |
394 | */ | |
47e0f2e2 MD |
395 | |
396 | /* | |
397 | * Returns a GArray of GQuark or NULL. | |
398 | * Caller must release the GArray with g_array_unref(). | |
399 | */ | |
f6625916 MD |
400 | GArray *enum_uint_to_quark_set(const struct declaration_enum *enum_declaration, |
401 | uint64_t v); | |
d65d8abb MD |
402 | |
403 | /* | |
47e0f2e2 | 404 | * Returns a GArray of GQuark or NULL. |
d65d8abb MD |
405 | * Caller must release the GArray with g_array_unref(). |
406 | */ | |
f6625916 MD |
407 | GArray *enum_int_to_quark_set(const struct declaration_enum *enum_declaration, |
408 | uint64_t v); | |
47e0f2e2 MD |
409 | |
410 | /* | |
411 | * Returns a GArray of struct enum_range or NULL. | |
fdacfb73 MD |
412 | * Callers do _not_ own the returned GArray (and therefore _don't_ need to |
413 | * release it). | |
47e0f2e2 | 414 | */ |
f6625916 MD |
415 | GArray *enum_quark_to_range_set(const struct declaration_enum *enum_declaration, |
416 | GQuark q); | |
417 | void enum_signed_insert(struct declaration_enum *enum_declaration, | |
d65d8abb | 418 | int64_t start, int64_t end, GQuark q); |
f6625916 | 419 | void enum_unsigned_insert(struct declaration_enum *enum_declaration, |
d65d8abb | 420 | uint64_t start, uint64_t end, GQuark q); |
f6625916 MD |
421 | size_t enum_get_nr_enumerators(struct declaration_enum *enum_declaration); |
422 | ||
423 | struct declaration_enum * | |
ab4cf058 | 424 | enum_declaration_new(struct declaration_integer *integer_declaration); |
f6625916 | 425 | |
e397791f MD |
426 | struct declaration_string * |
427 | string_declaration_new(enum ctf_string_encoding encoding); | |
428 | ||
f6625916 | 429 | struct declaration_struct * |
ab4cf058 | 430 | struct_declaration_new(struct declaration_scope *parent_scope); |
f6625916 MD |
431 | void struct_declaration_add_field(struct declaration_struct *struct_declaration, |
432 | const char *field_name, | |
433 | struct declaration *field_declaration); | |
11796b96 MD |
434 | /* |
435 | * Returns the index of a field within a structure. | |
436 | */ | |
0f980a35 | 437 | int struct_declaration_lookup_field_index(struct declaration_struct *struct_declaration, |
f6625916 | 438 | GQuark field_name); |
11796b96 MD |
439 | /* |
440 | * field returned only valid as long as the field structure is not appended to. | |
441 | */ | |
f6625916 MD |
442 | struct declaration_field * |
443 | struct_declaration_get_field_from_index(struct declaration_struct *struct_declaration, | |
0f980a35 | 444 | int index); |
b1a2f580 | 445 | struct definition * |
0f980a35 MD |
446 | struct_definition_get_field_from_index(struct definition_struct *struct_definition, |
447 | int index); | |
c5e74408 | 448 | int struct_rw(struct stream_pos *pos, struct definition *definition); |
11796b96 | 449 | |
c054553d MD |
450 | /* |
451 | * The tag enumeration is validated to ensure that it contains only mappings | |
452 | * from numeric values to a single tag. Overlapping tag value ranges are | |
453 | * therefore forbidden. | |
454 | */ | |
ab4cf058 | 455 | struct declaration_untagged_variant *untagged_variant_declaration_new( |
1934b94f | 456 | struct declaration_scope *parent_scope); |
d60cb676 MD |
457 | struct declaration_variant *variant_declaration_new(struct declaration_untagged_variant *untagged_variant, |
458 | const char *tag); | |
459 | ||
460 | void untagged_variant_declaration_add_field(struct declaration_untagged_variant *untagged_variant_declaration, | |
461 | const char *field_name, | |
462 | struct declaration *field_declaration); | |
f6625916 | 463 | struct declaration_field * |
d60cb676 | 464 | untagged_variant_declaration_get_field_from_tag(struct declaration_untagged_variant *untagged_variant_declaration, |
1934b94f | 465 | GQuark tag); |
c054553d MD |
466 | /* |
467 | * Returns 0 on success, -EPERM on error. | |
468 | */ | |
e1151715 MD |
469 | int variant_definition_set_tag(struct definition_variant *variant, |
470 | struct definition *enum_tag); | |
c054553d MD |
471 | /* |
472 | * Returns the field selected by the current tag value. | |
473 | * field returned only valid as long as the variant structure is not appended | |
474 | * to. | |
475 | */ | |
b1a2f580 | 476 | struct definition *variant_get_current_field(struct definition_variant *variant); |
c5e74408 | 477 | int variant_rw(struct stream_pos *pos, struct definition *definition); |
c054553d | 478 | |
d06d03db | 479 | /* |
f6625916 MD |
480 | * elem_declaration passed as parameter now belongs to the array. No |
481 | * need to free it explicitly. "len" is the number of elements in the | |
482 | * array. | |
d06d03db | 483 | */ |
f6625916 | 484 | struct declaration_array * |
ab4cf058 | 485 | array_declaration_new(size_t len, struct declaration *elem_declaration, |
1934b94f | 486 | struct declaration_scope *parent_scope); |
3838df27 | 487 | uint64_t array_len(struct definition_array *array); |
0f980a35 | 488 | struct definition *array_index(struct definition_array *array, uint64_t i); |
c5e74408 | 489 | int array_rw(struct stream_pos *pos, struct definition *definition); |
11796b96 | 490 | |
d06d03db | 491 | /* |
f6625916 MD |
492 | * int_declaration and elem_declaration passed as parameter now belong |
493 | * to the sequence. No need to free them explicitly. | |
d06d03db | 494 | */ |
f6625916 | 495 | struct declaration_sequence * |
ab4cf058 | 496 | sequence_declaration_new(struct declaration_integer *len_declaration, |
1934b94f MD |
497 | struct declaration *elem_declaration, |
498 | struct declaration_scope *parent_scope); | |
3838df27 | 499 | uint64_t sequence_len(struct definition_sequence *sequence); |
0f980a35 | 500 | struct definition *sequence_index(struct definition_sequence *sequence, uint64_t i); |
c5e74408 | 501 | int sequence_rw(struct stream_pos *pos, struct definition *definition); |
11796b96 | 502 | |
d60cb676 MD |
503 | /* |
504 | * in: path (dot separated), out: q (GArray of GQuark) | |
505 | */ | |
506 | void append_scope_path(const char *path, GArray *q); | |
507 | ||
31262354 | 508 | #endif /* _BABELTRACE_TYPES_H */ |