lib: split real FC/field into single and double prec FC/field
[babeltrace.git] / src / plugins / ctf / fs-sink / translate-ctf-ir-to-tsdl.c
index 2fa7c0fdadfb84ed8eeea5eb47cc983d767b3dfa..a94c615e4f410040c9852d72cd74a5f1f90454c3 100644 (file)
@@ -195,6 +195,21 @@ void append_bool_field_class(struct ctx *ctx,
                NULL, NULL, false);
 }
 
+static
+void append_bit_array_field_class(struct ctx *ctx,
+               struct fs_sink_ctf_field_class_bit_array *fc)
+{
+       /*
+        * CTF 1.8 has no bit array field class type, so this component
+        * translates it to an unsigned integer field class with an
+        * hexadecimal base.
+        */
+       append_integer_field_class_from_props(ctx, fc->size,
+               fc->base.alignment, false,
+               BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL,
+               NULL, NULL, false);
+}
+
 static
 void append_integer_field_class(struct ctx *ctx,
                struct fs_sink_ctf_field_class_int *fc)
@@ -319,7 +334,7 @@ void append_float_field_class(struct ctx *ctx,
 {
        unsigned int mant_dig, exp_dig;
 
-       if (bt_field_class_real_is_single_precision(fc->base.base.ir_fc)) {
+       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 {
@@ -485,6 +500,10 @@ void append_struct_field_class_members(struct ctx *ctx,
                        append_indent(ctx);
                        g_string_append(ctx->tsdl,
                                "/* The integer field class below was a trace IR boolean field class. */\n");
+               } else if (fc->type == FS_SINK_CTF_FIELD_CLASS_TYPE_BIT_ARRAY) {
+                       append_indent(ctx);
+                       g_string_append(ctx->tsdl,
+                               "/* The integer field class below was a trace IR bit array field class. */\n");
                }
 
                append_indent(ctx);
@@ -547,6 +566,9 @@ void append_field_class(struct ctx *ctx, struct fs_sink_ctf_field_class *fc)
        case FS_SINK_CTF_FIELD_CLASS_TYPE_BOOL:
                append_bool_field_class(ctx, (void *) fc);
                break;
+       case FS_SINK_CTF_FIELD_CLASS_TYPE_BIT_ARRAY:
+               append_bit_array_field_class(ctx, (void *) fc);
+               break;
        case FS_SINK_CTF_FIELD_CLASS_TYPE_INT:
                append_integer_field_class(ctx, (void *) fc);
                break;
This page took 0.02567 seconds and 4 git commands to generate.