Commit 56dbb587 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Support priorities of continuous signals in Ada backend

parent c8d41eef
......@@ -142,6 +142,9 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
=========
1.4.3 (06/2016)
- Add support for priority of continuous signals in Ada code generator
1.4.2 (06/2016)
- Reload / render properly priority of continuous signals
......
......@@ -166,7 +166,7 @@ def _process(process, simu=False, **kwargs):
asn1_filenames = ' '.join(parent.asn1_filenames)
asn1_uniq = ' '.join(each for each in parent.asn1_filenames
if each != 'dataview-uniq.asn')
pr_path = ' '.join(parent.pr_files)
pr_path = ' '.join(parent.pr_files) if None not in parent.pr_files else ''
pr_names = ' '.join(
os.path.basename(pr_file) for pr_file in parent.pr_files)
asn1_modules = (name.lower().replace('-', '_') + '.o'
......@@ -798,7 +798,15 @@ package {process_name} is'''.format(process_name=process_name,
.format(ctxt=LPREFIX, s1=agg_name,
s2=each.statename, unisep=UNICODE_SEP,
s3=statename, first='els' if done else ''))
for provided_clause in cs_item:
# Change priority 0 (no priority set) to lowest priority
lowest_priority = max(item.priority for item in cs_item)
for each in cs_item:
if each.priority == 0:
each.priority = lowest_priority + 1
for provided_clause in sorted(cs_item,
key=lambda itm: itm.priority):
taste_template.append(u'-- Priority {}'
.format(provided_clause.priority))
trId = process.transitions.index\
(provided_clause.transition)
code, loc = generate(provided_clause.trigger,
......@@ -816,7 +824,15 @@ package {process_name} is'''.format(process_name=process_name,
taste_template.append(u'{first}if not msgPending and '
u'trId = -1 and {}.state = {} then'
.format(LPREFIX, statename, first='els' if done else ''))
for provided_clause in cs_item:
# Change priority 0 (no priority set) to lowest priority
lowest_priority = max(item.priority for item in cs_item)
for each in cs_item:
if each.priority == 0:
each.priority = lowest_priority + 1
for provided_clause in sorted(cs_item,
key=lambda itm: itm.priority):
taste_template.append(u'-- Priority {}'
.format(provided_clause.priority))
trId = process.transitions.index(provided_clause.transition)
code, loc = generate(provided_clause.trigger,
branch_to=trId, sep=sep, last=last)
......
......@@ -4288,7 +4288,8 @@ def pr_file(root):
# and data typess references.
processes, uses, systems = [], [], []
for child in root.getChildren():
ast.pr_files.add(node_filename(child))
if node_filename(child) is not None:
ast.pr_files.add(node_filename(child))
if child.type == lexer.PROCESS:
processes.append(child)
elif child.type == lexer.USE:
......
......@@ -134,7 +134,7 @@ except ImportError:
__all__ = ['opengeode', 'SDL_Scene', 'SDL_View', 'parse']
__version__ = '1.4.2'
__version__ = '1.4.3'
if hasattr(sys, 'frozen'):
# Detect if we are running on Windows (py2exe-generated)
......
......@@ -16,40 +16,50 @@ signal telemetry(tm_type);
CONNECT c AND r;
/* CIF PROCESS (225, 49), (150, 75) */
PROCESS og;
STATE safe;
SUBSTRUCTURE
/* CIF START (153, 96), (70, 35) */
START;
/* CIF NEXTSTATE (135, 146), (105, 35) */
NEXTSTATE Inside_safe;
/* CIF STATE (301, 97), (106, 35) */
STATE Inside_safe;
ENDSTATE;
ENDSUBSTRUCTURE;
STATE AGGREGATION wait;
SUBSTRUCTURE
STATE generic_tc_handler_1;
STATE exception_handler;
SUBSTRUCTURE
/* CIF TEXT (131, 91), (323, 140) */
-- Model a generic TC handler. The content of this
-- state can be copied several times, to manage
-- several TC in parallel.
/* CIF ENDTEXT */
/* CIF START (490, 84), (70, 35) */
/* CIF START (264, 78), (70, 35) */
START;
/* CIF NEXTSTATE (472, 134), (106, 35) */
/* CIF NEXTSTATE (246, 128), (106, 35) */
NEXTSTATE wait_for_tc;
/* CIF STATE (667, 182), (123, 35) */
STATE Processing_tc;
/* CIF INPUT (689, 237), (78, 35) */
INPUT timer1;
/* CIF PROCEDURECALL (631, 287), (193, 35) */
CALL writeln('TC1 completed');
/* CIF NEXTSTATE (675, 337), (106, 35) */
NEXTSTATE wait_for_tc;
ENDSTATE;
/* CIF STATE (472, 134), (106, 35) */
/* CIF STATE (246, 128), (106, 35) */
STATE wait_for_tc;
/* CIF PROVIDED (485, 189), (79, 35) */
/* CIF PROVIDED (252, 183), (93, 38) */
PROVIDED got_tc;
/* CIF TASK (461, 239), (126, 35) */
TASK got_tc := false;
/* CIF PROCEDURECALL (427, 289), (194, 35) */
CALL writeln('Processing TC 1');
/* CIF PROCEDURECALL (432, 339), (184, 35) */
CALL set_timer(5000, timer1);
/* CIF NEXTSTATE (461, 389), (126, 35) */
NEXTSTATE Processing_TC;
/* CIF PROCEDURECALL (117, 236), (363, 35) */
CALL writeln('ERROR, all TC handlers are busy - discarding');
/* CIF TASK (225, 286), (147, 35) */
TASK failure := true;
/* CIF NEXTSTATE (263, 336), (70, 35) */
NEXTSTATE -;
ENDSTATE;
ENDSUBSTRUCTURE;
STATE tc_router;
SUBSTRUCTURE
/* CIF START (144, 56), (70, 35) */
START;
/* CIF NEXTSTATE (116, 106), (126, 35) */
NEXTSTATE wait_for_tc;
/* CIF STATE (116, 106), (126, 35) */
STATE wait_for_tc;
/* CIF INPUT (93, 161), (175, 35) */
INPUT telecommand(tc);
/* CIF TASK (107, 211), (146, 35) */
TASK got_tc := true;
/* CIF NEXTSTATE (145, 261), (70, 35) */
NEXTSTATE -;
ENDSTATE;
ENDSUBSTRUCTURE;
STATE generic_tc_handler_2;
......@@ -86,61 +96,51 @@ signal telemetry(tm_type);
NEXTSTATE Processing_TC;
ENDSTATE;
ENDSUBSTRUCTURE;
STATE tc_router;
STATE generic_tc_handler_1;
SUBSTRUCTURE
/* CIF START (144, 56), (70, 35) */
/* CIF TEXT (131, 91), (323, 140) */
-- Model a generic TC handler. The content of this
-- state can be copied several times, to manage
-- several TC in parallel.
/* CIF ENDTEXT */
/* CIF START (490, 84), (70, 35) */
START;
/* CIF NEXTSTATE (116, 106), (126, 35) */
/* CIF NEXTSTATE (472, 134), (106, 35) */
NEXTSTATE wait_for_tc;
/* CIF STATE (116, 106), (126, 35) */
STATE wait_for_tc;
/* CIF INPUT (93, 161), (175, 35) */
INPUT telecommand(tc);
/* CIF TASK (107, 211), (146, 35) */
TASK got_tc := true;
/* CIF NEXTSTATE (145, 261), (70, 35) */
NEXTSTATE -;
/* CIF STATE (667, 182), (123, 35) */
STATE Processing_tc;
/* CIF INPUT (689, 237), (78, 35) */
INPUT timer1;
/* CIF PROCEDURECALL (631, 287), (193, 35) */
CALL writeln('TC1 completed');
/* CIF NEXTSTATE (675, 337), (106, 35) */
NEXTSTATE wait_for_tc;
ENDSTATE;
ENDSUBSTRUCTURE;
STATE exception_handler;
SUBSTRUCTURE
/* CIF START (264, 78), (70, 35) */
START;
/* CIF NEXTSTATE (246, 128), (106, 35) */
NEXTSTATE wait_for_tc;
/* CIF STATE (246, 128), (106, 35) */
/* CIF STATE (472, 134), (106, 35) */
STATE wait_for_tc;
/* CIF PROVIDED (252, 183), (93, 38) */
/* CIF PROVIDED (485, 189), (79, 35) */
PROVIDED got_tc;
/* CIF PROCEDURECALL (117, 236), (363, 35) */
CALL writeln('ERROR, all TC handlers are busy - discarding');
/* CIF TASK (225, 286), (147, 35) */
TASK failure := true;
/* CIF NEXTSTATE (263, 336), (70, 35) */
NEXTSTATE -;
/* CIF TASK (461, 239), (126, 35) */
TASK got_tc := false;
/* CIF PROCEDURECALL (427, 289), (194, 35) */
CALL writeln('Processing TC 1');
/* CIF PROCEDURECALL (432, 339), (184, 35) */
CALL set_timer(5000, timer1);
/* CIF NEXTSTATE (461, 389), (126, 35) */
NEXTSTATE Processing_TC;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF STATE (443, 507), (153, 35) */
STATE exception_handler;
ENDSTATE;
/* CIF STATE (370, 0), (113, 35) */
STATE tc_router;
/* CIF STATE (370, 168), (182, 35) */
STATE generic_tc_handler_1;
ENDSTATE;
/* CIF STATE (381, 338), (169, 35) */
STATE generic_tc_handler_2;
ENDSTATE;
/* CIF STATE (370, 168), (182, 35) */
STATE generic_tc_handler_1;
/* CIF STATE (226, 0), (113, 35) */
STATE tc_router;
ENDSTATE;
ENDSUBSTRUCTURE;
STATE safe;
SUBSTRUCTURE
/* CIF START (153, 96), (70, 35) */
START;
/* CIF NEXTSTATE (135, 146), (105, 35) */
NEXTSTATE Inside_safe;
/* CIF STATE (301, 97), (106, 35) */
STATE Inside_safe;
/* CIF STATE (443, 507), (153, 35) */
STATE exception_handler;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF TEXT (665, 310), (327, 208) */
......@@ -161,18 +161,22 @@ timer timer1, timer2;
START;
/* CIF NEXTSTATE (354, 348), (63, 35) */
NEXTSTATE wait;
/* CIF STATE (347, 583), (70, 35) */
STATE safe;
ENDSTATE;
/* CIF STATE (485, 344), (99, 35) */
STATE wait;
/* CIF PROVIDED (485, 399), (97, 38) */
/* CIF PROVIDED (345, 399), (97, 38) */
PROVIDED failure;
priority 1;
/* CIF PROCEDURECALL (401, 455), (264, 35) */
priority 2;
/* CIF PROCEDURECALL (261, 455), (264, 35) */
CALL writeln('Going to SAFE mode');
/* CIF NEXTSTATE (498, 505), (70, 35) */
/* CIF NEXTSTATE (358, 505), (70, 35) */
NEXTSTATE safe;
/* CIF PROVIDED (535, 399), (113, 38) */
PROVIDED true = false;;
/* CIF NEXTSTATE (556, 452), (70, 35) */
NEXTSTATE wait;
ENDSTATE;
/* CIF STATE (347, 583), (70, 35) */
STATE safe;
ENDSTATE;
ENDPROCESS og;
ENDBLOCK;
......
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