aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-03-14 06:38:00 +0000
committerDavid Robillard <d@drobilla.net>2007-03-14 06:38:00 +0000
commitcb6ecc0c93b7ea7624dba5d633ff0f15980c4274 (patch)
treeeedd760afca1f4b5833d6f65ab43f232f5863dd0
parent2ee0bc08ac0ab14c870542ea182abf7bf0031dcc (diff)
downloadmachina-cb6ecc0c93b7ea7624dba5d633ff0f15980c4274.tar.gz
machina-cb6ecc0c93b7ea7624dba5d633ff0f15980c4274.tar.bz2
machina-cb6ecc0c93b7ea7624dba5d633ff0f15980c4274.zip
Serialization bug fixes.
git-svn-id: http://svn.drobilla.net/lad/machina@361 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/engine/Edge.cpp6
-rw-r--r--src/engine/Machine.cpp3
-rwxr-xr-xutil/machina2dot.py13
3 files changed, 10 insertions, 12 deletions
diff --git a/src/engine/Edge.cpp b/src/engine/Edge.cpp
index 16bc202..1a7d236 100644
--- a/src/engine/Edge.cpp
+++ b/src/engine/Edge.cpp
@@ -40,11 +40,7 @@ Edge::write_state(Raul::RDFWriter& writer)
if (!src || !dst)
return;
- if (!src->id())
- src->set_id(writer.blank_id());
-
- if (!dst->id())
- dst->set_id(writer.blank_id());
+ assert(src->id() && dst->id());
writer.write(_id,
RdfId(RdfId::RESOURCE, "machina:tail"),
diff --git a/src/engine/Machine.cpp b/src/engine/Machine.cpp
index e88a78e..f76dd5c 100644
--- a/src/engine/Machine.cpp
+++ b/src/engine/Machine.cpp
@@ -244,6 +244,9 @@ Machine::write_state(Raul::RDFWriter& writer)
RdfId(RdfId::RESOURCE, "machina:node"),
(*n)->id());
}
+ }
+
+ for (Nodes::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) {
for (Node::Edges::const_iterator e = (*n)->outgoing_edges().begin();
e != (*n)->outgoing_edges().end(); ++e) {
diff --git a/util/machina2dot.py b/util/machina2dot.py
index fc3c6b5..eb89ec8 100755
--- a/util/machina2dot.py
+++ b/util/machina2dot.py
@@ -15,9 +15,8 @@ parser.parse_into_model(model, "file:" + sys.argv[1])
print """
digraph finite_state_machine {
- rankdir=TD;
- size="20,20"
- node [shape = doublecircle, width = 1.25 ];
+ rankdir=LR;
+ node [shape = doublecircle ];
""",
node_durations = { }
@@ -35,10 +34,10 @@ for result in initial_nodes_query.execute(model):
node_id = result['n'].blank_identifier
duration = float(result['dur'].literal_value['string'])
node_durations[node_id] = duration
- print '\t', node_id, "[ label = \"d:", duration, "\"];"
+ print '\t', node_id, "[ label = \"d =", duration, "\"];"
-print "\tnode [shape = circle, width = 1.25 ];"
+print "\tnode [shape = circle ];"
nodes_query = RDF.SPARQLQuery("""
@@ -54,7 +53,7 @@ for result in nodes_query.execute(model):
node_id = result['n'].blank_identifier
duration = float(result['dur'].literal_value['string'])
node_durations[node_id] = duration
- print '\t', node_id, "[ label = \"d:", duration, "\"]; "
+ print '\t', node_id, "[ label = \"d =", duration, "\"]; "
edge_query = RDF.SPARQLQuery("""
@@ -71,6 +70,6 @@ for edge in edge_query.execute(model):
print '\t', edge['tail'].blank_identifier, ' -> ',
print edge['head'].blank_identifier, ' ',
print "[ label = \"", edge['prob'].literal_value['string'], "\" ",
- print "minlen = ", node_durations[edge['tail'].blank_identifier] * 7.5, " ];"
+ print "minlen = ", node_durations[edge['tail'].blank_identifier] * 2, " ];"
print "}"