mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-08-24 22:21:46 +02:00
Fixed const in munit and tests
This commit is contained in:
parent
293f0a008e
commit
09c8f9700f
@ -586,11 +586,7 @@ qmckl_exit_code qmckl_context_remove_memory(qmckl_context context,
|
|||||||
|
|
||||||
qmckl_unlock(context);
|
qmckl_unlock(context);
|
||||||
|
|
||||||
if (alloc != NULL) {
|
|
||||||
return QMCKL_SUCCESS;
|
return QMCKL_SUCCESS;
|
||||||
} else {
|
|
||||||
return QMCKL_DEALLOCATION_FAILED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
@ -145,7 +145,8 @@ return '\n'.join(result)
|
|||||||
: 128
|
: 128
|
||||||
|
|
||||||
#+begin_src c :comments org :tangle (eval h) :exports none :noweb yes
|
#+begin_src c :comments org :tangle (eval h) :exports none :noweb yes
|
||||||
void qmckl_string_of_error(qmckl_exit_code error, char string[<<MAX_STRING_LENGTH()>>]);
|
const char* qmckl_string_of_error(const qmckl_exit_code error);
|
||||||
|
void qmckl_string_of_error_f(const qmckl_exit_code error, char result[<<MAX_STRING_LENGTH()>>]);
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
The text strings are extracted from the previous table.
|
The text strings are extracted from the previous table.
|
||||||
@ -161,7 +162,7 @@ for (text, code, message) in table:
|
|||||||
text = text.replace("~","")
|
text = text.replace("~","")
|
||||||
message = message.replace("'",'"')
|
message = message.replace("'",'"')
|
||||||
result += [ f"""case {text}:
|
result += [ f"""case {text}:
|
||||||
strncpy(string,{message},<<MAX_STRING_LENGTH()>>);
|
return {message};
|
||||||
break;""" ]
|
break;""" ]
|
||||||
return '\n'.join(result)
|
return '\n'.join(result)
|
||||||
|
|
||||||
@ -169,17 +170,22 @@ return '\n'.join(result)
|
|||||||
|
|
||||||
# Source
|
# Source
|
||||||
#+begin_src c :comments org :tangle (eval c) :noweb yes
|
#+begin_src c :comments org :tangle (eval c) :noweb yes
|
||||||
void qmckl_string_of_error(qmckl_exit_code error, char string[<<MAX_STRING_LENGTH()>>]) {
|
const char* qmckl_string_of_error(const qmckl_exit_code error) {
|
||||||
switch (error) {
|
switch (error) {
|
||||||
<<cases()>>
|
<<cases()>>
|
||||||
}
|
}
|
||||||
|
return "Unknown error";
|
||||||
|
}
|
||||||
|
|
||||||
|
void qmckl_string_of_error_f(const qmckl_exit_code error, char result[<<MAX_STRING_LENGTH()>>]) {
|
||||||
|
strncpy(result, qmckl_string_of_error(error), <<MAX_STRING_LENGTH()>>);
|
||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
# Fortran interface
|
# Fortran interface
|
||||||
#+begin_src f90 :tangle (eval fh) :noexport :noweb yes
|
#+begin_src f90 :tangle (eval fh) :noexport :noweb yes
|
||||||
interface
|
interface
|
||||||
subroutine qmckl_string_of_error (error, string) bind(C)
|
subroutine qmckl_string_of_error (error, string) bind(C, name='qmckl_string_of_error_f')
|
||||||
use, intrinsic :: iso_c_binding
|
use, intrinsic :: iso_c_binding
|
||||||
integer (c_int32_t), intent(in), value :: error
|
integer (c_int32_t), intent(in), value :: error
|
||||||
character, intent(out) :: string(<<MAX_STRING_LENGTH()>>)
|
character, intent(out) :: string(<<MAX_STRING_LENGTH()>>)
|
||||||
|
Loading…
Reference in New Issue
Block a user