[Gd-chatter] r11236 - in trunk/libraries: graphviz-renderer network/koala/sources/examples/code-browser
hannes at gwydiondylan.org
hannes at gwydiondylan.org
Sun Mar 11 18:24:42 CET 2007
Author: hannes
Date: Sun Mar 11 18:24:39 2007
New Revision: 11236
Modified:
trunk/libraries/graphviz-renderer/dot-generator.dylan
trunk/libraries/graphviz-renderer/graph-classes.dylan
trunk/libraries/graphviz-renderer/graphviz.dylan
trunk/libraries/graphviz-renderer/library.dylan
trunk/libraries/network/koala/sources/examples/code-browser/main.dylan
Log:
Job: minor
add support for node-attributes in dot-files
default to svg output instead of png
Modified: trunk/libraries/graphviz-renderer/dot-generator.dylan
==============================================================================
--- trunk/libraries/graphviz-renderer/dot-generator.dylan (original)
+++ trunk/libraries/graphviz-renderer/dot-generator.dylan Sun Mar 11 18:24:39 2007
@@ -30,6 +30,14 @@
write(output, concatenate(" \"", node.label, "\" -> \"",
target.label, "\"\n"));
end;
+ if (node.attributes.size > 0)
+ let attrs = make(<stretchy-vector>);
+ for (ele in key-sequence(node.attributes))
+ add!(attrs, concatenate(ele, " = \"", node.attributes[ele], "\""));
+ end;
+ attrs := reduce1(method(x, y) concatenate(x, ",", y) end, attrs);
+ write(output, concatenate(" \"", node.label, "\" [", attrs, "]\n"))
+ end;
do(print-edge, node.successors);
end;
Modified: trunk/libraries/graphviz-renderer/graph-classes.dylan
==============================================================================
--- trunk/libraries/graphviz-renderer/graph-classes.dylan (original)
+++ trunk/libraries/graphviz-renderer/graph-classes.dylan Sun Mar 11 18:24:39 2007
@@ -13,6 +13,7 @@
constant slot label :: <string> = "", init-keyword: label:;
constant slot outgoing-edges :: <stretchy-vector> = make(<stretchy-vector>);
constant slot incoming-edges :: <stretchy-vector> = make(<stretchy-vector>);
+ constant slot attributes :: <string-table> = make(<string-table>);
end;
define sealed class <edge> (<object>)
Modified: trunk/libraries/graphviz-renderer/graphviz.dylan
==============================================================================
--- trunk/libraries/graphviz-renderer/graphviz.dylan (original)
+++ trunk/libraries/graphviz-renderer/graphviz.dylan Sun Mar 11 18:24:39 2007
@@ -3,15 +3,15 @@
copyright: (C) 2007, All rights reversed.
-define function generate-graph (graph :: <graph>, top :: <node>)
+define function generate-graph (graph :: <graph>, top :: <node>, #key format = "svg")
=> (result-filename :: <string>)
- let file-prefix = concatenate("/tmp/foo", integer-to-string(random(10000)));
+ let file-prefix = concatenate("foo", integer-to-string(random(10000)));
let dot = concatenate(file-prefix, ".dot");
- let png = concatenate(file-prefix, ".png");
+ let output = concatenate(file-prefix, ".", format);
with-open-file (stream = dot, direction: #"output")
generate-dot(graph, stream, top-node: top);
end;
- run-application(concatenate("dot -Tpng -o ", png, " ", dot));
- png;
+ run-application(concatenate("dot -T", format, " -o ", output, " ", dot));
+ output;
end;
Modified: trunk/libraries/graphviz-renderer/library.dylan
==============================================================================
--- trunk/libraries/graphviz-renderer/library.dylan (original)
+++ trunk/libraries/graphviz-renderer/library.dylan Sun Mar 11 18:24:39 2007
@@ -24,5 +24,5 @@
create-node, create-edge,
generate-dot, generate-graph,
find-node, add-successors,
- add-predecessors;
-end;
\ No newline at end of file
+ add-predecessors, attributes;
+end;
Modified: trunk/libraries/network/koala/sources/examples/code-browser/main.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/examples/code-browser/main.dylan (original)
+++ trunk/libraries/network/koala/sources/examples/code-browser/main.dylan Sun Mar 11 18:24:39 2007
@@ -328,6 +328,9 @@
format-out("class node for %s was not found, creating\n", class-name);
class-node := create-node(graph, label: class-name);
end;
+ class-node.attributes["URL"] := "http://www.foo.com";
+ class-node.attributes["fillcolor"] := "red";
+ class-node.attributes["style"] := "filled";
add!(visited, class);
let superclasses
= class-direct-superclasses(project, class);
More information about the chatter
mailing list