Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenGEODE
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
TASTE
OpenGEODE
Commits
56dbb587
Commit
56dbb587
authored
Jun 23, 2016
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support priorities of continuous signals in Ada backend
parent
c8d41eef
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
81 deletions
+105
-81
README.md
README.md
+3
-0
opengeode/AdaGenerator.py
opengeode/AdaGenerator.py
+19
-3
opengeode/ogParser.py
opengeode/ogParser.py
+2
-1
opengeode/opengeode.py
opengeode/opengeode.py
+1
-1
tests/regression/test-provided2/og.pr
tests/regression/test-provided2/og.pr
+80
-76
No files found.
README.md
View file @
56dbb587
...
...
@@ -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
...
...
opengeode/AdaGenerator.py
View file @
56dbb587
...
...
@@ -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
)
...
...
opengeode/ogParser.py
View file @
56dbb587
...
...
@@ -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
:
...
...
opengeode/opengeode.py
View file @
56dbb587
...
...
@@ -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)
...
...
tests/regression/test-provided2/og.pr
View file @
56dbb587
...
...
@@ -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), (12
6, 35) */
/* CIF NEXTSTATE (
472, 134), (10
6, 35) */
NEXTSTATE wait_for_tc;
/* CIF STATE (
116, 106), (126
, 35) */
STATE
wait_for
_tc;
/* CIF INPUT (
93, 161), (175
, 35) */
INPUT t
elecommand(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 t
imer1
;
/* 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 (
48
5, 399), (97, 38) */
/* CIF PROVIDED (
34
5, 399), (97, 38) */
PROVIDED failure;
priority
1
;
/* CIF PROCEDURECALL (
40
1, 455), (264, 35) */
priority
2
;
/* CIF PROCEDURECALL (
26
1, 455), (264, 35) */
CALL writeln('Going to SAFE mode');
/* CIF NEXTSTATE (
49
8, 505), (70, 35) */
/* CIF NEXTSTATE (
35
8, 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;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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