color_bold(ctx), value, color_reset(ctx));
}
+static inline
+void write_none_prop_value(struct details_write_ctx *ctx, const char *value)
+{
+ g_string_append_printf(ctx->str, "%s%s%s%s",
+ color_bold(ctx), color_fg_magenta(ctx),
+ value, color_reset(ctx));
+}
+
static inline
void write_uint_str_prop_value(struct details_write_ctx *ctx, const char *value)
{
}
static inline
-void write_bool_prop_line(struct details_write_ctx *ctx, const char *prop_name,
- bt_bool prop_value)
+void write_bool_prop_value(struct details_write_ctx *ctx, bt_bool prop_value)
{
const char *str;
- write_indent(ctx);
- write_prop_name(ctx, prop_name);
- g_string_append_printf(ctx->str, ": %s", color_bold(ctx));
+ g_string_append(ctx->str, color_bold(ctx));
if (prop_value) {
g_string_append(ctx->str, color_fg_green(ctx));
str = "No";
}
- g_string_append_printf(ctx->str, "%s%s\n", str, color_reset(ctx));
+ g_string_append_printf(ctx->str, "%s%s", str, color_reset(ctx));
+}
+
+static inline
+void write_bool_prop_line(struct details_write_ctx *ctx, const char *prop_name,
+ bt_bool prop_value)
+{
+ write_indent(ctx);
+ write_prop_name(ctx, prop_name);
+ g_string_append(ctx->str, ": ");
+ write_bool_prop_value(ctx, prop_value);
+ write_nl(ctx);
}
static inline
BT_ASSERT(mapping);
if (is_signed) {
- fc_mapping = bt_field_class_signed_enumeration_borrow_mapping_by_index_const(
+ fc_mapping = bt_field_class_enumeration_signed_borrow_mapping_by_index_const(
fc, i);
- fc_range_set = bt_field_class_signed_enumeration_mapping_borrow_ranges_const(
+ fc_range_set = bt_field_class_enumeration_signed_mapping_borrow_ranges_const(
fc_mapping);
} else {
- fc_mapping = bt_field_class_unsigned_enumeration_borrow_mapping_by_index_const(
+ fc_mapping = bt_field_class_enumeration_unsigned_borrow_mapping_by_index_const(
fc, i);
- fc_range_set = bt_field_class_unsigned_enumeration_mapping_borrow_ranges_const(
+ fc_range_set = bt_field_class_enumeration_unsigned_mapping_borrow_ranges_const(
fc_mapping);
}
mapping->label = bt_field_class_enumeration_mapping_get_label(
- bt_field_class_signed_enumeration_mapping_as_mapping_const(
+ bt_field_class_enumeration_signed_mapping_as_mapping_const(
fc_mapping));
mapping->ranges = range_set_to_int_ranges(fc_range_set,
is_signed);
g_string_append_c(ctx->str, '[');
switch (bt_field_path_get_root_scope(field_path)) {
- case BT_SCOPE_PACKET_CONTEXT:
+ case BT_FIELD_PATH_SCOPE_PACKET_CONTEXT:
write_str_prop_value(ctx, "Packet context");
break;
- case BT_SCOPE_EVENT_COMMON_CONTEXT:
+ case BT_FIELD_PATH_SCOPE_EVENT_COMMON_CONTEXT:
write_str_prop_value(ctx, "Event common context");
break;
- case BT_SCOPE_EVENT_SPECIFIC_CONTEXT:
+ case BT_FIELD_PATH_SCOPE_EVENT_SPECIFIC_CONTEXT:
write_str_prop_value(ctx, "Event specific context");
break;
- case BT_SCOPE_EVENT_PAYLOAD:
+ case BT_FIELD_PATH_SCOPE_EVENT_PAYLOAD:
write_str_prop_value(ctx, "Event payload");
break;
default:
bt_field_class_variant_option_get_name(option));
if (fc_type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR) {
- const bt_field_class_variant_with_unsigned_selector_option *spec_opt =
- bt_field_class_variant_with_unsigned_selector_borrow_option_by_index_const(
+ const bt_field_class_variant_with_selector_unsigned_option *spec_opt =
+ bt_field_class_variant_with_selector_unsigned_borrow_option_by_index_const(
fc, index);
orig_ranges =
- bt_field_class_variant_with_unsigned_selector_option_borrow_ranges_const(
+ bt_field_class_variant_with_selector_unsigned_option_borrow_ranges_const(
spec_opt);
is_signed = false;
} else {
- const bt_field_class_variant_with_signed_selector_option *spec_opt =
- bt_field_class_variant_with_signed_selector_borrow_option_by_index_const(
+ const bt_field_class_variant_with_selector_signed_option *spec_opt =
+ bt_field_class_variant_with_selector_signed_borrow_option_by_index_const(
fc, index);
orig_ranges =
- bt_field_class_variant_with_signed_selector_option_borrow_ranges_const(
+ bt_field_class_variant_with_selector_signed_option_borrow_ranges_const(
spec_opt);
is_signed = true;
}
/* Write field class's type */
switch (fc_type) {
+ case BT_FIELD_CLASS_TYPE_BOOL:
+ type = "Boolean";
+ break;
case BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER:
type = "Unsigned integer";
break;
case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY:
type = "Dynamic array";
break;
+ case BT_FIELD_CLASS_TYPE_OPTION:
+ type = "Option";
+ break;
case BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR:
type = "Variant (no selector)";
break;
if (fc_type == BT_FIELD_CLASS_TYPE_STATIC_ARRAY) {
g_string_append(ctx->str, " (Length ");
write_uint_prop_value(ctx,
- bt_field_class_static_array_get_length(fc));
+ bt_field_class_array_static_get_length(fc));
g_string_append_c(ctx->str, ')');
} else {
const bt_field_path *length_field_path =
- bt_field_class_dynamic_array_borrow_length_field_path_const(
+ bt_field_class_array_dynamic_borrow_length_field_path_const(
fc);
if (length_field_path) {
bt_field_class_array_borrow_element_field_class_const(fc));
decr_indent(ctx);
break;
+ case BT_FIELD_CLASS_TYPE_OPTION:
+ {
+ const bt_field_path *selector_field_path =
+ bt_field_class_option_borrow_selector_field_path_const(fc);
+
+ if (selector_field_path) {
+ g_string_append(ctx->str, " (Selector field path ");
+ write_field_path(ctx, selector_field_path);
+ g_string_append_c(ctx->str, ')');
+ }
+
+ g_string_append_c(ctx->str, ':');
+ write_nl(ctx);
+ incr_indent(ctx);
+ write_compound_member_name(ctx, "Content");
+ write_sp(ctx);
+ write_field_class(ctx,
+ bt_field_class_option_borrow_field_class_const(fc));
+ decr_indent(ctx);
+ break;
+ }
case BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR:
case BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR:
case BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR:
/* Write field's value */
switch (fc_type) {
+ case BT_FIELD_CLASS_TYPE_BOOL:
+ write_sp(ctx);
+ write_bool_prop_value(ctx, bt_field_bool_get_value(field));
+ break;
case BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER:
case BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION:
case BT_FIELD_CLASS_TYPE_SIGNED_INTEGER:
if (fc_type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER ||
fc_type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION) {
format_uint(buf,
- bt_field_unsigned_integer_get_value(field),
+ bt_field_integer_unsigned_get_value(field),
fmt_base);
write_sp(ctx);
write_uint_str_prop_value(ctx, buf);
} else {
format_int(buf,
- bt_field_signed_integer_get_value(field),
+ bt_field_integer_signed_get_value(field),
fmt_base);
write_sp(ctx);
write_int_str_prop_value(ctx, buf);
decr_indent(ctx);
break;
}
+ case BT_FIELD_CLASS_TYPE_OPTION:
+ {
+ const bt_field *content_field =
+ bt_field_option_borrow_field_const(field);
+
+ if (!content_field) {
+ write_sp(ctx);
+ write_none_prop_value(ctx, "None");
+ } else {
+ write_field(ctx, content_field, NULL);
+ }
+
+ break;
+ }
case BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR:
case BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR:
case BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR:
if (bt_value_get_type(value) ==
BT_VALUE_TYPE_SIGNED_INTEGER) {
write_int_prop_value(ctx,
- bt_value_signed_integer_get(value));
+ bt_value_integer_signed_get(value));
} else if (bt_value_get_type(value) ==
BT_VALUE_TYPE_STRING) {
write_str_prop_value(ctx,