summaryrefslogtreecommitdiff
path: root/tools/dfagen/dfagen/output/dot.py
diff options
context:
space:
mode:
authorNicolas Schodet2009-05-08 23:07:25 +0200
committerNicolas Schodet2009-05-08 23:07:25 +0200
commitb566e4bcd0c7cb3c90ad941b37db223134090ded (patch)
tree7d3f24a25860e17e7fa9cd017ad2d8bd8c0bd227 /tools/dfagen/dfagen/output/dot.py
parent6b3d5061623a35c96e66e25fc14af6a9323f81b0 (diff)
* tools/dfagen:
- added state attributes. - added support for more than one initial state. - added table of transitions with only one default branch. - added state and event template parameter. - added --output-dir. - make template directory relative to config file. - more options checking. - added transition attributes and callback definition. - conserve input file order in output. - added --dump and more option checking. - fixed missing newline.
Diffstat (limited to 'tools/dfagen/dfagen/output/dot.py')
-rw-r--r--tools/dfagen/dfagen/output/dot.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/dfagen/dfagen/output/dot.py b/tools/dfagen/dfagen/output/dot.py
index d6cc057c..ce9c4db8 100644
--- a/tools/dfagen/dfagen/output/dot.py
+++ b/tools/dfagen/dfagen/output/dot.py
@@ -1,12 +1,13 @@
+import os.path
-def write (prefix, automaton, user):
+def write (prefix, automaton, user, outputdir):
output = prefix + '.dot'
- o = open (output, 'w')
+ o = open (os.path.join (outputdir, output), 'w')
o.write ('digraph %s {' % prefix)
- for s in automaton.states.values ():
+ for s in automaton.iter_states ():
o.write (' %s\n' % s.name)
- for tr in s.transitions.values ():
- for br in tr.branches.values ():
+ for tr in s.iter_transitions ():
+ for br in tr.iter_branches ():
o.write (' %(state)s -> %(to)s [ label = "%(event)s" ];\n'
% dict (
state = s.name,