X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Fcommon%2Fmetadata%2Fctf-meta-translate.c;h=1499a7f9545c43fbb57ed09356b2e50a3e779aae;hb=498e7994d60bd0e9f63c3d5c0fd00eec77ba7c34;hp=b8372f245bf12e97964567cd95b20ea54585b215;hpb=45c51519900e100d9acda4acb9516ef69bc2d045;p=babeltrace.git diff --git a/src/plugins/ctf/common/metadata/ctf-meta-translate.c b/src/plugins/ctf/common/metadata/ctf-meta-translate.c index b8372f24..1499a7f9 100644 --- a/src/plugins/ctf/common/metadata/ctf-meta-translate.c +++ b/src/plugins/ctf/common/metadata/ctf-meta-translate.c @@ -16,6 +16,7 @@ #include "common/macros.h" #include "common/assert.h" #include +#include #include #include #include @@ -53,9 +54,9 @@ bt_field_class *ctf_field_class_int_to_ir(struct ctx *ctx, bt_field_class *ir_fc; if (fc->is_signed) { - ir_fc = bt_field_class_signed_integer_create(ctx->ir_tc); + ir_fc = bt_field_class_integer_signed_create(ctx->ir_tc); } else { - ir_fc = bt_field_class_unsigned_integer_create(ctx->ir_tc); + ir_fc = bt_field_class_integer_unsigned_create(ctx->ir_tc); } BT_ASSERT(ir_fc); @@ -72,9 +73,9 @@ bt_field_class *ctf_field_class_enum_to_ir(struct ctx *ctx, uint64_t i; if (fc->base.is_signed) { - ir_fc = bt_field_class_signed_enumeration_create(ctx->ir_tc); + ir_fc = bt_field_class_enumeration_signed_create(ctx->ir_tc); } else { - ir_fc = bt_field_class_unsigned_enumeration_create(ctx->ir_tc); + ir_fc = bt_field_class_enumeration_unsigned_create(ctx->ir_tc); } BT_ASSERT(ir_fc); @@ -113,13 +114,13 @@ bt_field_class *ctf_field_class_enum_to_ir(struct ctx *ctx, } if (fc->base.is_signed) { - ret = bt_field_class_signed_enumeration_add_mapping( + ret = bt_field_class_enumeration_signed_add_mapping( ir_fc, mapping->label->str, range_set); - BT_RANGE_SET_SIGNED_PUT_REF_AND_RESET(range_set); + BT_INTEGER_RANGE_SET_SIGNED_PUT_REF_AND_RESET(range_set); } else { - ret = bt_field_class_unsigned_enumeration_add_mapping( + ret = bt_field_class_enumeration_unsigned_add_mapping( ir_fc, mapping->label->str, range_set); - BT_RANGE_SET_UNSIGNED_PUT_REF_AND_RESET(range_set); + BT_INTEGER_RANGE_SET_UNSIGNED_PUT_REF_AND_RESET(range_set); } BT_ASSERT(ret == 0); @@ -134,13 +135,12 @@ bt_field_class *ctf_field_class_float_to_ir(struct ctx *ctx, { bt_field_class *ir_fc; - ir_fc = bt_field_class_real_create(ctx->ir_tc); - BT_ASSERT(ir_fc); - if (fc->base.size == 32) { - bt_field_class_real_set_is_single_precision(ir_fc, - BT_TRUE); + ir_fc = bt_field_class_real_single_precision_create(ctx->ir_tc); + } else { + ir_fc = bt_field_class_real_double_precision_create(ctx->ir_tc); } + BT_ASSERT(ir_fc); return ir_fc; } @@ -224,17 +224,17 @@ const void *find_ir_enum_field_class_mapping_by_label(const bt_field_class *fc, if (is_signed) { spec_this_mapping = - bt_field_class_signed_enumeration_borrow_mapping_by_index_const( + bt_field_class_enumeration_signed_borrow_mapping_by_index_const( fc, i); this_mapping = - bt_field_class_signed_enumeration_mapping_as_mapping_const( + bt_field_class_enumeration_signed_mapping_as_mapping_const( spec_this_mapping); } else { spec_this_mapping = - bt_field_class_unsigned_enumeration_borrow_mapping_by_index_const( + bt_field_class_enumeration_unsigned_borrow_mapping_by_index_const( fc, i); this_mapping = - bt_field_class_unsigned_enumeration_mapping_as_mapping_const( + bt_field_class_enumeration_unsigned_mapping_as_mapping_const( spec_this_mapping); } @@ -292,7 +292,7 @@ bt_field_class *ctf_field_class_variant_to_ir(struct ctx *ctx, * mapping name. */ if (fc->tag_fc->base.is_signed) { - const bt_field_class_signed_enumeration_mapping *mapping = + const bt_field_class_enumeration_signed_mapping *mapping = find_ir_enum_field_class_mapping_by_label( ir_tag_fc, named_fc->orig_name->str, true); @@ -300,14 +300,14 @@ bt_field_class *ctf_field_class_variant_to_ir(struct ctx *ctx, BT_ASSERT(mapping); range_set = - bt_field_class_signed_enumeration_mapping_borrow_ranges_const( + bt_field_class_enumeration_signed_mapping_borrow_ranges_const( mapping); BT_ASSERT(range_set); - ret = bt_field_class_variant_with_signed_selector_append_option( + ret = bt_field_class_variant_with_selector_field_integer_signed_append_option( ir_fc, named_fc->name->str, option_ir_fc, range_set); } else { - const bt_field_class_unsigned_enumeration_mapping *mapping = + const bt_field_class_enumeration_unsigned_mapping *mapping = find_ir_enum_field_class_mapping_by_label( ir_tag_fc, named_fc->orig_name->str, @@ -316,10 +316,10 @@ bt_field_class *ctf_field_class_variant_to_ir(struct ctx *ctx, BT_ASSERT(mapping); range_set = - bt_field_class_unsigned_enumeration_mapping_borrow_ranges_const( + bt_field_class_enumeration_unsigned_mapping_borrow_ranges_const( mapping); BT_ASSERT(range_set); - ret = bt_field_class_variant_with_unsigned_selector_append_option( + ret = bt_field_class_variant_with_selector_field_integer_unsigned_append_option( ir_fc, named_fc->name->str, option_ir_fc, range_set); } @@ -350,7 +350,7 @@ bt_field_class *ctf_field_class_array_to_ir(struct ctx *ctx, elem_ir_fc = ctf_field_class_to_ir(ctx, fc->base.elem_fc); BT_ASSERT(elem_ir_fc); - ir_fc = bt_field_class_static_array_create(ctx->ir_tc, elem_ir_fc, + ir_fc = bt_field_class_array_static_create(ctx->ir_tc, elem_ir_fc, fc->length); BT_ASSERT(ir_fc); bt_field_class_put_ref(elem_ir_fc); @@ -363,9 +363,9 @@ static inline bt_field_class *ctf_field_class_sequence_to_ir(struct ctx *ctx, struct ctf_field_class_sequence *fc) { - int ret; bt_field_class *ir_fc; bt_field_class *elem_ir_fc; + bt_field_class *length_fc = NULL; if (fc->base.is_text) { ir_fc = bt_field_class_string_create(ctx->ir_tc); @@ -375,18 +375,19 @@ bt_field_class *ctf_field_class_sequence_to_ir(struct ctx *ctx, elem_ir_fc = ctf_field_class_to_ir(ctx, fc->base.elem_fc); BT_ASSERT(elem_ir_fc); - ir_fc = bt_field_class_dynamic_array_create(ctx->ir_tc, elem_ir_fc); - BT_ASSERT(ir_fc); - bt_field_class_put_ref(elem_ir_fc); - BT_ASSERT(ir_fc); if (fc->length_path.root != CTF_SCOPE_PACKET_HEADER && fc->length_path.root != CTF_SCOPE_EVENT_HEADER) { - ret = bt_field_class_dynamic_array_set_length_field_class( - ir_fc, borrow_ir_fc_from_field_path(ctx, &fc->length_path)); - BT_ASSERT(ret == 0); + length_fc = borrow_ir_fc_from_field_path(ctx, &fc->length_path); + BT_ASSERT(length_fc); } + ir_fc = bt_field_class_array_dynamic_create(ctx->ir_tc, elem_ir_fc, + length_fc); + BT_ASSERT(ir_fc); + bt_field_class_put_ref(elem_ir_fc); + BT_ASSERT(ir_fc); + end: return ir_fc; } @@ -426,7 +427,7 @@ bt_field_class *ctf_field_class_to_ir(struct ctx *ctx, ir_fc = ctf_field_class_variant_to_ir(ctx, (void *) fc); break; default: - abort(); + bt_common_abort(); } fc->ir_fc = ir_fc; @@ -484,7 +485,7 @@ bt_field_class *scope_ctf_field_class_to_ir(struct ctx *ctx) fc = ctx->ec->payload_fc; break; default: - abort(); + bt_common_abort(); } if (fc && ctf_field_class_struct_has_immediate_member_in_ir( @@ -542,7 +543,7 @@ void ctf_event_class_to_ir(struct ctx *ctx) BT_ASSERT(ret == 0); } - if (ctx->ec->log_level != -1) { + if (ctx->ec->is_log_level_set) { bt_event_class_set_log_level(ir_ec, ctx->ec->log_level); }