summaryrefslogtreecommitdiffstats
path: root/fortran/test/tf_F08.f90
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2014-06-16 15:15:25 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2014-06-16 15:15:25 (GMT)
commit744bc7d236c18d65e9ac84e856f67e8ed145ef91 (patch)
tree7de2903b9bd1db3d387598ab47469e009db160e9 /fortran/test/tf_F08.f90
parent588a733b189d7410ccf4dc7da56ef81f2b11604f (diff)
downloadhdf5-744bc7d236c18d65e9ac84e856f67e8ed145ef91.zip
hdf5-744bc7d236c18d65e9ac84e856f67e8ed145ef91.tar.gz
hdf5-744bc7d236c18d65e9ac84e856f67e8ed145ef91.tar.bz2
[svn-r25286] Fix for:
HDFFV-8653 replace non-standard sizeof in the fortran tests with c_sizeof Tested: jam (gnu, intel) with make and cmake.
Diffstat (limited to 'fortran/test/tf_F08.f90')
-rw-r--r--fortran/test/tf_F08.f90139
1 files changed, 139 insertions, 0 deletions
diff --git a/fortran/test/tf_F08.f90 b/fortran/test/tf_F08.f90
new file mode 100644
index 0000000..3ad2820
--- /dev/null
+++ b/fortran/test/tf_F08.f90
@@ -0,0 +1,139 @@
+!****h* root/fortran/test/tf_F08.f90
+!
+! NAME
+! tf_F08.f90
+!
+! FUNCTION
+! Contains functions that are part of the F2008 standard and needed by
+! the hdf5 fortran tests.
+!
+! COPYRIGHT
+! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+! Copyright by The HDF Group. *
+! Copyright by the Board of Trustees of the University of Illinois. *
+! All rights reserved. *
+! *
+! This file is part of HDF5. The full HDF5 copyright notice, including *
+! terms governing use, modification, and redistribution, is contained in *
+! the files COPYING and Copyright.html. COPYING can be found at the root *
+! of the source code distribution tree; Copyright.html can be found at the *
+! root level of an installed copy of the electronic HDF5 document set and *
+! is linked from the top-level documents page. It can also be found at *
+! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+! access to either file, you may request a copy from help@hdfgroup.org. *
+! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+!
+! CONTAINS SUBROUTINES
+! H5_SIZEOF
+!
+! NOTES
+! This file contains "sizeof" functions that are F2008 standard compliant
+! and replace the non-standard 'SIZEOF' functions found in the file tf_F03.
+! Unfortunity we need to wrap the C_SIZEOF/STORAGE_SIZE functions to handle different
+! data types from the various tests.
+!
+! F08+TS29113 requires C interoperable variable as argument for C_SIZEOF.
+!
+! This file will be build instead of tf_F03.f90 if the intrinsic fortran
+! function C_SIZEOF/STORAGE_SIZE is found during configure.
+!
+!*****
+MODULE TH5_MISC_PROVISIONAL
+
+ USE ISO_C_BINDING
+ IMPLICIT NONE
+
+ INTEGER, PARAMETER :: sp = KIND(0.0)
+ INTEGER, PARAMETER :: dp = KIND(0.D0)
+
+ ! generic compound datatype
+ TYPE, BIND(C) :: comp_datatype
+ REAL :: a
+ INTEGER :: x
+ DOUBLE PRECISION :: y
+ CHARACTER(LEN=1) :: z
+ END TYPE comp_datatype
+
+ PUBLIC :: H5_SIZEOF
+ INTERFACE H5_SIZEOF
+ MODULE PROCEDURE H5_SIZEOF_CMPD
+ MODULE PROCEDURE H5_SIZEOF_CHR
+ MODULE PROCEDURE H5_SIZEOF_I, H5_SIZEOF_IV
+ MODULE PROCEDURE H5_SIZEOF_SP,H5_SIZEOF_DP
+ END INTERFACE
+
+CONTAINS
+
+!This definition is needed for Windows DLLs
+!DEC$if defined(BUILD_HDF5_DLL)
+!DEC$attributes dllexport :: h5_sizeof_cmpd
+!DEC$endif
+ INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_CMPD(a)
+ IMPLICIT NONE
+ TYPE(comp_datatype), INTENT(in) :: a
+
+ H5_SIZEOF_CMPD = C_SIZEOF(a)
+
+ END FUNCTION H5_SIZEOF_CMPD
+
+!This definition is needed for Windows DLLs
+!DEC$if defined(BUILD_HDF5_DLL)
+!DEC$attributes dllexport :: h5_sizeof_chr
+!DEC$endif
+ INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_CHR(a)
+ IMPLICIT NONE
+ CHARACTER(LEN=*), INTENT(in) :: a
+
+ H5_SIZEOF_CHR = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t)
+
+ END FUNCTION H5_SIZEOF_CHR
+
+!This definition is needed for Windows DLLs
+!DEC$if defined(BUILD_HDF5_DLL)
+!DEC$attributes dllexport :: h5_sizeof_i
+!DEC$endif
+ INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_I(a)
+ IMPLICIT NONE
+ INTEGER, INTENT(in):: a
+
+ H5_SIZEOF_I = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t)
+
+ END FUNCTION H5_SIZEOF_I
+
+!This definition is needed for Windows DLLs
+!DEC$if defined(BUILD_HDF5_DLL)
+!DEC$attributes dllexport :: h5_sizeof_iv
+!DEC$endif
+ INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_IV(a)
+ IMPLICIT NONE
+ INTEGER, DIMENSION(:), INTENT(in):: a
+
+ H5_SIZEOF_IV = SIZE(a)*storage_size(a(1), c_size_t)/storage_size(c_char_'a',c_size_t)
+
+ END FUNCTION H5_SIZEOF_IV
+
+!This definition is needed for Windows DLLs
+!DEC$if defined(BUILD_HDF5_DLL)
+!DEC$attributes dllexport :: h5_sizeof_sp
+!DEC$endif
+ INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_SP(a)
+ IMPLICIT NONE
+ REAL(sp), INTENT(in):: a
+
+ H5_SIZEOF_SP = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t)
+
+ END FUNCTION H5_SIZEOF_SP
+
+!This definition is needed for Windows DLLs
+!DEC$if defined(BUILD_HDF5_DLL)
+!DEC$attributes dllexport :: h5_sizeof_dp
+!DEC$endif
+ INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_DP(a)
+ IMPLICIT NONE
+ REAL(dp), INTENT(in):: a
+
+ H5_SIZEOF_DP = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t)
+
+ END FUNCTION H5_SIZEOF_DP
+
+END MODULE TH5_MISC_PROVISIONAL