mie: select: add filename parameter to graphviz dump function
This commit is contained in:
@@ -43,6 +43,7 @@ MIE_API enum mie_status mie_select_graph_get_node(
|
||||
struct mie_type **values, size_t nr_values, struct mie_select_node **out);
|
||||
|
||||
MIE_API void mie_select_graph_dump_text(struct mie_select_graph *graph);
|
||||
MIE_API void mie_select_graph_dump_dot(struct mie_select_graph *graph);
|
||||
MIE_API void mie_select_graph_dump_dot(
|
||||
struct mie_select_graph *graph, const char *filename);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -54,7 +54,7 @@ static b_status write_operand_const(struct mie_value *value, b_stream *out)
|
||||
static void write_operand(struct mie_value *value, b_stream *out)
|
||||
{
|
||||
if (!value) {
|
||||
b_stream_write_fmt(out, NULL, "<null>");
|
||||
b_stream_write_fmt(out, NULL, "null");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ static void write_operand(struct mie_value *value, b_stream *out)
|
||||
break;
|
||||
default:
|
||||
b_stream_write_fmt(
|
||||
out, NULL, "<unknown-value:%d>", value->v_type->t_id);
|
||||
out, NULL, "unknown-value:%d", value->v_type->t_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -254,9 +254,9 @@ void mie_select_graph_dump_text(struct mie_select_graph *graph)
|
||||
}
|
||||
}
|
||||
|
||||
void mie_select_graph_dump_dot(struct mie_select_graph *graph)
|
||||
void mie_select_graph_dump_dot(struct mie_select_graph *graph, const char *filename)
|
||||
{
|
||||
FILE *fp = fopen("graph.dot", "w");
|
||||
FILE *fp = fopen(filename, "w");
|
||||
|
||||
b_stream *tmpstream = b_stream_open_fp(fp);
|
||||
|
||||
@@ -284,7 +284,9 @@ void mie_select_graph_dump_dot(struct mie_select_graph *graph)
|
||||
|
||||
b_stream_unref(tmpstream);
|
||||
|
||||
system("open graph.dot");
|
||||
char cmd[256];
|
||||
snprintf(cmd, sizeof cmd, "open %s", filename);
|
||||
system(cmd);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user