Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
56dbb587
Commit
56dbb587
authored
Jun 23, 2016
by
Maxime Perrotin
Browse files
Support priorities of continuous signals in Ada backend
parent
c8d41eef
Changes
5
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
56dbb587
...
@@ -142,6 +142,9 @@ The background pattern was downloaded from www.subtlepatterns.com
...
@@ -142,6 +142,9 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
Changelog
=========
=========
1.
4.3 (06/2016)
-
Add support for priority of continuous signals in Ada code generator
1.
4.2 (06/2016)
1.
4.2 (06/2016)
-
Reload / render properly priority of continuous signals
-
Reload / render properly priority of continuous signals
...
...
opengeode/AdaGenerator.py
View file @
56dbb587
...
@@ -166,7 +166,7 @@ def _process(process, simu=False, **kwargs):
...
@@ -166,7 +166,7 @@ def _process(process, simu=False, **kwargs):
asn1_filenames
=
' '
.
join
(
parent
.
asn1_filenames
)
asn1_filenames
=
' '
.
join
(
parent
.
asn1_filenames
)
asn1_uniq
=
' '
.
join
(
each
for
each
in
parent
.
asn1_filenames
asn1_uniq
=
' '
.
join
(
each
for
each
in
parent
.
asn1_filenames
if
each
!=
'dataview-uniq.asn'
)
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
(
pr_names
=
' '
.
join
(
os
.
path
.
basename
(
pr_file
)
for
pr_file
in
parent
.
pr_files
)
os
.
path
.
basename
(
pr_file
)
for
pr_file
in
parent
.
pr_files
)
asn1_modules
=
(
name
.
lower
().
replace
(
'-'
,
'_'
)
+
'.o'
asn1_modules
=
(
name
.
lower
().
replace
(
'-'
,
'_'
)
+
'.o'
...
@@ -798,7 +798,15 @@ package {process_name} is'''.format(process_name=process_name,
...
@@ -798,7 +798,15 @@ package {process_name} is'''.format(process_name=process_name,
.
format
(
ctxt
=
LPREFIX
,
s1
=
agg_name
,
.
format
(
ctxt
=
LPREFIX
,
s1
=
agg_name
,
s2
=
each
.
statename
,
unisep
=
UNICODE_SEP
,
s2
=
each
.
statename
,
unisep
=
UNICODE_SEP
,
s3
=
statename
,
first
=
'els'
if
done
else
''
))
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
\
trId
=
process
.
transitions
.
index
\
(
provided_clause
.
transition
)
(
provided_clause
.
transition
)
code
,
loc
=
generate
(
provided_clause
.
trigger
,
code
,
loc
=
generate
(
provided_clause
.
trigger
,
...
@@ -816,7 +824,15 @@ package {process_name} is'''.format(process_name=process_name,
...
@@ -816,7 +824,15 @@ package {process_name} is'''.format(process_name=process_name,
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
''
))
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
)
trId
=
process
.
transitions
.
index
(
provided_clause
.
transition
)
code
,
loc
=
generate
(
provided_clause
.
trigger
,
code
,
loc
=
generate
(
provided_clause
.
trigger
,
branch_to
=
trId
,
sep
=
sep
,
last
=
last
)
branch_to
=
trId
,
sep
=
sep
,
last
=
last
)
...
...
opengeode/ogParser.py
View file @
56dbb587
...
@@ -4288,7 +4288,8 @@ def pr_file(root):
...
@@ -4288,7 +4288,8 @@ def pr_file(root):
# and data typess references.
# and data typess references.
processes
,
uses
,
systems
=
[],
[],
[]
processes
,
uses
,
systems
=
[],
[],
[]
for
child
in
root
.
getChildren
():
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
:
if
child
.
type
==
lexer
.
PROCESS
:
processes
.
append
(
child
)
processes
.
append
(
child
)
elif
child
.
type
==
lexer
.
USE
:
elif
child
.
type
==
lexer
.
USE
:
...
...
opengeode/opengeode.py
View file @
56dbb587
...
@@ -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.
2
'
__version__
=
'1.4.
3
'
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)
...
...
tests/regression/test-provided2/og.pr
View file @
56dbb587
...
@@ -16,40 +16,50 @@ signal telemetry(tm_type);
...
@@ -16,40 +16,50 @@ signal telemetry(tm_type);
CONNECT c AND r;
CONNECT c AND r;
/* CIF PROCESS (225, 49), (150, 75) */
/* CIF PROCESS (225, 49), (150, 75) */
PROCESS og;
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;
STATE AGGREGATION wait;
SUBSTRUCTURE
SUBSTRUCTURE
STATE
generic_tc
_handler
_1
;
STATE
exception
_handler;
SUBSTRUCTURE
SUBSTRUCTURE
/* CIF TEXT (131, 91), (323, 140) */
/* CIF START (264, 78), (70, 35) */
-- 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;
START;
/* CIF NEXTSTATE (
472
, 1
34
), (106, 35) */
/* CIF NEXTSTATE (
246
, 1
28
), (106, 35) */
NEXTSTATE wait_for_tc;
NEXTSTATE wait_for_tc;
/* CIF STATE (667, 182), (123, 35) */
/* CIF STATE (246, 128), (106, 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) */
STATE wait_for_tc;
STATE wait_for_tc;
/* CIF PROVIDED (
485
, 18
9
), (
7
9, 3
5
) */
/* CIF PROVIDED (
252
, 18
3
), (9
3
, 3
8
) */
PROVIDED got_tc;
PROVIDED got_tc;
/* CIF TASK (461, 239), (126, 35) */
/* CIF PROCEDURECALL (117, 236), (363, 35) */
TASK got_tc := false;
CALL writeln('ERROR, all TC handlers are busy - discarding');
/* CIF PROCEDURECALL (427, 289), (194, 35) */
/* CIF TASK (225, 286), (147, 35) */
CALL writeln('Processing TC 1');
TASK failure := true;
/* CIF PROCEDURECALL (432, 339), (184, 35) */
/* CIF NEXTSTATE (263, 336), (70, 35) */
CALL set_timer(5000, timer1);
NEXTSTATE -;
/* CIF NEXTSTATE (461, 389), (126, 35) */
ENDSTATE;
NEXTSTATE Processing_TC;
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;
ENDSTATE;
ENDSUBSTRUCTURE;
ENDSUBSTRUCTURE;
STATE generic_tc_handler_2;
STATE generic_tc_handler_2;
...
@@ -86,61 +96,51 @@ signal telemetry(tm_type);
...
@@ -86,61 +96,51 @@ signal telemetry(tm_type);
NEXTSTATE Processing_TC;
NEXTSTATE Processing_TC;
ENDSTATE;
ENDSTATE;
ENDSUBSTRUCTURE;
ENDSUBSTRUCTURE;
STATE
tc_router
;
STATE
generic_tc_handler_1
;
SUBSTRUCTURE
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;
START;
/* CIF NEXTSTATE (
116
, 1
06
), (1
2
6, 35) */
/* CIF NEXTSTATE (
472
, 1
34
), (1
0
6, 35) */
NEXTSTATE wait_for_tc;
NEXTSTATE wait_for_tc;
/* CIF STATE (
116
, 1
06
), (12
6
, 35) */
/* CIF STATE (
667
, 1
82
), (12
3
, 35) */
STATE
wait_for
_tc;
STATE
Processing
_tc;
/* CIF INPUT (
93, 161
), (
175
, 35) */
/* CIF INPUT (
689, 237
), (
78
, 35) */
INPUT t
elecommand(tc)
;
INPUT t
imer1
;
/* CIF
TASK (107
, 2
11
), (1
46
, 35) */
/* CIF
PROCEDURECALL (631
, 2
87
), (1
93
, 35) */
TASK got_tc := true
;
CALL writeln('TC1 completed')
;
/* CIF NEXTSTATE (
14
5,
261
), (
70
, 35) */
/* CIF NEXTSTATE (
67
5,
337
), (
106
, 35) */
NEXTSTATE
-
;
NEXTSTATE
wait_for_tc
;
ENDSTATE;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF STATE (472, 134), (106, 35) */
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) */
STATE wait_for_tc;
STATE wait_for_tc;
/* CIF PROVIDED (
252
, 18
3
), (9
3
, 3
8
) */
/* CIF PROVIDED (
485
, 18
9
), (
7
9, 3
5
) */
PROVIDED got_tc;
PROVIDED got_tc;
/* CIF PROCEDURECALL (117, 236), (363, 35) */
/* CIF TASK (461, 239), (126, 35) */
CALL writeln('ERROR, all TC handlers are busy - discarding');
TASK got_tc := false;
/* CIF TASK (225, 286), (147, 35) */
/* CIF PROCEDURECALL (427, 289), (194, 35) */
TASK failure := true;
CALL writeln('Processing TC 1');
/* CIF NEXTSTATE (263, 336), (70, 35) */
/* CIF PROCEDURECALL (432, 339), (184, 35) */
NEXTSTATE -;
CALL set_timer(5000, timer1);
/* CIF NEXTSTATE (461, 389), (126, 35) */
NEXTSTATE Processing_TC;
ENDSTATE;
ENDSTATE;
ENDSUBSTRUCTURE;
ENDSUBSTRUCTURE;
/* CIF STATE (443, 507), (153, 35) */
/* CIF STATE (370, 168), (182, 35) */
STATE exception_handler;
STATE generic_tc_handler_1;
ENDSTATE;
/* CIF STATE (370, 0), (113, 35) */
STATE tc_router;
ENDSTATE;
ENDSTATE;
/* CIF STATE (381, 338), (169, 35) */
/* CIF STATE (381, 338), (169, 35) */
STATE generic_tc_handler_2;
STATE generic_tc_handler_2;
ENDSTATE;
ENDSTATE;
/* CIF STATE (
370, 168
), (1
82
, 35) */
/* CIF STATE (
226, 0
), (1
13
, 35) */
STATE
generic_tc_handler_1
;
STATE
tc_router
;
ENDSTATE;
ENDSTATE;
ENDSUBSTRUCTURE;
/* CIF STATE (443, 507), (153, 35) */
STATE safe;
STATE exception_handler;
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;
ENDSTATE;
ENDSUBSTRUCTURE;
ENDSUBSTRUCTURE;
/* CIF TEXT (665, 310), (327, 208) */
/* CIF TEXT (665, 310), (327, 208) */
...
@@ -161,18 +161,22 @@ timer timer1, timer2;
...
@@ -161,18 +161,22 @@ timer timer1, timer2;
START;
START;
/* CIF NEXTSTATE (354, 348), (63, 35) */
/* CIF NEXTSTATE (354, 348), (63, 35) */
NEXTSTATE wait;
NEXTSTATE wait;
/* CIF STATE (347, 583), (70, 35) */
STATE safe;
ENDSTATE;
/* CIF STATE (485, 344), (99, 35) */
/* CIF STATE (485, 344), (99, 35) */
STATE wait;
STATE wait;
/* CIF PROVIDED (4
8
5, 399), (97, 38) */
/* CIF PROVIDED (
3
45, 399), (97, 38) */
PROVIDED failure;
PROVIDED failure;
priority
1
;
priority
2
;
/* CIF PROCEDURECALL (
40
1, 455), (264, 35) */
/* CIF PROCEDURECALL (
26
1, 455), (264, 35) */
CALL writeln('Going to SAFE mode');
CALL writeln('Going to SAFE mode');
/* CIF NEXTSTATE (
49
8, 505), (70, 35) */
/* CIF NEXTSTATE (
35
8, 505), (70, 35) */
NEXTSTATE safe;
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;
ENDSTATE;
ENDPROCESS og;
ENDPROCESS og;
ENDBLOCK;
ENDBLOCK;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment