mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 04:14:49 +01:00
Added fucntion that generates private c headers.
This commit is contained in:
parent
60a2d2c986
commit
216fcebf70
@ -32,7 +32,6 @@
|
||||
| ~C~ | ~double[n][ldc]~ | out | Array containing the $m \times n$ matrix $C$ |
|
||||
| ~ldc~ | ~int64_t~ | in | Leading dimension of array ~C~ |
|
||||
|
||||
|
||||
*** Fortran-C type conversions
|
||||
|
||||
#+NAME:f_of_c
|
||||
@ -132,22 +131,36 @@ return template
|
||||
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS: generate_c_header
|
||||
#+begin_src c :tangle (eval h_func) :comments org
|
||||
qmckl_exit_code [] (
|
||||
const qmckl_context context,
|
||||
const char transa,
|
||||
const char transb,
|
||||
const int64_t m,
|
||||
const int64_t n,
|
||||
const double* A,
|
||||
const int64_t lda,
|
||||
const double* B,
|
||||
const int64_t ldb,
|
||||
double* const C,
|
||||
const int64_t ldc );
|
||||
#+end_src
|
||||
#+NAME: generate_private_c_header
|
||||
#+BEGIN_SRC python :var table=test :var rettyp="qmckl_exit_code" :var fname=[] :results drawer :noweb yes :wrap "src c :tangle (eval h_private_func) :comments org"
|
||||
<<parse_table>>
|
||||
|
||||
results = []
|
||||
for d in parse_table(table):
|
||||
name = d["name"]
|
||||
c_type = d["c_type"]
|
||||
|
||||
# Add star for arrays
|
||||
if d["rank"] > 0 or d["inout"] in ["out", "inout"]:
|
||||
c_type += "*"
|
||||
|
||||
if d["inout"] == "out":
|
||||
c_type += " const"
|
||||
|
||||
# Only inputs are const
|
||||
if d["inout"] == "in":
|
||||
const = "const "
|
||||
else:
|
||||
const = ""
|
||||
|
||||
results += [ f" {const}{c_type} {name}" ]
|
||||
|
||||
results=',\n'.join(results)
|
||||
template = f"""{rettyp} {fname} (\n{results} ); """
|
||||
return template
|
||||
|
||||
#+END_SRC
|
||||
|
||||
*** Generates a C interface to the Fortran function
|
||||
|
||||
#+NAME: generate_c_interface
|
||||
@ -255,8 +268,6 @@ results='\n'.join(results)
|
||||
return results
|
||||
#+END_SRC
|
||||
|
||||
|
||||
|
||||
** Creating provide functions
|
||||
|
||||
#+NAME: write_provider_header
|
||||
@ -421,3 +432,4 @@ return msg
|
||||
return QMCKL_SUCCESS;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user