Commit 6276fc84 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Generate access to internal state in shared libs

parent 8f63fd0f
...@@ -190,6 +190,19 @@ def _process(process, simu=False, **kwargs): ...@@ -190,6 +190,19 @@ def _process(process, simu=False, **kwargs):
process_level_decl.append('function get_state return chars_ptr;') process_level_decl.append('function get_state return chars_ptr;')
process_level_decl.append('pragma export(C, get_state, "{}_state");' process_level_decl.append('pragma export(C, get_state, "{}_state");'
.format(process_name)) .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) with Export, "
"Convention => C, "
'Link_Name => "{name}_size";'
.format(name=var_name))
process_level_decl.append("function l_{name}_value return {sort} "
"is (l_{name}) with Export, "
"Convention => C, "
'Link_Name => "{name}_value";'
.format(name=var_name,
sort=type_name(var_type)))
# Add the declaration of the runTransition procedure # Add the declaration of the runTransition procedure
process_level_decl.append('procedure runTransition(Id: Integer);') process_level_decl.append('procedure runTransition(Id: 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