lib: rename inactivity msg to msg iterator inactivity msg
[babeltrace.git] / plugins / text / pretty / pretty.c
index abf14ecc7bd1b20d2f2b4ef42d4db8269e59ce10..63a6c879ac3b2b19fec94c8e34c7723999a9e048 100644 (file)
@@ -62,6 +62,9 @@ const char *plugin_options[] = {
        "field-callsite",
 };
 
+static
+const char * const in_port_name = "in";
+
 static
 void destroy_pretty_data(struct pretty_component *pretty)
 {
@@ -121,27 +124,28 @@ void pretty_finalize(bt_self_component_sink *comp)
 }
 
 static
-enum bt_self_component_status handle_message(
+bt_self_component_status handle_message(
                struct pretty_component *pretty,
                const bt_message *message)
 {
-       enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
+       bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
 
        BT_ASSERT(pretty);
 
        switch (bt_message_get_type(message)) {
-       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
-               if (pretty_print_packet(pretty, message)) {
-                       ret = BT_SELF_COMPONENT_STATUS_ERROR;
-               }
-               break;
        case BT_MESSAGE_TYPE_EVENT:
                if (pretty_print_event(pretty, message)) {
                        ret = BT_SELF_COMPONENT_STATUS_ERROR;
                }
                break;
-       case BT_MESSAGE_TYPE_INACTIVITY:
-               fprintf(stderr, "Inactivity message\n");
+       case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
+               fprintf(stderr, "Message iterator inactivity message\n");
+               break;
+       case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
+       case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
+               if (pretty_print_discarded_items(pretty, message)) {
+                       ret = BT_SELF_COMPONENT_STATUS_ERROR;
+               }
                break;
        default:
                break;
@@ -151,12 +155,10 @@ enum bt_self_component_status handle_message(
 }
 
 BT_HIDDEN
-enum bt_self_component_status pretty_port_connected(
-               bt_self_component_sink *comp,
-               bt_self_component_port_input *self_port,
-               const bt_port_output *other_port)
+bt_self_component_status pretty_graph_is_configured(
+               bt_self_component_sink *comp)
 {
-       enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+       bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
        struct pretty_component *pretty;
 
        pretty = bt_self_component_get_data(
@@ -164,7 +166,8 @@ enum bt_self_component_status pretty_port_connected(
        BT_ASSERT(pretty);
        BT_ASSERT(!pretty->iterator);
        pretty->iterator = bt_self_component_port_input_message_iterator_create(
-               self_port);
+               bt_self_component_sink_borrow_input_port_by_name(comp,
+                       in_port_name));
        if (!pretty->iterator) {
                status = BT_SELF_COMPONENT_STATUS_NOMEM;
        }
@@ -173,15 +176,15 @@ enum bt_self_component_status pretty_port_connected(
 }
 
 BT_HIDDEN
-enum bt_self_component_status pretty_consume(
+bt_self_component_status pretty_consume(
                bt_self_component_sink *comp)
 {
-       enum bt_self_component_status ret;
+       bt_self_component_status ret;
        bt_message_array_const msgs;
        bt_self_component_port_input_message_iterator *it;
        struct pretty_component *pretty = bt_self_component_get_data(
                bt_self_component_sink_as_self_component(comp));
-       enum bt_message_iterator_status it_ret;
+       bt_message_iterator_status it_ret;
        uint64_t count = 0;
        uint64_t i = 0;
 
@@ -235,7 +238,7 @@ int add_params_to_map(bt_value *plugin_opt_map)
 
        for (i = 0; i < BT_ARRAY_SIZE(plugin_options); i++) {
                const char *key = plugin_options[i];
-               enum bt_value_status status;
+               bt_value_status status;
 
                status = bt_value_map_insert_entry(plugin_opt_map, key,
                        bt_value_null);
@@ -340,7 +343,7 @@ static
 int apply_params(struct pretty_component *pretty, const bt_value *params)
 {
        int ret = 0;
-       enum bt_value_status status;
+       bt_value_status status;
        bool value, found;
        char *str = NULL;
 
@@ -636,12 +639,12 @@ void init_stream_packet_context_quarks(void)
 }
 
 BT_HIDDEN
-enum bt_self_component_status pretty_init(
+bt_self_component_status pretty_init(
                bt_self_component_sink *comp,
                const bt_value *params,
                UNUSED_VAR void *init_method_data)
 {
-       enum bt_self_component_status ret;
+       bt_self_component_status ret;
        struct pretty_component *pretty = create_pretty();
 
        if (!pretty) {
@@ -649,7 +652,8 @@ enum bt_self_component_status pretty_init(
                goto end;
        }
 
-       ret = bt_self_component_sink_add_input_port(comp, "in", NULL, NULL);
+       ret = bt_self_component_sink_add_input_port(comp, in_port_name,
+               NULL, NULL);
        if (ret != BT_SELF_COMPONENT_STATUS_OK) {
                goto end;
        }
This page took 0.025203 seconds and 4 git commands to generate.