/*
- * babeltrace.c
- *
- * Babeltrace Trace Converter
- *
* Copyright 2010-2011 EfficiOS Inc. and Linux Foundation
*
* Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
};
/* Application's processing graph (weak) */
-static struct bt_graph *the_graph;
+static struct bt_private_graph *the_graph;
static struct bt_query_executor *the_query_executor;
static bool canceled = false;
GPtrArray *loaded_plugins;
#ifdef __MINGW32__
+
#include <windows.h>
static
BOOL WINAPI signal_handler(DWORD signal) {
if (the_graph) {
- bt_graph_cancel(the_graph);
+ bt_private_graph_cancel(the_graph);
}
canceled = true;
BT_LOGE("Failed to set the ctrl+c handler.");
}
}
+
#else /* __MINGW32__ */
+
static
void signal_handler(int signum)
{
}
if (the_graph) {
- bt_graph_cancel(the_graph);
+ bt_private_graph_cancel(the_graph);
}
if (the_query_executor) {
sigaction(SIGINT, &new_action, NULL);
}
}
+
#endif /* __MINGW32__ */
static
GHashTable *components;
/* Owned by this */
- struct bt_graph *graph;
+ struct bt_private_graph *graph;
/* Weak */
struct bt_config *cfg;
ret = 0;
ctx->connect_ports = false;
- graph_status = bt_graph_add_component(ctx->graph,
+ graph_status = bt_private_graph_add_component(ctx->graph,
trimmer_class, trimmer_name,
bt_value_borrow_from_private(trimmer_params),
&trimmer);
}
/* We have a winner! */
- status = bt_graph_connect_ports(ctx->graph,
+ status = bt_private_graph_connect_ports(ctx->graph,
upstream_port, downstream_port, NULL);
BT_OBJECT_PUT_REF_AND_RESET(downstream_port);
switch (status) {
}
}
- ctx->graph = bt_graph_create();
+ ctx->graph = bt_private_graph_create();
if (!ctx->graph) {
goto error;
}
the_graph = ctx->graph;
- ret = bt_graph_add_port_added_listener(ctx->graph,
+ ret = bt_private_graph_add_port_added_listener(ctx->graph,
graph_port_added_listener, NULL, ctx);
if (ret < 0) {
BT_LOGE_STR("Cannot add \"port added\" listener to graph.");
goto error;
}
- ret = bt_graph_add_port_removed_listener(ctx->graph,
+ ret = bt_private_graph_add_port_removed_listener(ctx->graph,
graph_port_removed_listener, NULL, ctx);
if (ret < 0) {
BT_LOGE_STR("Cannot add \"port removed\" listener to graph.");
goto error;
}
- ret = bt_graph_add_ports_connected_listener(ctx->graph,
+ ret = bt_private_graph_add_ports_connected_listener(ctx->graph,
graph_ports_connected_listener, NULL, ctx);
if (ret < 0) {
BT_LOGE_STR("Cannot add \"ports connected\" listener to graph.");
goto error;
}
- ret = bt_graph_add_ports_disconnected_listener(ctx->graph,
+ ret = bt_private_graph_add_ports_disconnected_listener(ctx->graph,
graph_ports_disconnected_listener, NULL, ctx);
if (ret < 0) {
BT_LOGE_STR("Cannot add \"ports disconnected\" listener to graph.");
goto error;
}
- ret = bt_graph_add_component(ctx->graph, comp_cls,
+ ret = bt_private_graph_add_component(ctx->graph, comp_cls,
cfg_comp->instance_name->str,
bt_value_borrow_from_private(cfg_comp->params), &comp);
if (ret) {
/* Run the graph */
while (true) {
- enum bt_graph_status graph_status = bt_graph_run(ctx.graph);
+ enum bt_graph_status graph_status = bt_private_graph_run(ctx.graph);
/*
* Reset console in case something messed with console
printf("%s", bt_common_color_reset());
fflush(stdout);
fprintf(stderr, "%s", bt_common_color_reset());
- BT_LOGV("bt_graph_run() returned: status=%s",
+ BT_LOGV("bt_private_graph_run() returned: status=%s",
bt_graph_status_str(graph_status));
switch (graph_status) {
BT_LOGI_STR("Graph was canceled by user.");
goto error;
case BT_GRAPH_STATUS_AGAIN:
- if (bt_graph_is_canceled(ctx.graph)) {
+ if (bt_graph_is_canceled(
+ bt_graph_borrow_from_private(ctx.graph))) {
BT_LOGI_STR("Graph was canceled by user.");
goto error;
}
cfg->cmd_data.run.retry_duration_us);
if (usleep(cfg->cmd_data.run.retry_duration_us)) {
- if (bt_graph_is_canceled(ctx.graph)) {
+ if (bt_graph_is_canceled(
+ bt_graph_borrow_from_private(ctx.graph))) {
BT_LOGI_STR("Graph was canceled by user.");
goto error;
}