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
df432470
Commit
df432470
authored
Jan 30, 2015
by
Maxime Perrotin
Browse files
Add STG code
parent
399c42bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
opengeode/StgBackend.py
View file @
df432470
...
...
@@ -143,6 +143,7 @@ def _process(process, simu=False, stgfile='ada_source.st', **kwargs):
return
# Generate the code for each input signal (provided interface) and timers
pi_code
=
[]
for
signal
in
process
.
input_signals
+
[
{
'name'
:
timer
.
lower
()}
for
timer
in
process
.
timers
]:
sig_template
=
STG
.
getInstanceOf
(
'pi_signature'
)
...
...
@@ -167,6 +168,7 @@ def _process(process, simu=False, stgfile='ada_source.st', **kwargs):
# For each input signal, define the possible transition based on the
# current state.
cases
=
[]
for
state
in
process
.
mapping
.
viewkeys
():
if
state
.
endswith
(
u
'START'
):
continue
...
...
@@ -209,6 +211,13 @@ def _process(process, simu=False, stgfile='ada_source.st', **kwargs):
# Execute the correponding transition
if
input_def
.
transition
:
case_template
[
'transition'
]
=
input_def
.
transition_id
cases
.
append
(
str
(
case_template
))
pi_template
[
'cases'
]
=
cases
# Generate the template amd add it to a list
pi_code
.
append
(
str
(
pi_template
))
process_template
[
'arrs_inp'
]
=
pi_code
# for the .ads file, generate the declaration of the required interfaces
# output signals are the asynchronous RI - only one parameter
...
...
opengeode/ada_body.st
View file @
df432470
...
...
@@ -6,12 +6,13 @@ group adb;
*
pdecl
:
inner
procedure
declarations
(
array
)
*
pcode
:
inner
procedure
code
(
array
)
*
vars:
list
of
local
variables
and
sort:
{
name:
str
,
sort:
str
})
*
arrs_inp
:
code
handling
the
reception
of
messages
(
array
of
<
input_signal
>
)
*
constants:
list
of
start
named
start
transitions
(
when
using
substates
)
*
states:
list
of
states
*
asn1_mod
:
list
of
ASN
.
1
modules
*
simu
,
dll
:
flags
set
by
the
user
for
generation
of
optional
code
*/
process
(
name
,
decl
,
pdecl
,
pcode
vars,
constants
,
states
,
asn1_mod
,
simu
,
dll
)
:
:=
<<
process
(
name
,
decl
,
pdecl
,
pcode
vars,
arrs_inp
,
constants
,
states
,
asn1_mod
,
simu
,
dll
)
:
:=
<<
--
This
file
was
generated
automatically:
DO
NOT
MODIFY
!
<
if
(
asn1_mod
)
>
...
...
@@ -89,6 +90,7 @@ end dll_set_l_<each.name>;
---------------------------------------------------------------------------
<
endif
>
<
pcode
;
separator=
"\n"
>
<
arrs_inp
;
separator
=
"\n"
>
--
Process
initialization:
execute
the
START
transition
)
begin
...
...
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