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

Add support in AST and Ada for remote procedures

parent eb9ed6e1
...@@ -1898,6 +1898,7 @@ def _inner_procedure(proc, **kwargs): ...@@ -1898,6 +1898,7 @@ def _inner_procedure(proc, **kwargs):
proc_name=proc.inputString, proc_name=proc.inputString,
ret=(' return '+ret_type) ret=(' return '+ret_type)
if ret_type else '') if ret_type else '')
if proc.fpar: if proc.fpar:
pi_header += '(' pi_header += '('
params = [] params = []
...@@ -1911,6 +1912,11 @@ def _inner_procedure(proc, **kwargs): ...@@ -1911,6 +1912,11 @@ def _inner_procedure(proc, **kwargs):
pi_header += ')' pi_header += ')'
local_decl.append(pi_header + ';') local_decl.append(pi_header + ';')
# Remote procedures need to be exported with a C calling convention
if proc.exported and not proc.external:
local_decl.append(u'pragma export'
u'(C, p{sep}{proc_name}, "_{proc_name}");'
.format(sep=UNICODE_SEP, proc_name=proc.inputString))
if proc.external: if proc.external:
local_decl.append(u'pragma import(C, {});'.format(proc.inputString)) local_decl.append(u'pragma import(C, {});'.format(proc.inputString))
......
...@@ -771,6 +771,8 @@ class Procedure(object): ...@@ -771,6 +771,8 @@ class Procedure(object):
self.transitions = [] self.transitions = []
# Determine if a procedure is externally defined # Determine if a procedure is externally defined
self.external = False self.external = False
# Determine if a procedure is a remote procedure
self.exported = False
# Optional comment # Optional comment
self.comment = None self.comment = None
# Set of symbols contained in the procedure (type Automaton) # Set of symbols contained in the procedure (type Automaton)
......
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