Commit caf7c55e authored by Pierre Augier's avatar Pierre Augier
Browse files

Bugfix and fix order of export and def in Pythran code

parent 5aebe3020f8a
......@@ -21,7 +21,8 @@ class MyClass:
fp.use_pythranized_block("rk2_step0")
else:
# pythran block (
# complex128[][][] state_spect_n12, state_spect, tendencies_n;
# complex128[][][] state_spect_n12, state_spect,
# tendencies_n;
# float64[][] diss2;
# float dt
# )
......
......@@ -4,7 +4,7 @@ try:
from pyfiglet import figlet_format
__about__ = (
figlet_format("fluidpythran", font="big") + 51 * " " + "v. " + __version__
figlet_format("fluidpythran", font="big")
)
except ImportError:
__about__ = r"""
......@@ -18,3 +18,5 @@ except ImportError:
|_| |___/
"""
__about__ = __about__.rstrip() + f"{17 * ' '} v. {__version__}\n"
......@@ -197,24 +197,25 @@ imports: {imports}\n"""
variables_types = {}
lines = types_variables1.split("(", 1)[1].split(")")[0].split(";")
for line in lines:
type_, *variables = line.split()
type_, str_variables = line.split(" ", 1)
variables = str_variables.split(",")
for variable in variables:
variables_types[variable.replace(",", "")] = type_
variables_types[variable.replace(",", "").strip()] = type_
variables_types_block[name_block].append(variables_types)
if types_variables and "->" in types_variables1:
return_block[name_block] = types_variables1.split("->", 1)[1]
# add "pythran export" for blocks
for name_block, variables_types0 in variables_types_block.items():
for variables_types in variables_types0:
str_variables = ", ".join(variables_types.values())
code_pythran += f"# pythran export {name_block}({str_variables})\n"
arguments_blocks = {}
# add code for blocks
for name_block, variables_types0 in variables_types_block.items():
# add "pythran export" for blocks
for variables_types in variables_types0:
str_variables = ", ".join(variables_types.values())
code_pythran += f"# pythran export {name_block}({str_variables})\n\n"
# add code for blocks
variables = variables_types0[0].keys()
arguments_blocks[name_block] = list(variables)
......
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