Commit 309e3a5c authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Update statechart backend with continuous signals

parent 86b452a3
......@@ -393,3 +393,41 @@ symbol. In our case, the process, state and clipboard scenes. You can decide
at which place it will appear graphically - it respects the ordering of the
### Update the Statechart backend
Very few symbol changes imply a modification of the statechart renderer. It is
the case of the `continuous signals` because, like `inputs`, they can trigger
The `` file is containing the code that creates a graphviz
translation of the SDL model to render a statechart.
The function that needs to be updated is `create_dot_graph`. It takes a SDL
model (instance of AST) and generates a number of graphviz models, one for each
level of hierarchy if the SDL model contains state composition or aggregations.
What needs to be extended is the list of edges between the states.
It is easy here, we have to extend the creation of edges from:
for state, inputs in root_ast.mapping.viewitems():
# ... create edges triggered by inputs below states
for state, inputs in chain(root_ast.mapping.viewitems(),
# chain the input iterator with continuous signals
### Update the code generator backends
All backends use a Visitor design pattern (with Python's *singledispatch*
Updating backends with custom code generation features is therefore
straightforward. You need to find the parent function of your construct,
and create a new visitor function to generate the code corresponding you need
(or directly embed, depending on the complexity of the pattern).
The Ada code generator contains documentation and details on how to proceed
with updates. See `` file.
......@@ -22,6 +22,7 @@
import os
import logging
from collections import defaultdict
from itertools import chain
import re
from PySide import QtGui, QtCore
......@@ -568,7 +569,8 @@ def create_dot_graph(root_ast, basic=False):
# create a new node for each RETURN statement (in nested states)
ident = each.inputString or ' '
graph.add_node(ident, label=ident, shape='square', width=10.0 / 72.0)
for state, inputs in root_ast.mapping.viewitems():
for state, inputs in chain(root_ast.mapping.viewitems(),
# Add edges
transitions = \
inputs if not state.endswith('START') \
Supports Markdown
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