2011-08-18 22:32:47 +08:00
|
|
|
!****h* root/fortran/test/tf.f90
|
|
|
|
!
|
|
|
|
! NAME
|
|
|
|
! tf.f90
|
|
|
|
!
|
|
|
|
! FUNCTION
|
|
|
|
! Contains subroutines which are needed in all the hdf5 fortran tests
|
|
|
|
!
|
|
|
|
! COPYRIGHT
|
2010-01-30 12:29:13 +08:00
|
|
|
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-08 01:55:01 +08:00
|
|
|
! Copyright by The HDF Group. *
|
2002-09-24 06:06:01 +08:00
|
|
|
! 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 *
|
2007-02-08 01:55:01 +08:00
|
|
|
! 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. *
|
2010-01-30 12:29:13 +08:00
|
|
|
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
!
|
2011-08-18 22:32:47 +08:00
|
|
|
! CONTAINS SUBROUTINES
|
|
|
|
! write_test_status, check, verify, verifyLogical, verifyString, h5_fixname_f,
|
2014-04-09 03:34:42 +08:00
|
|
|
! h5_cleanup_f, h5_exit_f, h5_env_nocleanup_f,dreal_eqv
|
2002-09-24 06:06:01 +08:00
|
|
|
!
|
2011-08-18 22:32:47 +08:00
|
|
|
!*****
|
2015-04-21 03:15:30 +08:00
|
|
|
|
|
|
|
#include "H5config_f.inc"
|
|
|
|
|
2014-04-06 23:56:21 +08:00
|
|
|
MODULE TH5_MISC
|
|
|
|
|
2015-04-30 22:39:57 +08:00
|
|
|
USE, INTRINSIC :: ISO_C_BINDING
|
2014-06-16 23:15:25 +08:00
|
|
|
|
|
|
|
IMPLICIT NONE
|
2014-04-06 23:56:21 +08:00
|
|
|
|
2015-04-21 03:15:30 +08:00
|
|
|
INTEGER, PARAMETER :: sp = SELECTED_REAL_KIND(5) ! This should map to REAL*4 on most modern processors
|
|
|
|
INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(10) ! This should map to REAL*8 on most modern processors
|
|
|
|
|
|
|
|
! generic compound datatype
|
|
|
|
TYPE, BIND(C) :: comp_datatype
|
|
|
|
REAL :: a
|
|
|
|
INTEGER :: x
|
|
|
|
DOUBLE PRECISION :: y
|
2015-04-30 22:39:57 +08:00
|
|
|
CHARACTER(KIND=C_CHAR, LEN=1) :: z
|
2015-04-21 03:15:30 +08:00
|
|
|
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
|
|
|
|
MODULE PROCEDURE H5_SIZEOF_SP,H5_SIZEOF_DP
|
|
|
|
END INTERFACE
|
|
|
|
|
2014-04-06 23:56:21 +08:00
|
|
|
CONTAINS
|
|
|
|
|
|
|
|
!This definition is needed for Windows DLLs
|
2015-02-21 01:25:56 +08:00
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
2014-04-09 03:34:42 +08:00
|
|
|
!DEC$attributes dllexport :: dreal_eq
|
2014-04-06 23:56:21 +08:00
|
|
|
!DEC$endif
|
2014-04-09 03:34:42 +08:00
|
|
|
LOGICAL FUNCTION dreal_eq(a,b)
|
2014-04-06 23:56:21 +08:00
|
|
|
|
2014-04-09 03:34:42 +08:00
|
|
|
! Check if two double precision reals are equivalent
|
|
|
|
REAL(dp), INTENT (in):: a,b
|
|
|
|
REAL(dp), PARAMETER :: eps = 1.e-8
|
|
|
|
dreal_eq = ABS(a-b) .LT. eps
|
2014-04-06 23:56:21 +08:00
|
|
|
|
2014-04-09 03:34:42 +08:00
|
|
|
END FUNCTION dreal_eq
|
2014-04-06 23:56:21 +08:00
|
|
|
|
2011-08-18 22:32:47 +08:00
|
|
|
!This definition is needed for Windows DLLs
|
2015-02-21 01:25:56 +08:00
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
2013-03-27 23:04:33 +08:00
|
|
|
!DEC$attributes dllexport :: verify_real_kind_7
|
2011-08-18 22:32:47 +08:00
|
|
|
!DEC$endif
|
2014-04-09 03:34:42 +08:00
|
|
|
SUBROUTINE verify_real_kind_7(string,value,correct_value,total_error)
|
|
|
|
USE HDF5
|
|
|
|
INTEGER, PARAMETER :: real_kind_7 = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors
|
|
|
|
CHARACTER(LEN=*) :: string
|
|
|
|
REAL(real_kind_7) :: value, correct_value
|
|
|
|
INTEGER :: total_error
|
|
|
|
IF (.NOT.dreal_eq( REAL(value,dp), REAL(correct_value, dp)) ) THEN
|
|
|
|
total_error=total_error+1
|
|
|
|
WRITE(*,*) "ERROR: INCORRECT REAL VALIDATION ", string
|
|
|
|
ENDIF
|
|
|
|
RETURN
|
|
|
|
END SUBROUTINE verify_real_kind_7
|
2008-05-21 23:02:24 +08:00
|
|
|
|
2003-04-16 06:34:43 +08:00
|
|
|
!This definition is needed for Windows DLLs
|
2015-02-21 01:25:56 +08:00
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
2010-01-30 12:29:13 +08:00
|
|
|
!DEC$attributes dllexport :: write_test_status
|
2003-04-16 06:34:43 +08:00
|
|
|
!DEC$endif
|
2008-05-21 23:02:24 +08:00
|
|
|
SUBROUTINE write_test_status( test_result, test_title, total_error)
|
|
|
|
|
2014-04-09 03:34:42 +08:00
|
|
|
! Writes the results of the tests
|
2008-05-21 23:02:24 +08:00
|
|
|
|
|
|
|
IMPLICIT NONE
|
|
|
|
|
|
|
|
INTEGER, INTENT(IN) :: test_result ! negative, --skip --
|
2010-01-30 12:29:13 +08:00
|
|
|
! 0 , passed
|
2008-05-21 23:02:24 +08:00
|
|
|
! positive, failed
|
|
|
|
|
|
|
|
CHARACTER(LEN=*), INTENT(IN) :: test_title ! Short description of test
|
|
|
|
INTEGER, INTENT(INOUT) :: total_error ! Accumulated error
|
2002-09-24 06:06:01 +08:00
|
|
|
|
2008-05-28 00:06:23 +08:00
|
|
|
! Controls the output style for reporting test results
|
|
|
|
|
2014-04-09 03:34:42 +08:00
|
|
|
CHARACTER(LEN=8) :: error_string
|
|
|
|
CHARACTER(LEN=8), PARAMETER :: success = ' PASSED '
|
|
|
|
CHARACTER(LEN=8), PARAMETER :: failure = '*FAILED*'
|
|
|
|
CHARACTER(LEN=8), PARAMETER :: skip = '--SKIP--'
|
|
|
|
|
2008-05-28 00:06:23 +08:00
|
|
|
|
2008-05-21 23:02:24 +08:00
|
|
|
error_string = failure
|
|
|
|
IF (test_result == 0) THEN
|
|
|
|
error_string = success
|
|
|
|
ELSE IF (test_result == -1) THEN
|
|
|
|
error_string = skip
|
|
|
|
ENDIF
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-31 04:30:11 +08:00
|
|
|
WRITE(*, fmt = '(A, T72, A)') test_title, error_string
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-21 23:02:24 +08:00
|
|
|
IF(test_result.GT.0) total_error = total_error + test_result
|
|
|
|
|
|
|
|
END SUBROUTINE write_test_status
|
|
|
|
|
|
|
|
|
|
|
|
!This definition is needed for Windows DLLs
|
2015-02-21 01:25:56 +08:00
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
2008-05-21 23:02:24 +08:00
|
|
|
!DEC$attributes dllexport :: check
|
|
|
|
!DEC$endif
|
2014-04-09 03:34:42 +08:00
|
|
|
SUBROUTINE check(string,error,total_error)
|
|
|
|
CHARACTER(LEN=*) :: string
|
|
|
|
INTEGER :: error, total_error
|
|
|
|
IF (error .LT. 0) THEN
|
|
|
|
total_error=total_error+1
|
|
|
|
WRITE(*,*) string, " FAILED"
|
|
|
|
ENDIF
|
|
|
|
RETURN
|
|
|
|
END SUBROUTINE check
|
2008-05-01 03:23:26 +08:00
|
|
|
|
|
|
|
!This definition is needed for Windows DLLs
|
2015-02-21 01:25:56 +08:00
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
2008-05-01 03:51:13 +08:00
|
|
|
!DEC$attributes dllexport :: verify
|
2008-05-01 03:23:26 +08:00
|
|
|
!DEC$endif
|
2014-04-09 03:34:42 +08:00
|
|
|
SUBROUTINE VERIFY(string,value,correct_value,total_error)
|
|
|
|
CHARACTER(LEN=*) :: string
|
|
|
|
INTEGER :: value, correct_value, total_error
|
|
|
|
IF (value .NE. correct_value) THEN
|
|
|
|
total_error=total_error+1
|
|
|
|
WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string
|
|
|
|
ENDIF
|
|
|
|
RETURN
|
|
|
|
END SUBROUTINE verify
|
2008-05-04 07:39:37 +08:00
|
|
|
|
2015-03-31 02:17:45 +08:00
|
|
|
!This definition is needed for Windows DLLs
|
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
|
|
|
!DEC$attributes dllexport :: verify_INTEGER_HID_T
|
|
|
|
!DEC$endif
|
|
|
|
SUBROUTINE verify_INTEGER_HID_T(string,value,correct_value,total_error)
|
|
|
|
USE HDF5
|
|
|
|
CHARACTER(LEN=*) :: string
|
|
|
|
INTEGER(HID_T) :: value, correct_value
|
|
|
|
INTEGER :: total_error
|
|
|
|
IF (value .NE. correct_value) THEN
|
|
|
|
total_error=total_error+1
|
|
|
|
WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string
|
|
|
|
ENDIF
|
|
|
|
RETURN
|
|
|
|
END SUBROUTINE verify_INTEGER_HID_T
|
|
|
|
|
2011-08-18 22:32:47 +08:00
|
|
|
!This definition is needed for Windows DLLs
|
2015-02-21 01:25:56 +08:00
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
2015-03-30 10:32:09 +08:00
|
|
|
!DEC$attributes dllexport :: verify_Fortran_INTEGER_4
|
2011-08-18 22:32:47 +08:00
|
|
|
!DEC$endif
|
2015-03-30 10:32:09 +08:00
|
|
|
SUBROUTINE verify_Fortran_INTEGER_4(string,value,correct_value,total_error)
|
|
|
|
USE HDF5
|
|
|
|
INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(Fortran_INTEGER_4) ! should map to INTEGER*4 on most modern processors
|
2014-04-09 03:34:42 +08:00
|
|
|
CHARACTER(LEN=*) :: string
|
2015-03-30 10:32:09 +08:00
|
|
|
INTEGER(int_kind_8) :: value, correct_value
|
2014-04-09 03:34:42 +08:00
|
|
|
INTEGER :: total_error
|
|
|
|
IF (value .NE. correct_value) THEN
|
|
|
|
total_error=total_error+1
|
|
|
|
WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string
|
|
|
|
ENDIF
|
|
|
|
RETURN
|
2015-03-30 10:32:09 +08:00
|
|
|
END SUBROUTINE verify_Fortran_INTEGER_4
|
2011-08-18 22:32:47 +08:00
|
|
|
|
2008-05-04 07:39:37 +08:00
|
|
|
!This definition is needed for Windows DLLs
|
2015-02-21 01:25:56 +08:00
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
2008-05-04 07:39:37 +08:00
|
|
|
!DEC$attributes dllexport :: verifyLogical
|
|
|
|
!DEC$endif
|
2014-04-09 03:34:42 +08:00
|
|
|
SUBROUTINE verifyLogical(string,value,correct_value,total_error)
|
|
|
|
CHARACTER(LEN=*) :: string
|
|
|
|
LOGICAL :: value, correct_value
|
|
|
|
INTEGER :: total_error
|
|
|
|
IF (value .NEQV. correct_value) THEN
|
|
|
|
total_error = total_error + 1
|
|
|
|
WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string
|
|
|
|
ENDIF
|
|
|
|
RETURN
|
|
|
|
END SUBROUTINE verifyLogical
|
|
|
|
|
2008-05-04 07:39:37 +08:00
|
|
|
!This definition is needed for Windows DLLs
|
2015-02-21 01:25:56 +08:00
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
2008-05-13 02:14:12 +08:00
|
|
|
!DEC$attributes dllexport :: verifyString
|
2008-05-04 07:39:37 +08:00
|
|
|
!DEC$endif
|
2014-04-09 03:34:42 +08:00
|
|
|
SUBROUTINE verifyString(string, value,correct_value,total_error)
|
|
|
|
CHARACTER*(*) :: string
|
|
|
|
CHARACTER*(*) :: value, correct_value
|
|
|
|
INTEGER :: total_error
|
|
|
|
IF (TRIM(value) .NE. TRIM(correct_value)) THEN
|
|
|
|
total_error = total_error + 1
|
|
|
|
WRITE(*,*) "ERROR: INCORRECT VALIDATION ", string
|
|
|
|
ENDIF
|
|
|
|
RETURN
|
|
|
|
END SUBROUTINE verifyString
|
2008-05-04 07:39:37 +08:00
|
|
|
|
2003-12-12 02:29:36 +08:00
|
|
|
|
2002-09-24 06:06:01 +08:00
|
|
|
!----------------------------------------------------------------------
|
2010-01-30 12:29:13 +08:00
|
|
|
! Name: h5_fixname_f
|
2002-09-24 06:06:01 +08:00
|
|
|
!
|
|
|
|
! Purpose: Create a file name from the a file base name.
|
|
|
|
! It is a fortran counterpart for the h5_fixname in ../../test/h5test.c
|
|
|
|
!
|
2010-01-30 12:29:13 +08:00
|
|
|
! Inputs:
|
|
|
|
! base_name - base name of the file
|
|
|
|
! fapl - file access property list
|
|
|
|
! Outputs:
|
2002-09-24 06:06:01 +08:00
|
|
|
! full_name - full file name
|
2010-01-30 12:29:13 +08:00
|
|
|
! hdferr: - error code
|
2002-09-24 06:06:01 +08:00
|
|
|
! Success: 0
|
2010-01-30 12:29:13 +08:00
|
|
|
! Failure: -1
|
2002-09-24 06:06:01 +08:00
|
|
|
!
|
|
|
|
! Programmer: Elena Pourmal
|
|
|
|
! September 13, 2002
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!----------------------------------------------------------------------
|
2014-04-09 03:34:42 +08:00
|
|
|
SUBROUTINE h5_fixname_f(base_name, full_name, fapl, hdferr)
|
2002-09-24 06:06:01 +08:00
|
|
|
!
|
2003-04-16 06:34:43 +08:00
|
|
|
!This definition is needed for Windows DLLs
|
2015-02-21 01:25:56 +08:00
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
2003-04-16 06:34:43 +08:00
|
|
|
!DEC$attributes dllexport :: h5_fixname_f
|
|
|
|
!DEC$endif
|
2014-04-09 03:34:42 +08:00
|
|
|
USE H5GLOBAL
|
|
|
|
IMPLICIT NONE
|
|
|
|
CHARACTER(LEN=*), INTENT(IN) :: base_name ! base name
|
|
|
|
CHARACTER(LEN=*), INTENT(IN) :: full_name ! full name
|
|
|
|
INTEGER, INTENT(OUT) :: hdferr ! Error code
|
|
|
|
INTEGER(HID_T), INTENT(IN) :: fapl ! file access property list
|
|
|
|
|
|
|
|
INTEGER(SIZE_T) :: base_namelen ! Length of the base name character string
|
|
|
|
INTEGER(SIZE_T) :: full_namelen ! Length of the full name character string
|
2002-09-24 06:06:01 +08:00
|
|
|
! INTEGER(HID_T) :: fapl_default
|
|
|
|
|
2014-04-09 03:34:42 +08:00
|
|
|
INTERFACE
|
|
|
|
INTEGER FUNCTION h5_fixname_c(base_name, base_namelen, fapl, &
|
|
|
|
full_name, full_namelen)
|
|
|
|
USE H5GLOBAL
|
|
|
|
!DEC$ IF DEFINED(HDF5F90_WINDOWS)
|
|
|
|
!DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_FIXNAME_C':: h5_fixname_c
|
|
|
|
!DEC$ ENDIF
|
|
|
|
!DEC$ATTRIBUTES reference :: base_name
|
|
|
|
!DEC$ATTRIBUTES reference :: full_name
|
|
|
|
CHARACTER(LEN=*), INTENT(IN) :: base_name
|
|
|
|
INTEGER(SIZE_T) :: base_namelen
|
|
|
|
INTEGER(HID_T), INTENT(IN) :: fapl
|
|
|
|
CHARACTER(LEN=*), INTENT(IN) :: full_name
|
|
|
|
INTEGER(SIZE_T) :: full_namelen
|
|
|
|
END FUNCTION h5_fixname_c
|
|
|
|
END INTERFACE
|
|
|
|
|
|
|
|
base_namelen = LEN(base_name)
|
|
|
|
full_namelen = LEN(full_name)
|
|
|
|
hdferr = h5_fixname_c(base_name, base_namelen, fapl, &
|
|
|
|
full_name, full_namelen)
|
|
|
|
|
|
|
|
END SUBROUTINE h5_fixname_f
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2002-09-24 06:06:01 +08:00
|
|
|
!----------------------------------------------------------------------
|
2010-01-30 12:29:13 +08:00
|
|
|
! Name: h5_cleanup_f
|
2002-09-24 06:06:01 +08:00
|
|
|
!
|
|
|
|
! Purpose: Cleanups tests files
|
|
|
|
! It is a fortran counterpart for the h5_cleanup in ../../test/h5test.c
|
|
|
|
!
|
2010-01-30 12:29:13 +08:00
|
|
|
! Inputs:
|
|
|
|
! base_name - base name of the file
|
|
|
|
! fapl - file access property list
|
|
|
|
! Outputs:
|
|
|
|
! hdferr: - error code
|
2002-09-24 06:06:01 +08:00
|
|
|
! Success: 0
|
2010-01-30 12:29:13 +08:00
|
|
|
! Failure: -1
|
2002-09-24 06:06:01 +08:00
|
|
|
!
|
|
|
|
! Programmer: Elena Pourmal
|
|
|
|
! September 19, 2002
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!----------------------------------------------------------------------
|
2014-04-09 03:34:42 +08:00
|
|
|
SUBROUTINE h5_cleanup_f(base_name, fapl, hdferr)
|
2002-09-24 06:06:01 +08:00
|
|
|
!
|
2003-04-16 06:34:43 +08:00
|
|
|
!This definition is needed for Windows DLLs
|
2015-02-21 01:25:56 +08:00
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
2003-04-16 06:34:43 +08:00
|
|
|
!DEC$attributes dllexport :: h5_cleanup_f
|
|
|
|
!DEC$endif
|
2014-04-09 03:34:42 +08:00
|
|
|
USE H5GLOBAL
|
|
|
|
IMPLICIT NONE
|
|
|
|
CHARACTER(LEN=*), INTENT(IN) :: base_name ! base name
|
|
|
|
INTEGER, INTENT(OUT) :: hdferr ! Error code
|
|
|
|
INTEGER(HID_T), INTENT(IN) :: fapl ! file access property list
|
|
|
|
|
|
|
|
INTEGER(SIZE_T) :: base_namelen ! Length of the base name character string
|
|
|
|
|
|
|
|
INTERFACE
|
|
|
|
INTEGER FUNCTION h5_cleanup_c(base_name, base_namelen, fapl)
|
|
|
|
USE H5GLOBAL
|
|
|
|
!DEC$ IF DEFINED(HDF5F90_WINDOWS)
|
|
|
|
!DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_CLEANUP_C':: h5_cleanup_c
|
|
|
|
!DEC$ ENDIF
|
|
|
|
!DEC$ATTRIBUTES reference :: base_name
|
|
|
|
CHARACTER(LEN=*), INTENT(IN) :: base_name
|
|
|
|
INTEGER(SIZE_T) :: base_namelen
|
|
|
|
INTEGER(HID_T), INTENT(IN) :: fapl
|
|
|
|
END FUNCTION h5_cleanup_c
|
|
|
|
END INTERFACE
|
|
|
|
|
|
|
|
base_namelen = LEN(base_name)
|
|
|
|
hdferr = h5_cleanup_c(base_name, base_namelen, fapl)
|
|
|
|
|
|
|
|
END SUBROUTINE h5_cleanup_f
|
2004-12-29 22:26:20 +08:00
|
|
|
|
|
|
|
!----------------------------------------------------------------------
|
2010-01-30 12:29:13 +08:00
|
|
|
! Name: h5_exit_f
|
2004-12-29 22:26:20 +08:00
|
|
|
!
|
|
|
|
! Purpose: Exit application
|
|
|
|
! It is a fortran counterpart for the standard C 'exit()' routine
|
2005-01-09 14:19:16 +08:00
|
|
|
! Be careful not to overflow the exit value range since
|
|
|
|
! UNIX supports a very small range such as 1 byte.
|
|
|
|
! Therefore, exit(256) may end up as exit(0).
|
2004-12-29 22:26:20 +08:00
|
|
|
!
|
2010-01-30 12:29:13 +08:00
|
|
|
! Inputs:
|
2004-12-29 22:26:20 +08:00
|
|
|
! status - Status to return from application
|
|
|
|
!
|
2010-01-30 12:29:13 +08:00
|
|
|
! Outputs:
|
2004-12-29 22:26:20 +08:00
|
|
|
! none
|
|
|
|
!
|
|
|
|
! Programmer: Quincey Koziol
|
|
|
|
! December 14, 2004
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!----------------------------------------------------------------------
|
2014-04-09 03:34:42 +08:00
|
|
|
SUBROUTINE h5_exit_f(status)
|
2004-12-29 22:26:20 +08:00
|
|
|
!
|
|
|
|
!This definition is needed for Windows DLLs
|
2015-02-21 01:25:56 +08:00
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
2004-12-29 22:26:20 +08:00
|
|
|
!DEC$attributes dllexport :: h5_exit_f
|
|
|
|
!DEC$endif
|
2014-04-09 03:34:42 +08:00
|
|
|
IMPLICIT NONE
|
|
|
|
INTEGER, INTENT(IN) :: status ! Return code
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2014-04-09 03:34:42 +08:00
|
|
|
INTERFACE
|
|
|
|
SUBROUTINE h5_exit_c(status)
|
|
|
|
!DEC$ IF DEFINED(HDF5F90_WINDOWS)
|
|
|
|
!DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_EXIT_C':: h5_exit_c
|
|
|
|
!DEC$ ENDIF
|
|
|
|
INTEGER, INTENT(IN) :: status
|
|
|
|
END SUBROUTINE h5_exit_c
|
|
|
|
END INTERFACE
|
|
|
|
|
|
|
|
CALL h5_exit_c(status)
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2014-04-09 03:34:42 +08:00
|
|
|
END SUBROUTINE h5_exit_f
|
2006-05-14 08:43:58 +08:00
|
|
|
|
2008-10-01 05:05:39 +08:00
|
|
|
!----------------------------------------------------------------------
|
2010-01-30 12:29:13 +08:00
|
|
|
! Name: h5_env_nocleanup_f
|
2008-10-01 05:05:39 +08:00
|
|
|
!
|
2010-01-30 12:29:13 +08:00
|
|
|
! Purpose: Uses the HDF5_NOCLEANUP environment variable in Fortran
|
2008-10-01 05:05:39 +08:00
|
|
|
! tests to determine if the output files should be removed
|
|
|
|
!
|
2010-01-30 12:29:13 +08:00
|
|
|
! Inputs:
|
2008-10-01 05:05:39 +08:00
|
|
|
!
|
|
|
|
! Outputs: HDF5_NOCLEANUP: .true. - don't remove test files
|
|
|
|
! .false. - remove test files
|
|
|
|
!
|
|
|
|
! Programmer: M.S. Breitenfeld
|
|
|
|
! September 30, 2008
|
|
|
|
!
|
|
|
|
!----------------------------------------------------------------------
|
2014-04-09 03:34:42 +08:00
|
|
|
SUBROUTINE h5_env_nocleanup_f(HDF5_NOCLEANUP)
|
2008-10-01 05:05:39 +08:00
|
|
|
!
|
|
|
|
!This definition is needed for Windows DLLs
|
2015-02-21 01:25:56 +08:00
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
2008-10-01 05:05:39 +08:00
|
|
|
!DEC$attributes dllexport :: h5_env_nocleanup_f
|
|
|
|
!DEC$endif
|
2014-04-09 03:34:42 +08:00
|
|
|
IMPLICIT NONE
|
|
|
|
LOGICAL, INTENT(OUT) :: HDF5_NOCLEANUP ! Return code
|
|
|
|
INTEGER :: status
|
|
|
|
|
|
|
|
INTERFACE
|
|
|
|
SUBROUTINE h5_env_nocleanup_c(status)
|
|
|
|
!DEC$ IF DEFINED(HDF5F90_WINDOWS)
|
|
|
|
!DEC$ ATTRIBUTES C,reference,decorate,alias:'H5_ENV_NOCLEANUP_C':: h5_env_nocleanup_c
|
|
|
|
!DEC$ ENDIF
|
|
|
|
INTEGER :: status
|
|
|
|
END SUBROUTINE h5_env_nocleanup_c
|
|
|
|
END INTERFACE
|
|
|
|
|
|
|
|
CALL h5_env_nocleanup_c(status)
|
|
|
|
|
|
|
|
HDF5_NOCLEANUP = .FALSE.
|
|
|
|
IF(status.EQ.1) HDF5_NOCLEANUP = .TRUE.
|
|
|
|
|
|
|
|
END SUBROUTINE h5_env_nocleanup_f
|
2015-04-21 03:15:30 +08:00
|
|
|
|
|
|
|
! ---------------------------------------------------------------------------------------------------
|
|
|
|
! H5_SIZEOF routines
|
|
|
|
!
|
|
|
|
! NOTES
|
|
|
|
! (1) The Sun/Oracle compiler has the following restrictions on the SIZEOF intrinsic function:
|
|
|
|
!
|
|
|
|
! "The SIZEOF intrinsic cannot be applied to arrays of an assumed size, characters of a
|
|
|
|
! length that is passed, or subroutine calls or names. SIZEOF returns default INTEGER*4 data.
|
|
|
|
! If compiling for a 64-bit environment, the compiler will issue a warning if the result overflows
|
|
|
|
! the INTEGER*4 data range. To use SIZEOF in a 64-bit environment with arrays larger
|
|
|
|
! than the INTEGER*4 limit (2 Gbytes), the SIZEOF function and
|
|
|
|
! the variables receiving the result must be declared INTEGER*8."
|
|
|
|
!
|
|
|
|
! Thus, we can not overload the H5_SIZEOF function to handle arrays (as used in tH5P_F03.f90), or
|
|
|
|
! characters that do not have a set length (as used in tH5P_F03.f90), sigh...
|
|
|
|
!
|
|
|
|
! (2) F08+TS29113 requires C interoperable variable as argument for C_SIZEOF.
|
|
|
|
!
|
|
|
|
! (3) Unfortunately we need to wrap the C_SIZEOF/STORAGE_SIZE functions to handle different
|
|
|
|
! data types from the various tests.
|
|
|
|
!
|
|
|
|
! ---------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
!This definition is needed for Windows DLLs
|
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_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
|
|
|
|
|
|
|
|
#ifdef H5_FORTRAN_FORTRAN_HAVE_C_SIZEOF
|
|
|
|
H5_SIZEOF_CMPD = C_SIZEOF(a)
|
|
|
|
#else
|
|
|
|
H5_SIZEOF_CMPD = SIZEOF(a)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
END FUNCTION H5_SIZEOF_CMPD
|
|
|
|
|
|
|
|
!This definition is needed for Windows DLLs
|
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
|
|
|
!DEC$attributes dllexport :: h5_sizeof_chr
|
|
|
|
!DEC$endif
|
|
|
|
INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_CHR(a)
|
|
|
|
IMPLICIT NONE
|
2015-04-23 03:31:58 +08:00
|
|
|
CHARACTER(LEN=1), INTENT(in) :: a
|
2015-04-21 03:15:30 +08:00
|
|
|
|
|
|
|
#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE
|
2015-04-23 03:31:58 +08:00
|
|
|
H5_SIZEOF_CHR = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t)
|
2015-04-21 03:15:30 +08:00
|
|
|
#else
|
2015-04-23 03:31:58 +08:00
|
|
|
H5_SIZEOF_CHR = SIZEOF(a)
|
2015-04-21 03:15:30 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
END FUNCTION H5_SIZEOF_CHR
|
|
|
|
|
|
|
|
!This definition is needed for Windows DLLs
|
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_DLL)
|
|
|
|
!DEC$attributes dllexport :: h5_sizeof_i
|
|
|
|
!DEC$endif
|
|
|
|
INTEGER(C_SIZE_T) FUNCTION H5_SIZEOF_I(a)
|
|
|
|
IMPLICIT NONE
|
|
|
|
INTEGER, INTENT(in):: a
|
|
|
|
|
|
|
|
#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE
|
|
|
|
H5_SIZEOF_I = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t)
|
|
|
|
#else
|
|
|
|
H5_SIZEOF_I = SIZEOF(a)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
END FUNCTION H5_SIZEOF_I
|
|
|
|
|
|
|
|
|
|
|
|
!This definition is needed for Windows DLLs
|
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_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
|
|
|
|
|
|
|
|
#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE
|
|
|
|
H5_SIZEOF_SP = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t)
|
|
|
|
#else
|
|
|
|
H5_SIZEOF_SP = SIZEOF(a)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
END FUNCTION H5_SIZEOF_SP
|
|
|
|
|
|
|
|
!This definition is needed for Windows DLLs
|
|
|
|
!DEC$if defined(BUILD_HDF5_TEST_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
|
|
|
|
|
|
|
|
#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE
|
|
|
|
H5_SIZEOF_DP = storage_size(a, c_size_t)/storage_size(c_char_'a',c_size_t)
|
|
|
|
#else
|
|
|
|
H5_SIZEOF_DP = SIZEOF(a)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
END FUNCTION H5_SIZEOF_DP
|
|
|
|
|
2014-04-06 23:56:21 +08:00
|
|
|
END MODULE TH5_MISC
|