Commit 041b7ab8 authored by Øyvind Kolås's avatar Øyvind Kolås

show pads in dot view

parent 6845908d
2006-12-27 Øyvind Kolås <pippin@gimp.org>
* bin/gegl-dot.c: (gegl_to_dot): show input/output pads involved in
connections.
2006-12-27 Øyvind Kolås <pippin@gimp.org>
* bin/gegl-dot.[ch]: NEW files with a function to create a graphviz
compatible description of a given graph.
* bin/Makefile.am: added gegl-dot.[ch]
* bin/gegl-options.[c]: added --dot commandline option.
* bin/gegl-options.[ch]: added --dot commandline option.
* bin/gegl.c: (main): handle --dot.
2006-12-26 Øyvind Kolås <pippin@gimp.org>
......
......@@ -24,7 +24,7 @@ gchar *
gegl_to_dot (GeglNode *node)
{
GeglGraph *graph = GEGL_GRAPH (node);
GString *string = g_string_new ("digraph gegl {\n");
GString *string = g_string_new ("digraph gegl { graph [ rankdir = \"LR\"];\n");
{
GList *nodes = gegl_graph_get_children (graph);
......@@ -34,8 +34,40 @@ gegl_to_dot (GeglNode *node)
{
GeglNode *node = entry->data;
gchar buf[512];
sprintf (buf, "op_%p [label=\"%s\"];\n", node, gegl_node_get_debug_name (node));
sprintf (buf, "op_%p [label=\"%s\\n", node, gegl_node_get_debug_name (node));
g_string_append (string, buf);
if(0){
guint n_properties;
GParamSpec **properties = gegl_node_get_properties (node, &n_properties);
gint i;
for (i=0;i<n_properties;i++)
{
sprintf (buf, "%s=%s\\n", properties[i]->name, "foo");
g_string_append (string, buf);
}
g_free (properties);
}
g_string_append (string, "\\n");
{
GList *pads = gegl_node_get_pads (node);
GList *entry = pads;
while (entry)
{
GeglPad *pad = entry->data;
sprintf (buf, "|<%s>%s", gegl_pad_get_name (pad),
gegl_pad_get_name (pad));
g_string_append (string, buf);
entry = g_list_next (entry);
}
}
sprintf (buf, "\"\n shape=\"record\"];\n");
g_string_append (string, buf);
entry = g_list_next (entry);
}
......@@ -60,11 +92,17 @@ gegl_to_dot (GeglNode *node)
gchar buf[512];
GeglNode *source;
GeglNode *sink;
GeglPad *source_pad;
GeglPad *sink_pad;
source = gegl_connection_get_source_node (connection);
sink = gegl_connection_get_sink_node (connection);
source_pad = gegl_connection_get_source_pad (connection);
sink_pad = gegl_connection_get_sink_pad (connection);
sprintf (buf, "op_%p -> op_%p;\n", source, sink);
sprintf (buf, "op_%p:%s -> op_%p:%s;\n", source,
gegl_pad_get_name (source_pad), sink,
gegl_pad_get_name (sink_pad));
g_string_append (string, buf);
entry = g_list_next (entry);
}
......@@ -82,3 +120,4 @@ gegl_to_dot (GeglNode *node)
g_string_append (string, "}");
return g_string_free (string, FALSE);
}
......@@ -25,6 +25,7 @@
typedef enum
{
GEGL_RUN_MODE_HELP,
GEGL_RUN_MODE_DOT,
GEGL_RUN_MODE_EDITOR,
GEGL_RUN_MODE_PNG,
GEGL_RUN_MODE_XML
......
......@@ -24,7 +24,7 @@ gchar *
gegl_to_dot (GeglNode *node)
{
GeglGraph *graph = GEGL_GRAPH (node);
GString *string = g_string_new ("digraph gegl {\n");
GString *string = g_string_new ("digraph gegl { graph [ rankdir = \"LR\"];\n");
{
GList *nodes = gegl_graph_get_children (graph);
......@@ -34,8 +34,40 @@ gegl_to_dot (GeglNode *node)
{
GeglNode *node = entry->data;
gchar buf[512];
sprintf (buf, "op_%p [label=\"%s\"];\n", node, gegl_node_get_debug_name (node));
sprintf (buf, "op_%p [label=\"%s\\n", node, gegl_node_get_debug_name (node));
g_string_append (string, buf);
if(0){
guint n_properties;
GParamSpec **properties = gegl_node_get_properties (node, &n_properties);
gint i;
for (i=0;i<n_properties;i++)
{
sprintf (buf, "%s=%s\\n", properties[i]->name, "foo");
g_string_append (string, buf);
}
g_free (properties);
}
g_string_append (string, "\\n");
{
GList *pads = gegl_node_get_pads (node);
GList *entry = pads;
while (entry)
{
GeglPad *pad = entry->data;
sprintf (buf, "|<%s>%s", gegl_pad_get_name (pad),
gegl_pad_get_name (pad));
g_string_append (string, buf);
entry = g_list_next (entry);
}
}
sprintf (buf, "\"\n shape=\"record\"];\n");
g_string_append (string, buf);
entry = g_list_next (entry);
}
......@@ -60,11 +92,17 @@ gegl_to_dot (GeglNode *node)
gchar buf[512];
GeglNode *source;
GeglNode *sink;
GeglPad *source_pad;
GeglPad *sink_pad;
source = gegl_connection_get_source_node (connection);
sink = gegl_connection_get_sink_node (connection);
source_pad = gegl_connection_get_source_pad (connection);
sink_pad = gegl_connection_get_sink_pad (connection);
sprintf (buf, "op_%p -> op_%p;\n", source, sink);
sprintf (buf, "op_%p:%s -> op_%p:%s;\n", source,
gegl_pad_get_name (source_pad), sink,
gegl_pad_get_name (sink_pad));
g_string_append (string, buf);
entry = g_list_next (entry);
}
......@@ -82,3 +120,4 @@ gegl_to_dot (GeglNode *node)
g_string_append (string, "}");
return g_string_free (string, FALSE);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment