* SOFTWARE.
*/
+#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <stddef.h>
#include <stdbool.h>
#include <assert.h>
#include <string.h>
-#include <babeltrace/bitfield.h>
+#include <babeltrace/bitfield-internal.h>
#include <babeltrace/ctf-ir/field-types.h>
#include <babeltrace/ref.h>
-#include <babeltrace/align.h>
+#include <babeltrace/align-internal.h>
#include <glib.h>
#include "btr.h"
-#define PRINT_ERR_STREAM btr->err_stream
+#define PRINT_ERR_STREAM (btr ? btr->err_stream : stderr)
#define PRINT_PREFIX "ctf-btr"
-#include "print.h"
+#include "../print.h"
#define DIV8(_x) ((_x) >> 3)
#define BYTES_TO_BITS(_x) ((_x) * 8)
int64_t length;
switch (bt_ctf_field_type_get_type_id(field_type)) {
- case BT_CTF_TYPE_ID_STRUCT:
+ case BT_CTF_FIELD_TYPE_ID_STRUCT:
length = (int64_t) bt_ctf_field_type_structure_get_field_count(
field_type);
break;
- case BT_CTF_TYPE_ID_VARIANT:
+ case BT_CTF_FIELD_TYPE_ID_VARIANT:
/* Variant field types always "contain" a single type */
length = 1;
break;
- case BT_CTF_TYPE_ID_ARRAY:
+ case BT_CTF_FIELD_TYPE_ID_ARRAY:
length = bt_ctf_field_type_array_get_length(field_type);
break;
- case BT_CTF_TYPE_ID_SEQUENCE:
+ case BT_CTF_FIELD_TYPE_ID_SEQUENCE:
length = btr->user.cbs.query.get_sequence_length(field_type,
btr->user.data);
break;
int size;
switch (bt_ctf_field_type_get_type_id(field_type)) {
- case BT_CTF_TYPE_ID_INTEGER:
+ case BT_CTF_FIELD_TYPE_ID_INTEGER:
size = bt_ctf_field_type_integer_get_size(field_type);
break;
- case BT_CTF_TYPE_ID_FLOAT:
+ case BT_CTF_FIELD_TYPE_ID_FLOAT:
{
int exp_dig, mant_dig;
size = exp_dig + mant_dig;
break;
}
- case BT_CTF_TYPE_ID_ENUM:
+ case BT_CTF_FIELD_TYPE_ID_ENUM:
{
struct bt_ctf_field_type *int_type;
assert(btr->cur_basic_field_type);
switch (bt_ctf_field_type_get_type_id(btr->cur_basic_field_type)) {
- case BT_CTF_TYPE_ID_INTEGER:
+ case BT_CTF_FIELD_TYPE_ID_INTEGER:
status = read_basic_int_type_and_call_begin(btr);
break;
- case BT_CTF_TYPE_ID_FLOAT:
+ case BT_CTF_FIELD_TYPE_ID_FLOAT:
status = read_basic_float_type_and_call_begin(btr);
break;
- case BT_CTF_TYPE_ID_ENUM:
+ case BT_CTF_FIELD_TYPE_ID_ENUM:
status = read_basic_enum_type_and_call_begin(btr);
break;
- case BT_CTF_TYPE_ID_STRING:
+ case BT_CTF_FIELD_TYPE_ID_STRING:
status = read_basic_string_type_and_call(btr, true);
break;
default:
- assert(false);
+ abort();
}
return status;
assert(btr->cur_basic_field_type);
switch (bt_ctf_field_type_get_type_id(btr->cur_basic_field_type)) {
- case BT_CTF_TYPE_ID_INTEGER:
+ case BT_CTF_FIELD_TYPE_ID_INTEGER:
status = read_basic_int_type_and_call_continue(btr);
break;
- case BT_CTF_TYPE_ID_FLOAT:
+ case BT_CTF_FIELD_TYPE_ID_FLOAT:
status = read_basic_float_type_and_call_continue(btr);
break;
- case BT_CTF_TYPE_ID_ENUM:
+ case BT_CTF_FIELD_TYPE_ID_ENUM:
status = read_basic_enum_type_and_call_continue(btr);
break;
- case BT_CTF_TYPE_ID_STRING:
+ case BT_CTF_FIELD_TYPE_ID_STRING:
status = read_basic_string_type_and_call(btr, false);
break;
default:
- assert(false);
+ abort();
}
return status;
static inline
bool is_compound_type(struct bt_ctf_field_type *field_type)
{
- enum bt_ctf_type_id id = bt_ctf_field_type_get_type_id(field_type);
+ enum bt_ctf_field_type_id id = bt_ctf_field_type_get_type_id(field_type);
- return id == BT_CTF_TYPE_ID_STRUCT || id == BT_CTF_TYPE_ID_ARRAY ||
- id == BT_CTF_TYPE_ID_SEQUENCE || id == BT_CTF_TYPE_ID_VARIANT;
+ return id == BT_CTF_FIELD_TYPE_ID_STRUCT || id == BT_CTF_FIELD_TYPE_ID_ARRAY ||
+ id == BT_CTF_FIELD_TYPE_ID_SEQUENCE || id == BT_CTF_FIELD_TYPE_ID_VARIANT;
}
static inline
/* Get next field's type */
switch (bt_ctf_field_type_get_type_id(top->base_type)) {
- case BT_CTF_TYPE_ID_STRUCT:
+ case BT_CTF_FIELD_TYPE_ID_STRUCT:
ret = bt_ctf_field_type_structure_get_field(
top->base_type, NULL, &next_field_type,
top->index);
next_field_type = NULL;
}
break;
- case BT_CTF_TYPE_ID_ARRAY:
+ case BT_CTF_FIELD_TYPE_ID_ARRAY:
next_field_type =
bt_ctf_field_type_array_get_element_type(
top->base_type);
break;
- case BT_CTF_TYPE_ID_SEQUENCE:
+ case BT_CTF_FIELD_TYPE_ID_SEQUENCE:
next_field_type =
bt_ctf_field_type_sequence_get_element_type(
top->base_type);
break;
- case BT_CTF_TYPE_ID_VARIANT:
+ case BT_CTF_FIELD_TYPE_ID_VARIANT:
/* Variant types are dynamic: query the user, he should know! */
next_field_type =
btr->user.cbs.query.get_variant_type(