Commit 55aca5ba authored by Maxime Perrotin's avatar Maxime Perrotin

Fix the handling of states for the simulator

parent 7300ca3e
......@@ -534,8 +534,10 @@ package {process_name} is'''.format(generic=generic_spec,
instance=instance_decl,
process_name=process_name,
dataview=asn1_modules,
C='with Interfaces.C.Strings;\n'
'use Interfaces.C.Strings;'
C='with Interfaces.C.Strings,\n'
' Ada.Characters.Handling;\n'
'use Interfaces.C.Strings,\n'
' Ada.Characters.Handling;'
if simu else '')]
dll_api = []
if simu:
......@@ -553,8 +555,13 @@ package {process_name} is'''.format(generic=generic_spec,
ads_template.append('pragma Export(C, set_state, "_set_state");')
dll_api.append("{} is".format(set_state_decl))
dll_api.append("begin")
dll_api.append("{}.state := States'Value(Value(new_state));"
dll_api.append("for S in States loop")
dll_api.append("if To_Upper (Value (New_State))"
" = States'Image (S) then")
dll_api.append("{}.state := S;"
.format(LPREFIX))
dll_api.append("end if;")
dll_api.append("end loop;")
dll_api.append("end set_state;")
dll_api.append("")
......
......@@ -45,6 +45,7 @@ __all__ = ['flatten', 'rename_everything', 'inner_labels_to_floating',
def statenames(context, sep=u'\u00dc'):
''' Return the list of states (just the names) of a given context
Format the output by replacing unicode separator symbol with a dot '''
# note: if model has been flattened, all contexts are already merged
return (s.replace(sep, u'.') for s in context.mapping.viewkeys()
if not s.endswith(u'START'))
......
......@@ -12,6 +12,7 @@ test-parse:
simu:
$(OPENGEODE) --shared controller.pr system_structure.pr
rm -rf controller_simu
mkdir -p controller_simu
cp *.png controller_simu
cp UserWidgets.py controller_simu
......
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