Add BT_CTF_INTEGER_BASE_UNSPECIFIED
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 15 Jun 2017 20:10:23 +0000 (16:10 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 16 Jun 2017 19:51:34 +0000 (15:51 -0400)
This is in preparation for CTF 2 in which a default base is not
specified for integer-like field types.

sink.text.pretty defaults to BT_CTF_INTEGER_BASE_DECIMAL when it gets
BT_CTF_INTEGER_BASE_UNSPECIFIED.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/babeltrace/ctf-ir/field-types-internal.h
include/babeltrace/ctf-ir/field-types.h
lib/ctf-ir/field-types.c
plugins/text/pretty/print.c

index 4c21cbd47457cf56be4ab3da3cd0980d804f864c..f408f50b7f3727105305949ba6536d320b2715c2 100644 (file)
@@ -291,6 +291,8 @@ const char *bt_ctf_integer_base_string(enum bt_ctf_integer_base base)
        switch (base) {
        case BT_CTF_INTEGER_BASE_UNKNOWN:
                return "BT_CTF_INTEGER_BASE_UNKNOWN";
+       case BT_CTF_INTEGER_BASE_UNSPECIFIED:
+               return "BT_CTF_INTEGER_BASE_UNSPECIFIED";
        case BT_CTF_INTEGER_BASE_BINARY:
                return "BT_CTF_INTEGER_BASE_BINARY";
        case BT_CTF_INTEGER_BASE_OCTAL:
index 625a102e2dbaa93ed38489f1bfe94044e227cf06..cf332762e6694f1acf2e4bb0e63fa98bf1d1a598 100644 (file)
@@ -759,6 +759,9 @@ enum bt_ctf_integer_base {
        /// Unknown, used for errors.
        BT_CTF_INTEGER_BASE_UNKNOWN = -1,
 
+       /// Unspecified by the tracer.
+       BT_CTF_INTEGER_BASE_UNSPECIFIED = 0,
+
        /// Binary.
        BT_CTF_INTEGER_BASE_BINARY = 2,
 
@@ -896,8 +899,9 @@ extern int bt_ctf_field_type_integer_set_is_signed(
                                preferred display base.
 @returns                       Preferred display base of the integer
                                fields described by \p int_field_type,
-                               or #BT_CTF_INTEGER_BASE_UNKNOWN on
-                               error.
+                               #BT_CTF_INTEGER_BASE_UNSPECIFIED if
+                               not specified, or
+                               #BT_CTF_INTEGER_BASE_UNKNOWN on error.
 
 @prenotnull{int_field_type}
 @preisintft{int_field_type}
@@ -924,9 +928,9 @@ extern enum bt_ctf_integer_base bt_ctf_field_type_integer_get_base(
 @prenotnull{int_field_type}
 @preisintft{int_field_type}
 @prehot{int_field_type}
-@pre \p base is #BT_CTF_INTEGER_BASE_BINARY, #BT_CTF_INTEGER_BASE_OCTAL,
-       #BT_CTF_INTEGER_BASE_DECIMAL, or
-       #BT_CTF_INTEGER_BASE_HEXADECIMAL.
+@pre \p base is #BT_CTF_INTEGER_BASE_UNSPECIFIED,
+       #BT_CTF_INTEGER_BASE_BINARY, #BT_CTF_INTEGER_BASE_OCTAL,
+       #BT_CTF_INTEGER_BASE_DECIMAL, or #BT_CTF_INTEGER_BASE_HEXADECIMAL.
 @postrefcountsame{int_field_type}
 
 @sa bt_ctf_field_type_integer_get_base(): Returns the preferred display
index 68ae5899a5dffd9baa527409bc94c081346cdd58..95fdda9f38eb2a07a5d6146984a05f5e0cb21fa5 100644 (file)
@@ -1073,6 +1073,7 @@ int bt_ctf_field_type_integer_set_base(struct bt_ctf_field_type *type,
        }
 
        switch (base) {
+       case BT_CTF_INTEGER_BASE_UNSPECIFIED:
        case BT_CTF_INTEGER_BASE_BINARY:
        case BT_CTF_INTEGER_BASE_OCTAL:
        case BT_CTF_INTEGER_BASE_DECIMAL:
@@ -3900,6 +3901,7 @@ const char *get_integer_base_string(enum bt_ctf_integer_base base)
 
        switch (base) {
        case BT_CTF_INTEGER_BASE_DECIMAL:
+       case BT_CTF_INTEGER_BASE_UNSPECIFIED:
                base_string = "decimal";
                break;
        case BT_CTF_INTEGER_BASE_HEXADECIMAL:
index 86c088dc6c5d2f638758e374d28b1fe8fc84bece..1d941e914a7792f0eede6d74ebbdddf1855715ec 100644 (file)
@@ -693,6 +693,7 @@ enum bt_component_status print_integer(struct pretty_component *pretty,
                break;
        }
        case BT_CTF_INTEGER_BASE_DECIMAL:
+       case BT_CTF_INTEGER_BASE_UNSPECIFIED:
                if (!signedness) {
                        g_string_append_printf(pretty->string, "%" PRIu64, v.u);
                } else {
This page took 0.030178 seconds and 4 git commands to generate.