summaryrefslogtreecommitdiff
path: root/fortran/src/H5fortkit.F90
diff options
context:
space:
mode:
authorTae-Young Chung <ty83.chung@samsung.com>2018-03-13 17:04:17 +0900
committerTae-Young Chung <ty83.chung@samsung.com>2018-03-13 17:06:54 +0900
commit45032639c6c5ee11b79d2d3faaca6e9be6e4be3b (patch)
tree1d636d696c1f1ea6d79fb469758c465f27a3d37c /fortran/src/H5fortkit.F90
parent125c0b85df1bf388ae210fc7a87872984f865769 (diff)
downloadhdf5-master.tar.gz
hdf5-master.tar.bz2
hdf5-master.zip
Import upstream hdf5-1.10.1HEADupstream/1.10.1upstreammaster
Upstream repository is https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.1/src/ Change-Id: I4ec4c291940b7bb75722ea16813fbe55736374a6 Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
Diffstat (limited to 'fortran/src/H5fortkit.F90')
-rw-r--r--fortran/src/H5fortkit.F9064
1 files changed, 64 insertions, 0 deletions
diff --git a/fortran/src/H5fortkit.F90 b/fortran/src/H5fortkit.F90
new file mode 100644
index 0000000..f5eba8a
--- /dev/null
+++ b/fortran/src/H5fortkit.F90
@@ -0,0 +1,64 @@
+!****h* ROBODoc/H5fortkit
+!
+! NAME
+! MODULE H5fortkit
+!
+! FILE
+! fortran/src/H5fortkit.F90
+!
+! PURPOSE
+! Routines to deal with C-FORTRAN issues.
+!
+! 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 COPYING file, which can be found at the root of the source code *
+! distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+! If you do not have access to either file, you may request a copy from *
+! help@hdfgroup.org. *
+! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+!
+!*****
+MODULE H5fortkit
+
+CONTAINS
+
+!****if* H5fortkit/HD5c2fstring
+! NAME
+! HD5c2fstring
+! INPUTS
+! cstring - C string stored as a string array of size 'len' of string size LEN=1
+! len - length of Fortran string
+! OUTPUT
+! fstring - Fortran string array of LEN=1
+! PURPOSE
+! Copies a Fortran array of strings having a length of one to a fortran string and removes the C Null
+! terminator. The Null terminator is returned from C when calling the C APIs directly.
+!
+! The fortran standard does not allow C_LOC to be used on a character string of
+! length greater than one, which is why we use the array of characters instead.
+!
+! SOURCE
+ SUBROUTINE HD5c2fstring(fstring,cstring,len)
+!*****
+ IMPLICIT NONE
+
+ INTEGER :: i
+ INTEGER :: len
+ CHARACTER(LEN=len) :: fstring
+ CHARACTER(LEN=1), DIMENSION(1:len) :: cstring
+
+ fstring = ''
+ DO i = 1, len
+ IF (cstring(i)(1:1)==CHAR(0)) EXIT
+ fstring(i:i) = cstring(i)(1:1)
+ END DO
+
+ END SUBROUTINE HD5c2fstring
+
+END MODULE H5fortkit