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
47d9e765
Commit
47d9e765
authored
Nov 02, 2019
by
Maxime Perrotin
Browse files
More python3 work..
parent
ad0bf38e
Changes
4
Hide whitespace changes
Inline
Side-by-side
opengeode/AdaGenerator.py
View file @
47d9e765
...
...
@@ -325,7 +325,7 @@ LD_LIBRARY_PATH=./lib:. opengeode-simulator
# Establish the list of states (excluding START states) XXX update C backend
full_statelist
=
set
(
chain
(
aggregates
.
keys
(),
(
name
for
name
in
process
.
mapping
.
iter
keys
()
(
name
for
name
in
process
.
mapping
.
keys
()
if
not
name
.
endswith
(
u
'START'
))))
reduced_statelist
=
{
s
for
s
in
full_statelist
if
s
not
in
parallel_states
}
if
aggregates
:
...
...
@@ -1165,25 +1165,25 @@ package {process_name} is'''.format(generic=generic_spec,
ads_template
.
append
(
'end {process_name};'
.
format
(
process_name
=
process_name
))
with
open
(
process_name
.
lower
()
+
os
.
extsep
+
'adb'
,
'w'
)
as
ada_file
:
ada_file
.
write
(
u
'
\n
'
.
join
(
format_ada_code
(
taste_template
)).
encode
(
'latin1'
)
)
with
open
(
process_name
.
lower
()
+
os
.
extsep
+
'adb'
,
'w
b
'
)
as
ada_file
:
code
=
u
'
\n
'
.
join
(
format_ada_code
(
taste_template
)).
encode
(
'latin1'
)
ada_file
.
write
(
code
)
with
open
(
process_name
.
lower
()
+
os
.
extsep
+
'ads'
,
'w'
)
as
ada_file
:
with
open
(
process_name
.
lower
()
+
os
.
extsep
+
'ads'
,
'w
b
'
)
as
ada_file
:
ada_file
.
write
(
u
'
\n
'
.
join
(
format_ada_code
(
ads_template
)).
encode
(
'latin1'
))
with
open
(
"{}_ada.gpr"
.
format
(
process_name
.
lower
()),
"w"
)
as
gprada
:
gprada
.
write
(
ada_gpr
)
with
open
(
"{}_ada.gpr"
.
format
(
process_name
.
lower
()),
"w
b
"
)
as
gprada
:
gprada
.
write
(
ada_gpr
.
encode
(
'utf-8'
)
)
if
simu
:
with
open
(
u
'{}_interface.aadl'
.
format
(
process_name
.
lower
()),
'w'
)
as
aadl
:
.
format
(
process_name
.
lower
()),
'w
b
'
)
as
aadl
:
aadl
.
write
(
u
'
\n
'
.
join
(
minicv
).
encode
(
'latin1'
))
script
=
'{}_simu.sh'
.
format
(
process_name
.
lower
())
with
open
(
script
,
'w'
)
as
bash_script
:
bash_script
.
write
(
simu_script
)
with
open
(
"{}_lib.gpr"
.
format
(
process_name
.
lower
()),
'w'
)
as
gprlib
:
with
open
(
"{}_lib.gpr"
.
format
(
process_name
.
lower
()),
'w
b
'
)
as
gprlib
:
gprlib
.
write
(
lib_gpr
)
os
.
chmod
(
script
,
os
.
stat
(
script
).
st_mode
|
stat
.
S_IXUSR
)
...
...
opengeode/Asn1scc.py
View file @
47d9e765
...
...
@@ -160,7 +160,7 @@ def parse_asn1(*files, **options):
content
=
stg_qrc
.
readAll
()
stgfile
=
outdir
+
os
.
sep
+
'pretty_print_asn1.stg'
with
open
(
stgfile
,
'w'
)
as
tmpfile
:
tmpfile
.
write
(
content
.
data
())
tmpfile
.
write
(
content
.
data
()
.
encode
(
'utf-8'
)
)
html
=
[
'-customIcdUper'
,
stgfile
+
'::'
+
html_filepath
]
else
:
html
=
[]
...
...
opengeode/CGenerator.py
View file @
47d9e765
...
...
@@ -517,7 +517,7 @@ LD_LIBRARY_PATH=. taste-gui -l
VARIABLES
.
update
(
process
.
variables
)
#Computing state lists
state_list
=
', '
.
join
(
name
for
name
in
process
.
mapping
.
iter
keys
()
if
not
name
.
endswith
(
u
'START'
))
or
'No_State'
state_list
=
', '
.
join
(
name
for
name
in
process
.
mapping
.
keys
()
if
not
name
.
endswith
(
u
'START'
))
or
'No_State'
#Declaring global type modeling the state
if
state_list
:
...
...
@@ -582,7 +582,7 @@ LD_LIBRARY_PATH=. taste-gui -l
# Add function allowing to trace current state as a string
global_decls
.
append
(
u
'char * {pn}_state()'
.
format
(
pn
=
process_name
))
global_decls
.
append
(
u
'{'
)
for
state_name
in
process
.
mapping
.
iter
keys
():
for
state_name
in
process
.
mapping
.
keys
():
if
not
state_name
.
endswith
(
u
'START'
)
and
state_name
!=
'No_State'
:
global_decls
.
append
(
u
'if({ctxt}.state == {sn}) return
\"
{sn}
\\
0
\"
;'
.
format
(
ctxt
=
LPREFIX
,
sn
=
state_name
))
global_decls
.
append
(
u
'return
\"\\
0
\"
;'
)
...
...
@@ -593,7 +593,7 @@ LD_LIBRARY_PATH=. taste-gui -l
dll_code
.
append
(
u
'{}'
.
format
(
set_state_decl
))
dll_code
.
append
(
u
'{'
)
for
state_name
in
process
.
mapping
.
iter
keys
():
for
state_name
in
process
.
mapping
.
keys
():
if
not
state_name
.
endswith
(
u
'START'
)
and
state_name
!=
'No_State'
:
dll_code
.
append
(
u
'if(strcmp(new_state,
\"
{st}
\"
) == 0) {ctxt}.state = {st};'
.
format
(
st
=
state_name
,
ctxt
=
LPREFIX
))
dll_code
.
append
(
u
'}'
)
...
...
opengeode/Helper.py
View file @
47d9e765
...
...
@@ -196,11 +196,12 @@ def flatten(process, sep=u'_'):
set_terminator_states
(
state
,
prefix
)
set_transition_states
(
state
,
prefix
)
keys
=
list
(
state
.
mapping
.
keys
())
state
.
mapping
=
{
prefix
+
key
:
state
.
mapping
.
pop
(
key
)
for
key
in
state
.
mapping
.
keys
()}
for
key
in
list
(
state
.
mapping
.
keys
()
)
}
# Continuous signal mappings
state
.
cs_mapping
=
{
prefix
+
key
:
state
.
cs_mapping
.
pop
(
key
)
for
key
in
state
.
cs_mapping
.
keys
()}
for
key
in
list
(
state
.
cs_mapping
.
keys
()
)
}
process
.
transitions
.
extend
(
state
.
transitions
)
# Add prefix to local variable names and push them at process level
...
...
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