/*
- * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ * SPDX-License-Identifier: MIT
*
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
*/
+#include "translate-ctf-ir-to-tsdl.h"
+
#include <babeltrace2/babeltrace.h>
#include "common/macros.h"
#include <stdio.h>
g_string_append(ctx->tsdl, "x");
break;
default:
- abort();
+ bt_common_abort();
}
g_string_append_c(ctx->tsdl, ';');
{
const bt_field_class *ir_fc = fc->base.base.ir_fc;
bt_field_class_type type = bt_field_class_get_type(ir_fc);
- bool is_signed = type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION ||
- type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER;
+ bool is_signed = bt_field_class_type_is(type,
+ BT_FIELD_CLASS_TYPE_SIGNED_INTEGER);
- if (type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION ||
- type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION) {
+ if (bt_field_class_type_is(type, BT_FIELD_CLASS_TYPE_ENUMERATION)) {
g_string_append(ctx->tsdl, "enum : ");
}
bt_field_class_integer_get_preferred_display_base(ir_fc),
NULL, NULL, false);
- if (type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION ||
- type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION) {
+ if (bt_field_class_type_is(type, BT_FIELD_CLASS_TYPE_ENUMERATION)) {
uint64_t i;
g_string_append(ctx->tsdl, " {\n");
{
unsigned int mant_dig, exp_dig;
- if (bt_field_class_get_type(fc->base.base.ir_fc) == BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL) {
+ if (bt_field_class_get_type(fc->base.base.ir_fc) ==
+ BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL) {
mant_dig = 24;
exp_dig = 8;
} else {
ctx->indent_level++;
for (i = 0; i < var_fc->options->len; i++) {
- struct fs_sink_ctf_named_field_class *named_fc =
+ struct fs_sink_ctf_named_field_class *option_named_fc =
fs_sink_ctf_field_class_variant_borrow_option_by_index(
var_fc, i);
append_indent(ctx);
g_string_append_printf(ctx->tsdl,
"\"%s\" = %" PRIu64 ",\n",
- named_fc->name->str, i);
+ option_named_fc->name->str, i);
}
append_end_block(ctx);
append_variant_field_class(ctx, (void *) fc);
break;
default:
- abort();
+ bt_common_abort();
}
}
level = 14;
break;
default:
- abort();
+ bt_common_abort();
}
g_string_append_printf(ctx->tsdl, "%u;\n", level);
* This is checked in
* translate_trace_trace_ir_to_ctf_ir().
*/
- abort();
+ bt_common_abort();
}
g_string_append(tsdl, ";\n");