From 725e48819929131c5383ab91f7b7cb1e04343dd1 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 10 Aug 2022 14:30:04 +0200 Subject: [PATCH] Fortran interface for qmckl_last_error --- org/qmckl_electron.org | 2 +- org/qmckl_error.org | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/org/qmckl_electron.org b/org/qmckl_electron.org index 1d3c664..3aeca6f 100644 --- a/org/qmckl_electron.org +++ b/org/qmckl_electron.org @@ -668,7 +668,7 @@ qmckl_set_electron_coord(qmckl_context context, qmckl_exit_code rc; rc = qmckl_set_point(context, transp, walk_num*elec_num, coord, size_max); - assert (rc == QMCKL_SUCCESS); + if (rc != QMCKL_SUCCESS) return rc; ctx->electron.walker.num = walk_num; memcpy(&(ctx->electron.walker.point), &(ctx->point), sizeof(qmckl_point_struct)); diff --git a/org/qmckl_error.org b/org/qmckl_error.org index 7bbe47f..33829e4 100644 --- a/org/qmckl_error.org +++ b/org/qmckl_error.org @@ -360,6 +360,7 @@ void qmckl_string_of_error_f(const qmckl_exit_code error, char result[<>) end subroutine qmckl_string_of_error @@ -592,6 +593,21 @@ qmckl_last_error(qmckl_context context, char* buffer) { return QMCKL_SUCCESS; } #+end_src + +** Fortran inteface + + #+begin_src f90 :tangle (eval fh_func) :exports none :noweb yes + interface + subroutine qmckl_last_error (context, string) bind(C, name='qmckl_last_error') + use, intrinsic :: iso_c_binding + import + implicit none + integer (c_int64_t) , intent(in), value :: context + character, intent(out) :: string(*) + end subroutine qmckl_last_error + end interface + #+end_src + * End of files :noexport: #+begin_src c :comments link :tangle (eval h_private_type) @@ -621,7 +637,7 @@ qmckl_last_error(qmckl_context context, char* buffer) { } #+end_src - # -*- mode: org -*- - # vim: syntax=c +# -*- mode: org -*- +# vim: syntax=c