Commit f77e1133 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add remote setter for the state (DLL API)

parent c77e7041
...@@ -181,7 +181,7 @@ def _process(process, simu=False, **kwargs): ...@@ -181,7 +181,7 @@ def _process(process, simu=False, **kwargs):
statelist = ', '.join(name for name in process.mapping.iterkeys() statelist = ', '.join(name for name in process.mapping.iterkeys()
if not name.endswith(u'START')) or 'No_State' if not name.endswith(u'START')) or 'No_State'
if statelist: if statelist:
states_decl = u'type states is ({});'.format(statelist) states_decl = u'type States is ({});'.format(statelist)
process_level_decl.append(states_decl) process_level_decl.append(states_decl)
process_level_decl.append('state : states;') process_level_decl.append('state : states;')
...@@ -241,14 +241,22 @@ package {process_name} is'''.format(process_name=process_name, ...@@ -241,14 +241,22 @@ package {process_name} is'''.format(process_name=process_name,
if simu: if simu:
dll_api = [] dll_api = []
ads_template.append('-- DLL Interface') ads_template.append('-- DLL Interface')
dll_api.append('-- DLL Interface to remotely change internal data')
# Add function allowing to trace current state as a string # Add function allowing to trace current state as a string
process_level_decl.append("function get_state return chars_ptr " process_level_decl.append("function get_state return chars_ptr "
"is (New_String(states'Image(state))) " "is (New_String(states'Image(state))) "
"with Export, Convention => C, " "with Export, Convention => C, "
'Link_Name => "{}_state";' 'Link_Name => "{}_state";'
.format(process_name)) .format(process_name))
set_state_decl = "procedure set_state(new_state: chars_ptr)"
ads_template.append("{};".format(set_state_decl))
dll_api.append("{} is".format(set_state_decl))
dll_api.append("begin")
dll_api.append("state := States'Value(Value(new_state));")
dll_api.append("end set_state;")
dll_api.append("")
# Functions to get gobal variables (length and value) # 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(): for var_name, (var_type, _) in process.variables.viewitems():
# Getters for local variables # Getters for local variables
process_level_decl.append("function l_{name}_size return integer " process_level_decl.append("function l_{name}_size return integer "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment