Skip to content
Snippets Groups Projects
Verified Commit a45b4d08 authored by Giannis Nikiteas's avatar Giannis Nikiteas
Browse files

Renames function variables

Temorarily removes call to flog until we finish the wrappers
parent 13bae837
Branches
Tags
No related merge requests found
...@@ -272,7 +272,7 @@ def ivectorvectorint(name, value=None, python_value=None, julia_value=None): ...@@ -272,7 +272,7 @@ def ivectorvectorint(name, value=None, python_value=None, julia_value=None):
a.julia_arg = ("convert(Vector{Vector{Cint}}," + name + "), " + a.julia_arg = ("convert(Vector{Vector{Cint}}," + name + "), " +
api_name_n + ", length(" + name + ")") api_name_n + ", length(" + name + ")")
a.fortran_type = "type(c_ptr), intent(out)" a.fortran_type = "type(c_ptr), intent(out)"
a.fortran_type_post = (" " * 8 + "type(c_ptr), intent(out) :: " + name + "_n\n" + a.fortran_type_post = (" " * 8 + "type(c_ptr), intent(out) :: " + name + "_n\n" +
" " * 8 + "integer(c_size_t) :: " + name + "_nn") " " * 8 + "integer(c_size_t) :: " + name + "_nn")
a.fortran_name_post = ", " + name + "_n," + name + "_nn" a.fortran_name_post = ", " + name + "_n," + name + "_nn"
return a return a
...@@ -352,7 +352,7 @@ def ivectorvectordouble(name, value=None, python_value=None, julia_value=None): ...@@ -352,7 +352,7 @@ def ivectorvectordouble(name, value=None, python_value=None, julia_value=None):
a.julia_arg = ("convert(Vector{Vector{Cdouble}}," + name + "), " + a.julia_arg = ("convert(Vector{Vector{Cdouble}}," + name + "), " +
api_name_n + ", length(" + name + ")") api_name_n + ", length(" + name + ")")
a.fortran_type = "type(c_ptr), intent(out)" a.fortran_type = "type(c_ptr), intent(out)"
a.fortran_type_post = (" " * 8 + "type(c_ptr), intent(out) :: " + name + "_n\n" + a.fortran_type_post = (" " * 8 + "type(c_ptr), intent(out) :: " + name + "_n\n" +
" " * 8 + "integer(c_size_t) :: " + name + "_nn") " " * 8 + "integer(c_size_t) :: " + name + "_nn")
a.fortran_name_post = ", " + name + "_n," + name + "_nn" a.fortran_name_post = ", " + name + "_n," + name + "_nn"
return a return a
...@@ -1849,23 +1849,20 @@ class API: ...@@ -1849,23 +1849,20 @@ class API:
def write_fortran(self): def write_fortran(self):
def write_module(module, c_namespace, cpp_namespace, indent):
cpp_namespace += module.name + "::" def write_module(f, m, c_mpath, f_mpath, indent):
if c_namespace: f_mpath += m.name + "::"
c_namespace += module.name[0].upper() + module.name[1:] if c_mpath:
c_mpath += m.name[0].upper() + m.name[1:]
else: else:
c_namespace = module.name c_mpath = m.name
indent += " " indent += " "
for rtype, name, args, doc, special in module.fs: for rtype, name, args, doc, special in m.fs:
fname = c_namespace + name[0].upper() + name[1:] fname = c_mpath + name[0].upper() + name[1:]
tab = " " * 4 tab = " " * 4
# Documentation (Doxygen) # Documentation (Doxygen)
self.fwrite(f, "\n" + tab + "!> " + ("\n" + tab + "!! ").join(textwrap.wrap(doc, 75)) + "\n") self.fwrite(f, "\n" + tab + "!> " + ("\n" + tab + "!! ").join(textwrap.wrap(doc, 75)) + "\n")
fnameapi = "! " + ns.upper() + "_API " + (rtype.rc_type if rtype else
"void") + " " + fname + "("
self.flog('f', cpp_namespace.replace('::', '/') + name)
# Procedure definition # Procedure definition
fnamef = tab + ("function" if rtype else "subroutine") + " " + fname + "(" fnamef = tab + ("function" if rtype else "subroutine") + " " + fname + "("
# Procedure name and Argument list # Procedure name and Argument list
...@@ -1882,20 +1879,19 @@ class API: ...@@ -1882,20 +1879,19 @@ class API:
# Procedure end # Procedure end
self.fwrite(f, tab + "end " + ("function" if rtype else "subroutine") + " " + fname + "\n") self.fwrite(f, tab + "end " + ("function" if rtype else "subroutine") + " " + fname + "\n")
for m in module.submodules: for m in m.submodules:
write_module(m, c_namespace, cpp_namespace, indent) write_module(f, m, c_mpath, f_mpath, indent)
self.current_lineno = 1 self.current_lineno = 1
with open(ns + ".f90", "w") as f: with open(ns + ".f90", "w") as f:
self.fwrite( self.fwrite(
f, f,
fortran_header.format(self.copyright, self.issues, fortran_header.format(self.copyright, self.issues, ns.upper(),
ns.upper(), self.code, self.code, self.version_major,
self.version_major, self.version_minor, self.version_minor, self.version_patch))
self.version_patch, ns)) for module in self.modules:
for module in self.modules: write_module(f, module, "", "", "")
write_module(module, "", "", "") self.fwrite(f, fortran_footer)
self.fwrite(f, fortran_footer)
def write_texi(self): def write_texi(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment