Commit 0ef5c855 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Ada backend properly support return procedures

parent 3b5b023d
...@@ -216,9 +216,9 @@ LD_LIBRARY_PATH=. taste-gui -l ...@@ -216,9 +216,9 @@ LD_LIBRARY_PATH=. taste-gui -l
# 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);')
# Generate the code of the start transition: # Generate the code of the start transition (if process not empty)
start_transition = ['begin', start_transition = ['begin',
'runTransition(0);'] 'runTransition(0);'] if process.transitions else []
# Generate the TASTE template # Generate the TASTE template
try: try:
...@@ -1884,10 +1884,16 @@ def _inner_procedure(proc, **kwargs): ...@@ -1884,10 +1884,16 @@ def _inner_procedure(proc, **kwargs):
for var in proc.fpar: for var in proc.fpar:
VARIABLES.update({var['name']: (var['type'], None)}) VARIABLES.update({var['name']: (var['type'], None)})
# Build the procedure signature # Build the procedure signature (function if it can return a value)
pi_header = u'procedure {sep}{proc_name}'.format(sep=(u'p' + UNICODE_SEP) ret_type = type_name(proc.return_type) if proc.return_type else None
pi_header = u'{kind} {sep}{proc_name}{ret}'.format(kind='procedure'
if not proc.return_type
else 'function',
sep=(u'p' + UNICODE_SEP)
if not proc.external else '', if not proc.external else '',
proc_name=proc.inputString) proc_name=proc.inputString,
ret=(' return '+ret_type)
if ret_type else '')
if proc.fpar: if proc.fpar:
pi_header += '(' pi_header += '('
params = [] params = []
......
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