Skip to content

Commit

Permalink
remove unused module
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Aug 16, 2020
1 parent 4ba4a75 commit 6e78852
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 109 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ interface.f90
read.f90 ${CMAKE_CURRENT_BINARY_DIR}/reader.f90 ${CMAKE_CURRENT_BINARY_DIR}/reader_lt.f90
write.f90 ${CMAKE_CURRENT_BINARY_DIR}/writer.f90 ${CMAKE_CURRENT_BINARY_DIR}/writer_lt.f90
attributes.f90
string_utils.f90 ${CMAKE_CURRENT_BINARY_DIR}/pathlib.f90)
${CMAKE_CURRENT_BINARY_DIR}/pathlib.f90)
11 changes: 4 additions & 7 deletions src/interface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ module h5fortran
h5get_libversion_f, h5eset_auto_f, h5fflush_f
use h5lt, only : h5ltget_dataset_ndims_f, h5ltget_dataset_info_f

use string_utils, only : toLower, strip_trailing_null, truncate_string_null

implicit none (type, external)
private
public :: hdf5_file, hdf5_close, toLower, h5write, h5read, h5exist, is_hdf5, h5write_attr, h5read_attr, &
public :: hdf5_file, hdf5_close, h5write, h5read, h5exist, is_hdf5, h5write_attr, h5read_attr, &
check, hdf_shape_check, hdf_get_slice, hdf_wrapup, & !< for submodules only
HSIZE_T, HID_T, H5T_NATIVE_DOUBLE, H5T_NATIVE_REAL, H5T_NATIVE_INTEGER, & !< HDF5 types for end users
strip_trailing_null, truncate_string_null
HSIZE_T, HID_T, H5T_NATIVE_DOUBLE, H5T_NATIVE_REAL, H5T_NATIVE_INTEGER !< HDF5 types for end users

!> Workaround for Intel 19.1 / 2020 bug with /stand:f18
!> error #6410: This name has not been declared as an array or a function. [RANK]
Expand Down Expand Up @@ -535,10 +532,10 @@ subroutine hdf_initialize(self,filename,ierr, status,action,comp_lvl,verbose,deb
endif

lstatus = 'unknown'
if(present(status)) lstatus = toLower(status)
if(present(status)) lstatus = status

laction = 'rw'
if(present(action)) laction = toLower(action)
if(present(action)) laction = action

select case(lstatus)
case ('old', 'unknown')
Expand Down
64 changes: 0 additions & 64 deletions src/string_utils.f90

This file was deleted.

2 changes: 1 addition & 1 deletion src/tests/test_deflate.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ program test_deflate
!! unit tests and registration tests of HDF5 deflate compression write
use, intrinsic:: iso_fortran_env, only: int32, real32, real64, stderr=>error_unit
use, intrinsic:: iso_c_binding, only: c_null_char
use h5fortran, only: hdf5_file, toLower, strip_trailing_null, truncate_string_null
use h5fortran, only: hdf5_file
use hdf5, only: H5D_CHUNKED_F, H5D_CONTIGUOUS_F, hsize_t

implicit none (type, external)
Expand Down
41 changes: 5 additions & 36 deletions src/tests/test_string.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,12 @@ program test_string
use, intrinsic:: iso_fortran_env, only: stderr=>error_unit
use, intrinsic:: iso_c_binding, only: c_null_char

use h5fortran, only : toLower, hdf5_file, strip_trailing_null, truncate_string_null
use h5fortran, only : hdf5_file

implicit none (type, external)

call test_string_rw()
print *,'PASSED: HDF5 string write/read'

call test_lowercase()
print *,'PASSED: HDF5 character'
call test_strip_null()
print *,'PASSED: null strip'

contains

subroutine test_lowercase()

character(*), parameter :: hello = 'HeLl0 Th3rE !>? '
!! Fortran 2003 allocatable string

if (.not.(toLower(hello)=='hell0 th3re !>? ')) error stop 'error: lowercase conversion'

if (.not.(trim(toLower(hello))=='hell0 th3re !>?')) error stop 'Allocatable lowercase conversion error'

end subroutine test_lowercase


subroutine test_strip_null()
character(*), parameter :: hello = 'HeLl0 Th3rE !>? '

if (.not.strip_trailing_null(hello // c_null_char) == hello) error stop 'problem stripping trailing null'

end subroutine test_strip_null


subroutine test_string_rw()

type(hdf5_file) :: h

integer :: i
character(2) :: value
character(1024) :: val1k
character(:), allocatable :: final
Expand All @@ -65,7 +33,8 @@ subroutine test_string_rw()
print *,'test_string_rw: reading too much data'
!! try reading too much data, then truncating to first C_NULL
call h%read('/little', val1k)
final = truncate_string_null(val1k)
i = index(val1k, c_null_char)
final = val1k(:i-1)

if (len(final) /= 2) then
write(stderr, *) 'trimming str to c_null did not work, got len() = ', len(final)
Expand All @@ -75,6 +44,6 @@ subroutine test_string_rw()

call h%finalize()

end subroutine test_string_rw
print *,'PASSED: HDF5 string write/read'

end program

0 comments on commit 6e78852

Please sign in to comment.