Commit f94663fd authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix code generation of continuous signals

parent 387a16b5
......@@ -142,9 +142,10 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
=========
1.4.0 (06/2016)
1.4.1 (06/2016)
- Continuous states can check the presence of messages in the input queue
to respect the SDL semantics
- Bugfix in Ada code generator on continuous states
1.3.28 (06/2016)
- Excluded states (with *(statelist) ) were case sensitive
......
......@@ -730,7 +730,7 @@ package {process_name} is'''.format(process_name=process_name,
taste_template.append('trId : Integer := Id;')
if process.cs_mapping:
taste_template.append(
'msgPending : aliased asn1SccT_Boolean := True;')
'msgPending : aliased Asn1Boolean := True;')
# Declare the local variables needed by the transitions in the template
taste_template.extend(set(local_decl_transitions))
......@@ -774,6 +774,11 @@ package {process_name} is'''.format(process_name=process_name,
taste_template.append('if ctxt.initDone then')
taste_template.append("Check_Queue(msgPending'access);")
taste_template.append('end if;')
ads_template.append(
u'procedure Check_Queue(res: access Asn1Boolean);')
ads_template.append(
u'pragma import(C, Check_Queue, "{proc}_check_queue");'
.format(proc=process_name))
else:
taste_template.append('null;')
......@@ -802,13 +807,12 @@ package {process_name} is'''.format(process_name=process_name,
sep='elsif '
taste_template.extend(code)
done.append(statename)
taste_template.append(u'end if;')
taste_template.append(u'end if; -- inner') # inner if
sep = 'if '
break
extra_if = False
for statename in process.cs_mapping.viewkeys() - done:
extra_if = True
cs_item = process.cs_mapping[statename]
taste_template.append(u'-- Now what')
taste_template.append(u'{first}if not msgPending and '
u'trId = -1 and {}.state = {} then'
.format(LPREFIX, statename, first='els' if done else ''))
......@@ -818,13 +822,12 @@ package {process_name} is'''.format(process_name=process_name,
branch_to=trId, sep=sep, last=last)
sep='elsif '
taste_template.extend(code)
if process.cs_mapping:
taste_template.append(u'end if;')
if extra_if:
taste_template.append(u'end if;')
taste_template.append(u'end if;') # inner if
taste_template.append(u'end if;') # current state
sep = 'if '
taste_template.append('end loop;')
taste_template.append('ctxt.initDone := True;')
taste_template.append('{ctxt}.initDone := True;'.format(ctxt=LPREFIX))
taste_template.append('end runTransition;')
taste_template.append('\n')
......
......@@ -134,7 +134,7 @@ except ImportError:
__all__ = ['opengeode', 'SDL_Scene', 'SDL_View', 'parse']
__version__ = '1.4.0'
__version__ = '1.4.1'
if hasattr(sys, 'frozen'):
# Detect if we are running on Windows (py2exe-generated)
......
......@@ -18,24 +18,24 @@ signal telemetry(tm_type);
PROCESS og;
STATE AGGREGATION wait;
SUBSTRUCTURE
STATE mode_manager;
STATE memory_manager;
SUBSTRUCTURE
/* CIF START (359, 108), (70, 35) */
/* CIF START (259, 60), (70, 35) */
START;
/* CIF NEXTSTATE (331, 158), (126, 35) */
/* CIF NEXTSTATE (231, 110), (126, 35) */
NEXTSTATE wait_for_tc;
/* CIF STATE (331, 158), (126, 35) */
/* CIF STATE (231, 110), (126, 35) */
STATE wait_for_tc;
/* CIF PROVIDED (170, 213), (451, 35) */
PROVIDED got_tc=true and present(tc!content)=change_mode;
/* CIF PROCEDURECALL (282, 263), (226, 35) */
CALL writeln('Change Mode');
/* CIF TASK (320, 313), (151, 35) */
/* CIF PROVIDED (64, 165), (459, 35) */
PROVIDED got_tc=true and present(tc!content)=patch_memory;
/* CIF PROCEDURECALL (178, 215), (231, 35) */
CALL writeln('Patch Memory');
/* CIF TASK (218, 265), (151, 35) */
TASK got_tc := false
/* CIF COMMENT (491, 313), (216, 48) */
/* CIF COMMENT (389, 265), (216, 48) */
COMMENT 'Reset the flag to avoid
infinite loop';
/* CIF NEXTSTATE (360, 363), (70, 35) */
/* CIF NEXTSTATE (258, 315), (70, 35) */
NEXTSTATE -;
ENDSTATE;
ENDSUBSTRUCTURE;
......@@ -55,38 +55,42 @@ infinite loop';
NEXTSTATE -;
ENDSTATE;
ENDSUBSTRUCTURE;
STATE memory_manager;
STATE mode_manager;
SUBSTRUCTURE
/* CIF START (259, 60), (70, 35) */
/* CIF START (359, 108), (70, 35) */
START;
/* CIF NEXTSTATE (231, 110), (126, 35) */
/* CIF NEXTSTATE (331, 158), (126, 35) */
NEXTSTATE wait_for_tc;
/* CIF STATE (231, 110), (126, 35) */
/* CIF STATE (331, 158), (126, 35) */
STATE wait_for_tc;
/* CIF PROVIDED (64, 165), (459, 35) */
PROVIDED got_tc=true and present(tc!content)=patch_memory;
/* CIF PROCEDURECALL (178, 215), (231, 35) */
CALL writeln('Patch Memory');
/* CIF TASK (218, 265), (151, 35) */
/* CIF PROVIDED (68, 213), (360, 35) */
PROVIDED got_tc=true and present(tc!content)=change_mode;
/* CIF PROCEDURECALL (135, 263), (226, 35) */
CALL writeln('Change Mode');
/* CIF TASK (173, 313), (151, 35) */
TASK got_tc := false
/* CIF COMMENT (389, 265), (216, 48) */
/* CIF COMMENT (344, 313), (216, 48) */
COMMENT 'Reset the flag to avoid
infinite loop';
/* CIF NEXTSTATE (258, 315), (70, 35) */
/* CIF NEXTSTATE (213, 363), (70, 35) */
NEXTSTATE -;
/* CIF PROVIDED (570, 213), (110, 35) */
PROVIDED true = false;
/* CIF NEXTSTATE (590, 263), (70, 35) */
NEXTSTATE -;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF STATE (370, 97), (182, 35) */
STATE memory_manager;
/* CIF STATE (314, 191), (161, 35) */
STATE mode_manager;
ENDSTATE;
/* CIF STATE (238, 111), (113, 35) */
STATE tc_router;
ENDSTATE;
/* CIF STATE (314, 191), (161, 35) */
STATE mode_manager;
/* CIF STATE (370, 97), (182, 35) */
STATE memory_manager;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF TEXT (0, 310), (327, 208) */
/* CIF TEXT (622, 310), (327, 208) */
-- This system tests the provided clause
-- (continuous signal)
......@@ -102,6 +106,9 @@ dcl anything boolean_Type := true;
START;
/* CIF NEXTSTATE (336, 348), (99, 35) */
NEXTSTATE starting;
/* CIF STATE (333, 575), (70, 35) */
STATE wait;
ENDSTATE;
/* CIF STATE (485, 344), (99, 35) */
STATE starting;
/* CIF PROVIDED (481, 399), (106, 35) */
......@@ -113,9 +120,6 @@ dcl anything boolean_Type := true;
/* CIF NEXTSTATE (499, 549), (70, 35) */
NEXTSTATE wait;
ENDSTATE;
/* CIF STATE (333, 575), (70, 35) */
STATE wait;
ENDSTATE;
ENDPROCESS og;
ENDBLOCK;
ENDSYSTEM;
\ 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