From fef7d6b0fc387cf793c9a7be1115de82155c2d5e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 6 Feb 2019 10:47:11 -0600 Subject: Cleanup F2003 option for CMake --- CMakeLists.txt | 9 +-- config/cmake/scripts/HDF5options.cmake | 4 -- fortran/examples/CMakeTests.cmake | 60 ++++++++--------- fortran/examples/run-fortran-ex.sh.in | 18 +---- fortran/src/CMakeLists.txt | 6 +- fortran/test/CMakeTests.cmake | 70 +++++++++---------- java/src/hdf/hdf5lib/H5.java | 119 +++++++++++++++------------------ 7 files changed, 122 insertions(+), 164 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b1a3ba..81d81b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -818,9 +818,6 @@ set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _") if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") option (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF) if (HDF5_BUILD_FORTRAN) - - option (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" ON) - include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake) message (STATUS "Fortran compiler ID is ${CMAKE_Fortran_COMPILER_ID}") @@ -833,10 +830,8 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for include (${HDF_RESOURCES_DIR}/HDF5UseFortran.cmake) set (LINK_Fortran_LIBS ${LINK_LIBS}) - if (HDF5_ENABLE_F2003) - if (NOT FORTRAN_HAVE_ISO_C_BINDING) - set (HDF5_ENABLE_F2003 OFF) - endif () + if (NOT FORTRAN_HAVE_ISO_C_BINDING) + message (FATAL_ERROR " **** Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, disable HDF5_BUILD_FORTRAN **** ") endif () # Parallel IO usage requires MPI to be Linked and Included diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index fb191f3..24eaf78 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -33,12 +33,8 @@ ############################################################################################# #### fortran enabled #### #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON") - ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=ON") #### fortran disabled #### set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") - ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN -set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=OFF") ############################################################################################# #### java enabled #### diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index c3d94b4..323cf91 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -109,48 +109,46 @@ foreach (example ${examples}) endif () endforeach () -if (HDF5_ENABLE_F2003) - foreach (example ${F2003_examples}) +foreach (example ${F2003_examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME f03_ex_${example} COMMAND $) + else () + add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=f03_ex_${example}.txt" + #-D "TEST_REFERENCE=f03_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "f03_ex_${example}") + if (BUILD_SHARED_LIBS) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f03_ex_${example} COMMAND $) + add_test (NAME f03_ex-shared_${example} COMMAND $) else () - add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + add_test (NAME f03_ex-shared_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f03_ex_${example}.txt" - #-D "TEST_REFERENCE=f03_ex_${example}.out" + -D "TEST_OUTPUT=f03_ex_${example}-shared.txt" + #-D "TEST_REFERENCE=f03_ex_${example}-shared.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () if (NOT "${last_test}" STREQUAL "") - set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (f03_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) endif () - set (last_test "f03_ex_${example}") - if (BUILD_SHARED_LIBS) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f03_ex-shared_${example} COMMAND $) - else () - add_test (NAME f03_ex-shared_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f03_ex_${example}-shared.txt" - #-D "TEST_REFERENCE=f03_ex_${example}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (f03_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f03_ex-shared_${example}") - endif () - endforeach () -endif () + set (last_test "f03_ex-shared_${example}") + endif () +endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_test (NAME f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) diff --git a/fortran/examples/run-fortran-ex.sh.in b/fortran/examples/run-fortran-ex.sh.in index da0c357..aa17f89 100644 --- a/fortran/examples/run-fortran-ex.sh.in +++ b/fortran/examples/run-fortran-ex.sh.in @@ -61,8 +61,6 @@ RunTest() ./$TEST_EXEC } -F2003_ENABLED=@HAVE_FORTRAN_2003@ - ################## MAIN ################## # Run tests @@ -97,17 +95,8 @@ then RunTest mountexample &&\ rm mountexample &&\ RunTest compound &&\ - rm compound); then - EXIT_VALUE=${EXIT_SUCCESS} - else - EXIT_VALUE=${EXIT_FAILURE} - fi -fi - -if [ $EXIT_VALUE -eq ${EXIT_SUCCESS} -a "$F2003_ENABLED" = "yes" ] -then -# Add attention tests for Fortran 2003 features - if (RunTest rwdset_fortran2003 &&\ + rm compound &&\ + RunTest rwdset_fortran2003 &&\ rm rwdset_fortran2003 &&\ RunTest nested_derived_type &&\ rm nested_derived_type &&\ @@ -120,12 +109,11 @@ then EXIT_VALUE=${EXIT_FAILURE} fi fi - # Cleanup rm *.o rm *.h5 echo -exit $EXIT_VALUE +exit $EXIT_VALUE diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 025fab5..f71e820 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -9,11 +9,7 @@ if (WIN32) if (NOT H5_HAVE_PARALLEL) set (H5_NOPAREXP ";") endif () - if (NOT HDF5_ENABLE_F2003) - set (H5_NOF03EXP ";") - else () - set (H5_F03EXP ";") - endif () + set (H5_F03EXP ";") configure_file (${HDF5_F90_SRC_SOURCE_DIR}/hdf5_fortrandll.def.in ${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def @ONLY) endif () endif () diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 4d06359..2824ef7 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -103,26 +103,24 @@ endif () set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran) #-- Adding test for fortranlib_test_F03 -if (HDF5_ENABLE_F2003) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND $) - else () - add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_REGEX= 0 error.s." - -D "TEST_MATCH= 0 error(s)" - -D "TEST_OUTPUT=fortranlib_test_F03.txt" - #-D "TEST_REFERENCE=fortranlib_test_F03.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND $) +else () + add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_REGEX= 0 error.s." + -D "TEST_MATCH= 0 error(s)" + -D "TEST_OUTPUT=fortranlib_test_F03.txt" + #-D "TEST_REFERENCE=fortranlib_test_F03.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () # set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) -endif () #-- Adding test for fflush1 add_test (NAME FORTRAN_fflush1 COMMAND $) @@ -215,26 +213,24 @@ if (BUILD_SHARED_LIBS) set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) #-- Adding test for fortranlib_test_F03 - if (HDF5_ENABLE_F2003) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND $) - else () - add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_REGEX= 0 error.s." - -D "TEST_MATCH= 0 error(s)" - -D "TEST_OUTPUT=fortranlib_test_F03.txt" - #-D "TEST_REFERENCE=fortranlib_test_F03.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () -# set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND $) + else () + add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_REGEX= 0 error.s." + -D "TEST_MATCH= 0 error(s)" + -D "TEST_OUTPUT=fortranlib_test_F03.txt" + #-D "TEST_REFERENCE=fortranlib_test_F03.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) endif () +# set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") + set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03) #-- Adding test for fflush1 add_test (NAME FORTRAN_fflush1-shared COMMAND $) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 03266e6..255a8ec 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -57,19 +57,18 @@ import hdf.hdf5lib.structs.H5O_info_t; /** * This class is the Java interface for the HDF5 library. *

- * This code is the called by Java programs to access the entry points of the HDF5 library. Each - * routine wraps a single HDF5 entry point, generally with the arguments and return codes analogous - * to the C interface. + * This code is the called by Java programs to access the entry points of the HDF5 library. Each routine wraps a single + * HDF5 entry point, generally with the arguments and return codes analogous to the C interface. *

- * For details of the HDF5 library, see the HDF5 Documentation at: - * http://hdfgroup.org/HDF5/ + * For details of the HDF5 library, see the HDF5 Documentation at: http://hdfgroup.org/HDF5/ *


*

* Mapping of arguments for Java * *

- * In general, arguments to the HDF Java API are straightforward translations from the 'C' API - * described in the HDF Reference Manual. + * In general, arguments to the HDF Java API are straightforward translations from the 'C' API described in the HDF + * Reference Manual. * * * @@ -109,19 +108,17 @@ import hdf.hdf5lib.structs.H5O_info_t; *
HDF-5 C types to Java types
* General Rules for Passing Arguments and Results *

- * In general, arguments passed IN to Java are the analogous basic types, as above. The - * exception is for arrays, which are discussed below. + * In general, arguments passed IN to Java are the analogous basic types, as above. The exception is for arrays, + * which are discussed below. *

- * The return value of Java methods is also the analogous type, as above. A major exception - * to that rule is that all HDF functions that return SUCCEED/FAIL are declared boolean in - * the Java version, rather than int as in the C. Functions that return a value or else FAIL - * are declared the equivalent to the C function. However, in most cases the Java method will raise - * an exception instead of returning an error code. See Errors and Exceptions - * below. + * The return value of Java methods is also the analogous type, as above. A major exception to that rule is that + * all HDF functions that return SUCCEED/FAIL are declared boolean in the Java version, rather than int as + * in the C. Functions that return a value or else FAIL are declared the equivalent to the C function. However, in most + * cases the Java method will raise an exception instead of returning an error code. See Errors and + * Exceptions below. *

- * Java does not support pass by reference of arguments, so arguments that are returned through - * OUT parameters must be wrapped in an object or array. The Java API for HDF consistently - * wraps arguments in arrays. + * Java does not support pass by reference of arguments, so arguments that are returned through OUT parameters + * must be wrapped in an object or array. The Java API for HDF consistently wraps arguments in arrays. *

* For instance, a function that returns two integers is declared: * @@ -142,14 +139,12 @@ import hdf.hdf5lib.structs.H5O_info_t; * * *

- * All the routines where this convention is used will have specific documentation of the details, - * given below. + * All the routines where this convention is used will have specific documentation of the details, given below. *

* Arrays *

- * HDF5 needs to read and write multi-dimensional arrays of any number type (and records). The HDF5 - * API describes the layout of the source and destination, and the data for the array passed as a - * block of bytes, for instance, + * HDF5 needs to read and write multi-dimensional arrays of any number type (and records). The HDF5 API describes the + * layout of the source and destination, and the data for the array passed as a block of bytes, for instance, * *

  *      herr_t H5Dread(long fid, long filetype, long memtype, long memspace,
@@ -157,45 +152,40 @@ import hdf.hdf5lib.structs.H5O_info_t;
  * 
* *

- * where ``void *'' means that the data may be any valid numeric type, and is a contiguous block of - * bytes that is the data for a multi-dimensional array. The other parameters describe the - * dimensions, rank, and datatype of the array on disk (source) and in memory (destination). + * where ``void *'' means that the data may be any valid numeric type, and is a contiguous block of bytes that is the + * data for a multi-dimensional array. The other parameters describe the dimensions, rank, and datatype of the array on + * disk (source) and in memory (destination). *

- * For Java, this ``ANY'' is a problem, as the type of data must always be declared. Furthermore, - * multidimensional arrays are definitely not layed out contiguously in memory. It would be - * infeasible to declare a separate routine for every combination of number type and dimensionality. - * For that reason, the HDFArray class is used to - * discover the type, shape, and size of the data array at run time, and to convert to and from a - * contiguous array of bytes in synchronized static native C order. + * For Java, this ``ANY'' is a problem, as the type of data must always be declared. Furthermore, multidimensional + * arrays are definitely not layed out contiguously in memory. It would be infeasible to declare a separate + * routine for every combination of number type and dimensionality. For that reason, the HDFArray class is used to discover the type, shape, and size of the + * data array at run time, and to convert to and from a contiguous array of bytes in synchronized static native C order. *

- * The upshot is that any Java array of numbers (either primitive or sub-classes of type - * Number) can be passed as an ``Object'', and the Java API will translate to and from the - * appropriate packed array of bytes needed by the C library. So the function above would be - * declared: + * The upshot is that any Java array of numbers (either primitive or sub-classes of type Number) can be passed as + * an ``Object'', and the Java API will translate to and from the appropriate packed array of bytes needed by the C + * library. So the function above would be declared: * *

  * public synchronized static native int H5Dread(long fid, long filetype, long memtype, long memspace, Object data);
  * 
- * - * OPEN_IDS.addElement(id); - * - * and the parameter data can be any multi-dimensional array of numbers, such as float[][], - * or int[][][], or Double[][]. + * OPEN_IDS.addElement(id); + + * and the parameter data can be any multi-dimensional array of numbers, such as float[][], or int[][][], or + * Double[][]. *

* HDF-5 Constants *

- * The HDF-5 API defines a set of constants and enumerated values. Most of these values are - * available to Java programs via the class - * HDF5Constants. For example, the parameters for the h5open() call include two numeric - * values, HDFConstants.H5F_ACC_RDWR and HDF5Constants.H5P_DEFAULT. As - * would be expected, these numbers correspond to the C constants H5F_ACC_RDWR and - * H5P_DEFAULT. + * The HDF-5 API defines a set of constants and enumerated values. Most of these values are available to Java programs + * via the class HDF5Constants. For example, the parameters for + * the h5open() call include two numeric values, HDFConstants.H5F_ACC_RDWR and + * HDF5Constants.H5P_DEFAULT. As would be expected, these numbers correspond to the C constants + * H5F_ACC_RDWR and H5P_DEFAULT. *

- * The HDF-5 API defines a set of values that describe number types and sizes, such as - * "H5T_NATIVE_INT" and "hsize_t". These values are determined at run time by the HDF-5 C library. - * To support these parameters, the Java class - * HDF5CDataTypes looks up the values when initiated. The values can be accessed as - * public variables of the Java class, such as: + * The HDF-5 API defines a set of values that describe number types and sizes, such as "H5T_NATIVE_INT" and "hsize_t". + * These values are determined at run time by the HDF-5 C library. To support these parameters, the Java class HDF5CDataTypes looks up the values when initiated. The values + * can be accessed as public variables of the Java class, such as: * *

  * long data_type = HDF5CDataTypes.JH5T_NATIVE_INT;
@@ -206,21 +196,20 @@ import hdf.hdf5lib.structs.H5O_info_t;
  * 

* Error handling and Exceptions *

- * The HDF5 error API (H5E) manages the behavior of the error stack in the HDF-5 library. This API - * is omitted from the JHI5. Errors are converted into Java exceptions. This is totally different - * from the C interface, but is very natural for Java programming. + * The HDF5 error API (H5E) manages the behavior of the error stack in the HDF-5 library. This API is omitted from the + * JHI5. Errors are converted into Java exceptions. This is totally different from the C interface, but is very natural + * for Java programming. *

- * The exceptions of the JHI5 are organized as sub-classes of the class - * HDF5Exception. There are two - * subclasses of HDF5Exception, - * HDF5LibraryException and - * HDF5JavaException. The sub-classes of the former represent errors from the HDF-5 C - * library, while sub-classes of the latter represent errors in the JHI5 wrapper and support code. + * The exceptions of the JHI5 are organized as sub-classes of the class HDF5Exception. There are two subclasses of + * HDF5Exception, HDF5LibraryException + * and HDF5JavaException. The sub-classes of the + * former represent errors from the HDF-5 C library, while sub-classes of the latter represent errors in the JHI5 + * wrapper and support code. *

- * The super-class HDF5LibraryException implements the method - * 'printStackTrace()', which prints out the HDF-5 error stack, as described in the - * HDF-5 C API H5Eprint(). This may be used by Java exception handlers to print out - * the HDF-5 error stack. + * The super-class HDF5LibraryException implements the method 'printStackTrace()', which + * prints out the HDF-5 error stack, as described in the HDF-5 C API H5Eprint(). This may be used by Java + * exception handlers to print out the HDF-5 error stack. *


* * @version HDF5 1.10.5
-- cgit v0.12