Skip to content

Commit

Permalink
Merge pull request #218 from cyrillemidingoyi/master
Browse files Browse the repository at this point in the history
update Fortrab and SimplaceGen
  • Loading branch information
cyrillemidingoyi authored Nov 27, 2023
2 parents 4d117c7 + 6624f20 commit d08c430
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
15 changes: 10 additions & 5 deletions src/pycropml/transpiler/generators/fortranGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def visit_function(self, node):
self.write(', &\n '.join(parameters))
if len(self.z.returns)==1 and "name" in dir(self.z.returns[0].value):
self.write(') RESULT(%s)'%(','.join(self.transform_return(node)[0])) )
elif len(self.z.returns)>1 or "name" not in dir(self.z.returns[0].value) :
elif len(self.z.returns)>1 or "name" not in dir(self.z.returns[0].value) :
self.write(') RESULT(res_cyml)')
else:
self.write(') RESULT(%s)'%(','.join(self.transform_return(node)[0])) )
Expand All @@ -443,13 +443,18 @@ def visit_function(self, node):
self.newline(node)
self.write("IMPLICIT NONE")
self.newline(node)
pnames = [e.name for e in node_params]
self.visit_declaration(node_params) #self.visit_decl(node)
self.visit_declaration(self.transform_return(node)[1])
if check_range_function().process(node):
self.visit_declaration([Node(type="int", name="i_cyml_r", pseudo_type="int")])
rname = self.transform_return(node)[0]
if rname and rname[0] not in pnames:
self.visit_declaration(self.transform_return(node)[1])
var_range = check_range_function()
var_range.process(node)
print("res", var_range.res)
if var_range.res : self.visit_declaration([Node(type="int", name="i_cyml_r", pseudo_type="int")])
interVar = [i for i in newNode if "feat" not in dir(i)]
self.visit_declaration(interVar)
if len(self.z.returns)>1:
if len(self.z.returns)>=1 and "name" not in dir(self.z.returns[0].value):
self.visit_declaration([Node(type="local", name="res_cyml", pseudo_type=node.return_type)])
if self.initialValue:
for n in self.initialValue:
Expand Down
10 changes: 5 additions & 5 deletions src/pycropml/transpiler/generators/simplaceGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,14 @@ def visit_function_definition(self, node):
self.write(arg.name)
if arg.type=="list": self.write(" = Arrays.asList(%s.getValue());" % arg.name)
else:
if arg.type == "array" and "elts" in dir(arg) and len(arg.elts)>0 and arg.name not in self.par_ :
self.write(" = new ")
#if arg.type == "array" and "elts" in dir(arg) and len(arg.elts)>0 and arg.name not in self.par_ :
'''self.write(" = new ")
self.visit_decl(arg.pseudo_type[1])
self.write("[")
self.visit(arg.elts[0])
self.write("];")
else:
self.write(" = %s.getValue();" % arg.name)
self.write("];")'''
#else:
self.write(" = %s.getValue();" % arg.name)
elif arg.feat!="INOUT":
self.newline(1)
self.visit_decl(arg.pseudo_type)
Expand Down

0 comments on commit d08c430

Please sign in to comment.