static
void destroy_pretty_data(struct pretty_component *pretty)
{
+ uint64_t i;
if (!pretty) {
goto end;
}
perror("close output file");
}
}
+
+ for (i = 0; i < ENUMERATION_MAX_BITFLAGS_COUNT; i++) {
+ if (pretty->enum_bit_labels[i]) {
+ g_ptr_array_free(pretty->enum_bit_labels[i], true);
+ }
+ }
+
g_free(pretty->options.output_path);
g_free(pretty);
return NULL;
}
-BT_HIDDEN
void pretty_finalize(bt_self_component_sink *comp)
{
destroy_pretty_data(
return ret;
}
-BT_HIDDEN
bt_component_class_sink_graph_is_configured_method_status
pretty_graph_is_configured(bt_self_component_sink *self_comp_sink)
{
return status;
}
-BT_HIDDEN
bt_component_class_sink_consume_method_status pretty_consume(
bt_self_component_sink *comp)
{
bt_message_put_ref(msgs[i]);
}
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
+
end:
for (; i < count; i++) {
bt_message_put_ref(msgs[i]);
{ "field-loglevel", BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { .type = BT_VALUE_TYPE_BOOL } },
{ "field-emf", BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { .type = BT_VALUE_TYPE_BOOL } },
{ "field-callsite", BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { .type = BT_VALUE_TYPE_BOOL } },
+ { "print-enum-flags", BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { .type = BT_VALUE_TYPE_BOOL } },
BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_END
};
apply_one_bool_with_default("verbose", params,
&pretty->options.verbose, false);
+ apply_one_bool_with_default("print-enum-flags", params,
+ &pretty->options.print_enum_flags, false);
+
/* Names. */
value = bt_value_map_borrow_entry_value_const(params, "name-default");
if (value) {
}
}
-BT_HIDDEN
bt_component_class_initialize_method_status pretty_init(
bt_self_component_sink *self_comp_sink,
- bt_self_component_sink_configuration *config,
+ bt_self_component_sink_configuration *config __attribute__((unused)),
const bt_value *params,
- __attribute__((unused)) void *init_method_data)
+ void *init_method_data __attribute__((unused)))
{
bt_component_class_initialize_method_status status;
bt_self_component_add_port_status add_port_status;
}
set_use_colors(pretty);
+
+ if (pretty->options.print_enum_flags) {
+ uint64_t i;
+ /*
+ * Allocate all label arrays during the initialization of the
+ * component and reuse the same set of arrays for all
+ * enumerations.
+ */
+ for (i = 0; i < ENUMERATION_MAX_BITFLAGS_COUNT; i++) {
+ pretty->enum_bit_labels[i] = g_ptr_array_new();
+ }
+ }
bt_self_component_set_data(self_comp, pretty);
status = BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_OK;