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
c77e7041
Commit
c77e7041
authored
Jan 02, 2015
by
Maxime Perrotin
Browse files
Add setters for local data (when using a dll)
parent
40aa51b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
opengeode/AdaGenerator.py
View file @
c77e7041
...
...
@@ -190,28 +190,6 @@ def _process(process, simu=False, **kwargs):
process_level_decl
.
append
(
u
'{name} : constant := {val};'
.
format
(
name
=
name
,
val
=
str
(
val
)))
if
simu
:
# Add function allowing to trace current state as a string
process_level_decl
.
append
(
"function get_state return chars_ptr "
"is (New_String(states'Image(state))) "
"with Export, Convention => C, "
'Link_Name => "{}_state";'
.
format
(
process_name
))
# Functions to get gobal variables (length and value)
for
var_name
,
(
var_type
,
_
)
in
process
.
variables
.
viewitems
():
process_level_decl
.
append
(
"function l_{name}_size return integer "
"is (l_{name}'Size/8) with Export, "
"Convention => C, "
'Link_Name => "{name}_size";'
.
format
(
name
=
var_name
))
process_level_decl
.
append
(
"function l_{name}_value"
" return access {sort} "
"is (l_{name}'access) with Export, "
"Convention => C, "
'Link_Name => "{name}_value";'
.
format
(
name
=
var_name
,
sort
=
type_name
(
var_type
)))
# Add the declaration of the runTransition procedure
process_level_decl
.
append
(
'procedure runTransition(Id: Integer);'
)
...
...
@@ -260,6 +238,42 @@ package {process_name} is'''.format(process_name=process_name,
'use Interfaces.C.Strings;'
if
simu
else
''
)]
if
simu
:
dll_api
=
[]
ads_template
.
append
(
'-- DLL Interface'
)
# Add function allowing to trace current state as a string
process_level_decl
.
append
(
"function get_state return chars_ptr "
"is (New_String(states'Image(state))) "
"with Export, Convention => C, "
'Link_Name => "{}_state";'
.
format
(
process_name
))
# Functions to get gobal variables (length and value)
dll_api
.
append
(
'-- DLL Interface to remotely change internal data'
)
for
var_name
,
(
var_type
,
_
)
in
process
.
variables
.
viewitems
():
# Getters for local variables
process_level_decl
.
append
(
"function l_{name}_size return integer "
"is (l_{name}'Size/8) with Export, "
"Convention => C, "
'Link_Name => "{name}_size";'
.
format
(
name
=
var_name
))
process_level_decl
.
append
(
"function l_{name}_value"
" return access {sort} "
"is (l_{name}'access) with Export, "
"Convention => C, "
'Link_Name => "{name}_value";'
.
format
(
name
=
var_name
,
sort
=
type_name
(
var_type
)))
# Setters for local variables
setter_decl
=
"procedure dll_set_l_{name}(value: access {sort})"
\
.
format
(
name
=
var_name
,
sort
=
type_name
(
var_type
))
ads_template
.
append
(
'{};'
.
format
(
setter_decl
))
dll_api
.
append
(
'{} is'
.
format
(
setter_decl
))
dll_api
.
append
(
'begin'
)
dll_api
.
append
(
'l_{} := value.all;'
.
format
(
var_name
))
dll_api
.
append
(
'end dll_set_l_{};'
.
format
(
var_name
))
dll_api
.
append
(
''
)
# Generate the the code of the procedures
inner_procedures_code
=
[]
for
proc
in
process
.
content
.
inner_procedures
:
...
...
@@ -273,6 +287,9 @@ package {process_name} is'''.format(process_name=process_name,
# Add the code of the procedures definitions
taste_template
.
extend
(
inner_procedures_code
)
# Add the code of the DLL interface
taste_template
.
extend
(
dll_api
)
# Generate the code for each input signal (provided interface) and timers
for
signal
in
process
.
input_signals
+
[
{
'name'
:
timer
.
lower
()}
for
timer
in
process
.
timers
]:
...
...
opengeode/undoCommands.py
View file @
c77e7041
...
...
@@ -17,10 +17,10 @@
"""
import
logging
from
PySide.QtGui
import
QUndoCommand
from
PySide.QtCore
import
QPropertyAnimation
,
QEasingCurve
,
QAbstractAnimation
import
logging
LOG
=
logging
.
getLogger
(
__name__
)
...
...
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