Commit be957cab authored by Maxime Perrotin's avatar Maxime Perrotin

Set signallists at the right place for statecharts

parent 9d4787d1
......@@ -597,8 +597,15 @@ def create_dot_graph(root_ast,
ret = {'graph': graph, 'children': {}, 'config': {}}
diamond = 0
# input_signals include timers (set by caller)
input_signals = root_ast.all_signals
# Define the list of input signals including timers
if is_root:
input_signals = {sig['name'].lower() for sig in root_ast.input_signals}
for each in root_ast.timers:
input_signals.add(each)
# TODO: add continuous signals
else:
# set by recursive caller:
input_signals = root_ast.all_signals
# Add the Connect parts below nested states
for each in root_ast.content.states:
......@@ -631,7 +638,7 @@ def create_dot_graph(root_ast,
config_params = {"-Nfontsize" : "10",
"-Efontsize" : "8",
"-Gsplines" : "curved",
"-Gsep" : "0.2",
"-Gsep" : "0.3",
"-Gdpi" : "72",
"-Gstart" : "random10",
"-Goverlap" : "scale",
......
......@@ -1064,13 +1064,6 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
# in that case ast was provided in the parameters
LOG.debug("Statechart rendering: no CONTEXT.processes[0]")
# Create a simpler list of input signals including the timers
process_ast.all_signals = {sig['name'].lower()
for sig in process_ast.input_signals}
for each in process_ast.timers:
process_ast.all_signals.add(each)
# TODO: add continuous signals
# Flatten nested states (no, because neato does not support it,
# dot supports only vertically-aligned states, and fdp does not
# support curved edges and is buggy with pygraphviz anyway)
......
......@@ -7,17 +7,6 @@ process Controller;
START;
/* CIF NEXTSTATE (15, 119), (147, 35) */
NEXTSTATE Everybody_Stopped;
/* CIF state (237, 112), (73, 35) */
state Walking;
/* CIF input (238, 167), (70, 35) */
input Clock;
/* CIF output (211, 222), (124, 35) */
output Info_User (Wait);
/* CIF PROCEDURECALL (184, 277), (178, 35) */
call Set_Timer (2000, Clock);
/* CIF NEXTSTATE (210, 332), (127, 35) */
NEXTSTATE Walking_Is_Over;
endstate;
/* CIF state (430, 116), (127, 35) */
state Walking_Is_Over;
/* CIF input (373, 171), (70, 35) */
......@@ -31,6 +20,17 @@ process Controller;
/* CIF NEXTSTATE (504, 281), (70, 35) */
NEXTSTATE -;
endstate;
/* CIF state (237, 112), (73, 35) */
state Walking;
/* CIF input (238, 167), (70, 35) */
input Clock;
/* CIF output (211, 222), (124, 35) */
output Info_User (Wait);
/* CIF PROCEDURECALL (184, 277), (178, 35) */
call Set_Timer (2000, Clock);
/* CIF NEXTSTATE (210, 332), (127, 35) */
NEXTSTATE Walking_Is_Over;
endstate;
/* CIF state (15, 119), (147, 35) */
state Everybody_Stopped;
/* CIF input (53, 174), (70, 35) */
......@@ -93,28 +93,6 @@ process Controller;
START;
/* CIF NEXTSTATE (152, 90), (75, 35) */
NEXTSTATE Off;
/* CIF state (828, 314), (70, 35) */
state Green;
/* CIF connect (863, 369), (0, 35) */
connect Go_Orange;
/* CIF PROCEDURECALL (762, 419), (201, 35) */
call Set_Timer (2000, Clock);
/* CIF output (805, 474), (114, 35) */
output Color (Orange);
/* CIF NEXTSTATE (828, 524), (70, 35) */
NEXTSTATE Orange;
endstate;
/* CIF state (686, 61), (70, 35) */
state Orange;
/* CIF input (686, 116), (70, 35) */
input Clock;
/* CIF PROCEDURECALL (632, 171), (178, 35) */
call Set_Timer (1000, Clock);
/* CIF output (674, 226), (92, 35) */
output Color (Red);
/* CIF NEXTSTATE (686, 276), (70, 35) */
NEXTSTATE Red;
endstate;
/* CIF state (443, 49), (70, 35) */
state Red;
/* CIF connect (478, 104), (0, 35) */
......@@ -135,17 +113,39 @@ process Controller;
NEXTSTATE Green;
enddecision;
endstate;
/* CIF state (686, 61), (70, 35) */
state Orange;
/* CIF input (686, 116), (70, 35) */
input Clock;
/* CIF PROCEDURECALL (632, 171), (178, 35) */
call Set_Timer (1000, Clock);
/* CIF output (674, 226), (92, 35) */
output Color (Red);
/* CIF NEXTSTATE (686, 276), (70, 35) */
NEXTSTATE Red;
endstate;
/* CIF state (828, 314), (70, 35) */
state Green;
/* CIF connect (863, 369), (0, 35) */
connect Go_Orange;
/* CIF PROCEDURECALL (762, 419), (201, 35) */
call Set_Timer (2000, Clock);
/* CIF output (805, 474), (114, 35) */
output Color (Orange);
/* CIF NEXTSTATE (828, 524), (70, 35) */
NEXTSTATE Orange;
endstate;
/* CIF state (152, 90), (75, 35) */
state Off;
/* CIF input (122, 145), (134, 35) */
/* CIF input (121, 145), (134, 35) */
input Initialize (dummy);
/* CIF PROCEDURECALL (101, 200), (178, 35) */
/* CIF PROCEDURECALL (100, 200), (178, 35) */
call Set_Timer (1000, Clock);
/* CIF output (143, 255), (92, 35) */
/* CIF output (142, 255), (92, 35) */
output Color (Red);
/* CIF output (127, 310), (124, 35) */
/* CIF output (126, 310), (124, 35) */
output Info_User (Wait);
/* CIF NEXTSTATE (159, 360), (61, 35) */
/* CIF NEXTSTATE (158, 360), (61, 35) */
NEXTSTATE Red;
endstate;
endprocess Controller;
\ No newline at end of file
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