Commit 38335f50 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Had to move some functions to the public namespace

The PGI compiler (of course) complained about a missing module
(elpa_generated_fortran_interfaces.mod) when compiling the test
programs.

It is true (in a way) that some part of this module is indeed necessary,
as the public-facing function signatures have arguments that are
referring to those three functions in their type:

  elpa_strerr_c(elpa_error)
  elpa_int_value_to_string_c(name, value, string)
  elpa_int_value_to_strlen_c(name, value)

Thus, for these three we create another header prefix,

  !pf>

for Fortran definitions that should be public. Those are included in
elpa_api.F90.
parent 2edcbfba
......@@ -9,38 +9,50 @@ elpa test src:
test/shared: | test
@mkdir $@
generated_headers =
generated_headers += config-f90.h
config-f90.h: config.h
@echo "Generating $@...";
@grep "^#define" $^ > $@ || { rm $@; exit 1; }
generated_headers += elpa/elpa_generated.h
elpa/elpa_generated.h: $(top_srcdir)/src/elpa_impl.F90 \
$(top_srcdir)/src/elpa_api.F90 | elpa
@rm -f $@
$(call extract_interface,!c>)
generated_headers += elpa/elpa_generated_legacy.h
elpa/elpa_generated_legacy.h: $(top_srcdir)/src/elpa_driver/legacy_interface/elpa_driver_c_interface.F90 \
$(top_srcdir)/src/elpa1/legacy_interface/elpa_1stage_c_interface.F90 \
$(top_srcdir)/src/elpa2/legacy_interface/elpa_2stage_c_interface.F90 | elpa
@rm -f $@
$(call extract_interface,!lc>)
generated_headers += test/shared/generated.h
test/shared/generated.h: $(wildcard $(top_srcdir)/test/shared/*.*90) | test/shared
@rm -f $@
$(call extract_interface,!c>)
generated_headers += elpa/elpa_generated_fortran_interfaces.h
elpa/elpa_generated_fortran_interfaces.h: $(wildcard $(top_srcdir)/src/elpa2/kernels/*.*c $(top_srcdir)/src/elpa2/kernels/*.s $(top_srcdir)/src/*.[ch]) | elpa
@rm -f $@
$(call extract_interface,!f>)
$(call extract_interface,#!f>)
generated_headers += elpa/elpa_generated_public_fortran_interfaces.h
elpa/elpa_generated_public_fortran_interfaces.h: $(wildcard $(top_srcdir)/src/*.[ch]) | elpa
@rm -f $@
$(call extract_interface,!pf>)
generated_headers += src/fortran_constants.X90
src/fortran_constants.X90: $(top_srcdir)/src/fortran_constants.h | src
@$(CPP) $(CPPFLAGS) -I$(top_builddir)/ -I$(top_srcdir)/ -I. $< -o $@_ || { rm -f $@; exit 1; }
@awk '/!ELPA_C_DEFINE/ {gsub(/!ELPA_C_DEFINE/, "\n"); gsub(/NEWLINE/, "\n"); print;}' < $@_ > $@ || { rm -f $@; exit 1; }
@rm $@_
generated_headers= config-f90.h elpa/elpa_generated.h elpa/elpa_generated_legacy.h test/shared/generated.h elpa/elpa_generated_fortran_interfaces.h src/fortran_constants.X90
generated-headers: $(generated_headers)
# vim: syntax=make
......@@ -54,6 +54,8 @@ module elpa_api
use, intrinsic :: iso_c_binding
implicit none
#include "elpa/elpa_generated_public_fortran_interfaces.h"
integer, private, parameter :: earliest_api_version = EARLIEST_API_VERSION !< Definition of the earliest API version supported
!< with the current release
integer, private, parameter :: current_api_version = CURRENT_API_VERSION !< Definition of the current API version
......@@ -1155,7 +1157,6 @@ module elpa_api
!> \param elpa_error integer: error code to querry
!> \result string string: error string
function elpa_strerr(elpa_error) result(string)
use elpa_generated_fortran_interfaces
integer, intent(in) :: elpa_error
character(kind=C_CHAR, len=elpa_strlen_c(elpa_strerr_c(elpa_error))), pointer :: string
call c_f_pointer(elpa_strerr_c(elpa_error), string)
......@@ -1180,7 +1181,6 @@ module elpa_api
!> \result string string: the string representation
function elpa_int_value_to_string(name, value, error) result(string)
use elpa_utilities, only : error_unit
use elpa_generated_fortran_interfaces
implicit none
character(kind=c_char, len=*), intent(in) :: name
integer(kind=c_int), intent(in) :: value
......
......@@ -51,13 +51,13 @@
#include <elpa/elpa.h>
/*
!f> interface
!f> pure function elpa_strerr_c(elpa_error) result(string) bind(C, name="elpa_strerr")
!f> import c_int, c_ptr
!f> integer(kind=c_int), intent(in), value :: elpa_error
!f> type(c_ptr) :: string
!f> end function
!f> end interface
!pf> interface
!pf> pure function elpa_strerr_c(elpa_error) result(string) bind(C, name="elpa_strerr")
!pf> import c_int, c_ptr
!pf> integer(kind=c_int), intent(in), value :: elpa_error
!pf> type(c_ptr) :: string
!pf> end function
!pf> end interface
*/
const char *elpa_strerr(int elpa_error) {
#define NAME_CASE(name, value) \
......
......@@ -299,32 +299,32 @@ int elpa_index_value_is_set(elpa_index_t index, char *name);
/*
!f> interface
!f> function elpa_int_value_to_string_c(name, value, string) &
!f> result(error) bind(C, name="elpa_int_value_to_string")
!f> import c_int, c_ptr, c_char
!f> character(kind=c_char), intent(in) :: name(*)
!f> integer(kind=c_int), intent(in), value :: value
!f> type(c_ptr), intent(out) :: string
!f> integer(kind=c_int) :: error
!f> end function
!f> end interface
!f>
!pf> interface
!pf> function elpa_int_value_to_string_c(name, value, string) &
!pf> result(error) bind(C, name="elpa_int_value_to_string")
!pf> import c_int, c_ptr, c_char
!pf> character(kind=c_char), intent(in) :: name(*)
!pf> integer(kind=c_int), intent(in), value :: value
!pf> type(c_ptr), intent(out) :: string
!pf> integer(kind=c_int) :: error
!pf> end function
!pf> end interface
!pf>
*/
int elpa_int_value_to_string(char *name, int value, const char **string);
/*
!f> interface
!f> pure function elpa_int_value_to_strlen_c(name, value) &
!f> result(length) bind(C, name="elpa_int_value_to_strlen")
!f> import c_int, c_ptr, c_char
!f> character(kind=c_char), intent(in) :: name(*)
!f> integer(kind=c_int), intent(in), value :: value
!f> integer(kind=c_int) :: length
!f> end function
!f> end interface
!f>
!pf> interface
!pf> pure function elpa_int_value_to_strlen_c(name, value) &
!pf> result(length) bind(C, name="elpa_int_value_to_strlen")
!pf> import c_int, c_ptr, c_char
!pf> character(kind=c_char), intent(in) :: name(*)
!pf> integer(kind=c_int), intent(in), value :: value
!pf> integer(kind=c_int) :: length
!pf> end function
!pf> end interface
!pf>
*/
int elpa_int_value_to_strlen(char *name, int value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment