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