Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
c22b3857
Commit
c22b3857
authored
Mar 19, 2017
by
Maxime Perrotin
Browse files
Test instantiation
parent
04f80b2d
Changes
1
Show whitespace changes
Inline
Side-by-side
opengeode/AdaGenerator.py
View file @
c22b3857
...
...
@@ -350,14 +350,16 @@ LD_LIBRARY_PATH=. opengeode-simulator
context_decl
.
append
(
u
'pragma import (C, ctxt, "{}_ctxt");'
.
format
(
import_context
))
if
not
simu
:
if
not
simu
and
not
instance
:
process_level_decl
.
extend
(
context_decl
)
aggreg_start_proc
=
[]
start_transition
=
[]
# Continuous State transition id
if
not
instance
:
process_level_decl
.
append
(
'CS_Only : constant Integer := {};'
.
format
(
len
(
process
.
transitions
)))
for
name
,
val
in
process
.
mapping
.
viewitems
():
# Test val, in principle there is a value but if the code targets
# generation of properties, the model may have been cleant up and
...
...
@@ -368,7 +370,6 @@ LD_LIBRARY_PATH=. opengeode-simulator
# Declare start procedure for aggregate states XXX add in C generator
# should create one START per "via" clause, TODO later
aggreg_start_proc
=
[]
for
name
,
substates
in
aggregates
.
viewitems
():
proc_name
=
u
'procedure {}{}START'
.
format
(
name
,
UNICODE_SEP
)
process_level_decl
.
append
(
u
'{};'
.
format
(
proc_name
))
...
...
@@ -409,7 +410,7 @@ LD_LIBRARY_PATH=. opengeode-simulator
asn1_modules
+=
'
\n
with adaasn1rtl;
\n
use adaasn1rtl;'
except
TypeError
:
asn1_modules
=
'-- No ASN.1 data types are used in this model'
taste_template
=
[
'''
\
taste_template
=
[
u
'''
\
-- This file was generated automatically: DO NOT MODIFY IT !
with System.IO;
...
...
@@ -427,7 +428,8 @@ package body {process_name} is'''.format(process_name=process_name,
dataview
=
asn1_modules
,
C
=
'with Interfaces.C.Strings;
\n
'
'use Interfaces.C.Strings;'
if
simu
else
''
)]
if
simu
else
''
)
if
not
instance
else
u
"package body {} is"
.
format
(
process_name
)]
generic_spec
,
instance_decl
=
""
,
""
if
generic
:
...
...
@@ -633,6 +635,7 @@ package {process_name} is'''.format(generic=generic_spec,
else
:
taste_template
.
append
(
'runTransition(CS_Only);'
)
if
not
instance
:
taste_template
.
append
(
'case {}.state is'
.
format
(
LPREFIX
))
def
case_state
(
state
):
...
...
@@ -673,11 +676,17 @@ package {process_name} is'''.format(generic=generic_spec,
else
:
execute_transition
(
state
)
if
not
instance
:
map
(
case_state
,
reduced_statelist
)
# XXX update C generator
taste_template
.
append
(
'when others =>'
)
taste_template
.
append
(
'runTransition(CS_Only);'
)
taste_template
.
append
(
'end case;'
)
else
:
inst_call
=
u
"{}_Instance.{}"
.
format
(
process_name
,
signame
)
if
'type'
in
signal
:
inst_call
+=
u
"({})"
.
format
(
param_name
)
taste_template
.
append
(
inst_call
+
";"
)
taste_template
.
append
(
u
'end {};'
.
format
(
signame
))
taste_template
.
append
(
'
\n
'
)
...
...
@@ -859,7 +868,6 @@ package {process_name} is'''.format(generic=generic_spec,
if
ri_inst
:
pkg_decl
+=
u
" ({})"
.
format
(
u
", "
.
join
(
ri_inst
))
ads_template
.
append
(
pkg_decl
+
u
";"
)
ads_template
.
append
(
u
"use {}_Instance;"
.
format
(
process_name
))
if
simu
and
process
.
cs_mapping
:
# Callback registration for Check_Queue
...
...
@@ -895,7 +903,7 @@ package {process_name} is'''.format(generic=generic_spec,
code_labels
.
extend
(
code_label
)
# Generate the code of the runTransition procedure, if needed
if
process
.
transitions
:
if
process
.
transitions
and
not
instance
:
taste_template
.
append
(
'procedure runTransition(Id: Integer) is'
)
taste_template
.
append
(
'trId : Integer := Id;'
)
if
process
.
cs_mapping
:
...
...
@@ -1040,7 +1048,7 @@ package {process_name} is'''.format(generic=generic_spec,
taste_template
.
append
(
'end loop;'
)
taste_template
.
append
(
'end runTransition;'
)
taste_template
.
append
(
'
\n
'
)
el
s
e
:
el
if
not
instanc
e
:
# No transitions defined, but keep the interface for CS_Only calls
taste_template
.
append
(
'procedure runTransition(Id: Integer) is'
)
taste_template
.
append
(
'begin'
)
...
...
Write
Preview
Supports
Markdown
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