diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2014-04-12 03:26:21 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2014-04-12 03:26:21 (GMT) |
commit | 19c485a128e4d860a537a14c91e38bc87dc6db25 (patch) | |
tree | 7333e607cf9093aa8020f5a2fa9af159379d845a /fortran/src | |
parent | 33956e594a10ecab24867ab0c3347452f22b4e11 (diff) | |
download | hdf5-19c485a128e4d860a537a14c91e38bc87dc6db25.zip hdf5-19c485a128e4d860a537a14c91e38bc87dc6db25.tar.gz hdf5-19c485a128e4d860a537a14c91e38bc87dc6db25.tar.bz2 |
[svn-r25027] Merged changes from the trunk to the branch,
svn merge -r24929:25009 https://svn.hdfgroup.uiuc.edu/hdf5/trunk/fortran
tested: jam (gnu)
Diffstat (limited to 'fortran/src')
-rw-r--r-- | fortran/src/H5Fff_F03.f90 | 11 | ||||
-rw-r--r-- | fortran/src/H5Pf.c | 70 | ||||
-rw-r--r-- | fortran/src/H5Pff_F03.f90 | 106 | ||||
-rw-r--r-- | fortran/src/H5f90proto.h | 4 | ||||
-rw-r--r-- | fortran/src/README_DEVELOPEMENT | 26 | ||||
-rw-r--r-- | fortran/src/hdf5_fortrandll.def.in | 2 |
6 files changed, 200 insertions, 19 deletions
diff --git a/fortran/src/H5Fff_F03.f90 b/fortran/src/H5Fff_F03.f90 index 83d46be..d819c34 100644 --- a/fortran/src/H5Fff_F03.f90 +++ b/fortran/src/H5Fff_F03.f90 @@ -30,13 +30,11 @@ ! !***** - MODULE H5F_PROVISIONAL USE H5GLOBAL USE, INTRINSIC :: ISO_C_BINDING - CONTAINS !****s* H5F (F03)/h5fget_file_image_f_F03 ! @@ -82,14 +80,13 @@ CONTAINS !DEC$IF DEFINED(HDF5F90_WINDOWS) !DEC$ATTRIBUTES C,reference,decorate,alias:'H5FGET_FILE_IMAGE_C'::h5fget_file_image_c !DEC$ENDIF - INTEGER(HID_T) , INTENT(IN) :: file_id - TYPE(C_PTR) , VALUE :: buf_ptr - INTEGER(SIZE_T) , INTENT(IN) :: buf_len - INTEGER(SIZE_T), INTENT(IN) :: buf_size + INTEGER(HID_T) , INTENT(IN) :: file_id + TYPE(C_PTR) , VALUE :: buf_ptr + INTEGER(SIZE_T), INTENT(IN) :: buf_len + INTEGER(SIZE_T), INTENT(IN) :: buf_size END FUNCTION h5fget_file_image_c END INTERFACE - IF(PRESENT(buf_size))THEN buf_ptr = C_NULL_PTR ENDIF diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 7a3f899..98e5ff6 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -5546,3 +5546,73 @@ nh5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nb ret_value = 0; return ret_value; } + +/*---------------------------------------------------------------------------- + * Name: h5pset_file_image_c + * Purpose: Calls H5Pset_file_image + * + * Inputs: + * fapl_id - File access property list identifier + * buf_ptr - Pointer to the initial file image, + * or NULL if no initial file image is desired + * buf_len - Size of the supplied buffer, or 0 (zero) if no initial image is desired + * + * Returns: 0 on success, -1 on failure + * Programmer: M. Scot Breitenfeld + * February 19, 2012 + *---------------------------------------------------------------------------*/ + +int_f +nh5pset_file_image_c(hid_t_f *fapl_id, void *buf_ptr, size_t_f *buf_len) +{ + int ret_value = -1; + /* + * Call H5Pset_file_image function. + */ + if( (H5Pset_file_image((hid_t)*fapl_id, buf_ptr, (size_t)*buf_len)) <0 ) + return ret_value; /* error occurred */ + + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5pget_file_image_c + * Purpose: Calls H5Pget_file_image + * + * Inputs: + * fapl_id - File access property list identifier + * Outputs: + * buf_ptr - Pointer to the initial file image, + * or NULL if no initial file image is desired + * buf_len - Size of the supplied buffer, or 0 (zero) if no initial image is desired + * + * Returns: 0 on success, -1 on failure + * Programmer: M. Scot Breitenfeld + * February 19, 2012 + *---------------------------------------------------------------------------*/ + +int_f +nh5pget_file_image_c(hid_t_f *fapl_id, void **buf_ptr, size_t_f *buf_len_ptr) +{ + int ret_value = -1; + size_t c_buf_len_ptr; + void *c_buf_ptr = NULL; + + c_buf_len_ptr = (size_t)*buf_len_ptr; + + /* + * Call H5Pget_file_image function. + */ + if( (H5Pget_file_image((hid_t)*fapl_id, (void **)&c_buf_ptr, &c_buf_len_ptr)) <0 ) + return ret_value; /* error occurred */ + + HDmemcpy((void *)*buf_ptr, (void *)c_buf_ptr, c_buf_len_ptr); + + *buf_len_ptr=(size_t_f)c_buf_len_ptr; + + ret_value = 0; + if(c_buf_ptr) HDfree(c_buf_ptr); + + return ret_value; +} diff --git a/fortran/src/H5Pff_F03.f90 b/fortran/src/H5Pff_F03.f90 index 7fb6ff9..806c308 100644 --- a/fortran/src/H5Pff_F03.f90 +++ b/fortran/src/H5Pff_F03.f90 @@ -1181,5 +1181,111 @@ CONTAINS END SUBROUTINE h5pcreate_class_f +! +!****s* H5P (F03)/h5pset_file_image_f_F03 +! +! NAME +! h5pset_file_image_f +! +! PURPOSE +! Sets an initial file image in a memory buffer. +! +! Inputs: +! fapl_id - File access property list identifier +! buf_ptr - Pointer to the initial file image, +! or C_NULL_PTR if no initial file image is desired +! buf_len - Size of the supplied buffer, or 0 (zero) if no initial image is desired +! +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails +! +! AUTHOR +! M. Scot Breitenfeld +! February 19, 2012 +! +! Fortran2003 Interface: + SUBROUTINE h5pset_file_image_f(fapl_id, buf_ptr, buf_len, hdferr) + USE iso_c_binding + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: fapl_id + TYPE(C_PTR) , INTENT(IN) :: buf_ptr + INTEGER(SIZE_T), INTENT(IN) :: buf_len + INTEGER , INTENT(OUT) :: hdferr +!***** + INTERFACE + INTEGER FUNCTION h5pset_file_image_c(fapl_id, buf_ptr, buf_len) + USE iso_c_binding + USE H5GLOBAL + !DEC$IF DEFINED(HDCLOSEF90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5PSET_FILE_IMAGE_C'::h5pset_file_image_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: fapl_id + TYPE(C_PTR), VALUE :: buf_ptr + INTEGER(SIZE_T), INTENT(IN) :: buf_len + END FUNCTION h5pset_file_image_c + END INTERFACE + + hdferr = h5pset_file_image_c(fapl_id, buf_ptr, buf_len) + + END SUBROUTINE h5pset_file_image_f +! +!****s* H5P (F03)/h5pget_file_image_f_F03 +! +! NAME +! h5pget_file_image_f +! +! PURPOSE +! Retrieves a copy of the file image designated as the initial content and structure of a file. +! +! Inputs: +! fapl_id - File access property list identifier. +! +! Outputs: +! buf_ptr - Will hold either a C_NULL_PTR or a scalar of type +! c_loc. If buf_ptr is not C_NULL_PTR, on successful +! return, buf_ptr shall contain a C pointer to a copy +! of the initial image provided in the last call to +! H5Pset_file_image_f for the supplied fapl_id, or +! buf_ptr shall contain a C_NULL_PTR if there is no +! initial image set. +! +! buf_len_ptr - Contains the value of the buffer parameter for +! the initial image in the supplied fapl_id. The value +! will be 0 if no initial image is set. +! +! +! hdferr - Returns 0 if successful and -1 if fails +! +! AUTHOR +! M. Scot Breitenfeld +! February 19, 2012 +! +! Fortran2003 Interface: + SUBROUTINE h5pget_file_image_f(fapl_id, buf_ptr, buf_len_ptr, hdferr) + USE iso_c_binding + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: fapl_id + TYPE(C_PTR) , INTENT(OUT), DIMENSION(*) :: buf_ptr + INTEGER(SIZE_T), INTENT(OUT) :: buf_len_ptr + INTEGER , INTENT(OUT) :: hdferr + +!***** + INTERFACE + INTEGER FUNCTION h5pget_file_image_c(fapl_id, buf_ptr, buf_len_ptr) + USE iso_c_binding + USE H5GLOBAL + !DEC$IF DEFINED(HDCLOSEF90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5PGET_FILE_IMAGE_C'::h5pget_file_image_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: fapl_id + TYPE(C_PTR), DIMENSION(*), INTENT(OUT) :: buf_ptr + INTEGER(SIZE_T), INTENT(OUT) :: buf_len_ptr + END FUNCTION h5pget_file_image_c + END INTERFACE + + hdferr = h5pget_file_image_c(fapl_id, buf_ptr, buf_len_ptr) + + END SUBROUTINE h5pget_file_image_f + END MODULE H5P_PROVISIONAL diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index ae848bf..a0a4f64 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -863,11 +863,13 @@ H5_FCDLL int_f nh5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f * #define nh5pget_preserve_c H5_FC_FUNC_(h5pget_preserve_c, H5PGET_PRESERVE_C) #define nh5pset_chunk_c H5_FC_FUNC_(h5pset_chunk_c, H5PSET_CHUNK_C) #define nh5pget_chunk_c H5_FC_FUNC_(h5pget_chunk_c, H5PGET_CHUNK_C) +#define nh5pset_file_image_c H5_FC_FUNC_(h5pset_file_image_c,H5PSET_FILE_IMAGE_C) #define nh5pset_fill_valuec_c H5_FC_FUNC_(h5pset_fill_valuec_c, H5PSET_FILL_VALUEC_C) #define nh5pset_fill_value_c H5_FC_FUNC_(h5pset_fill_value_c, H5PSET_FILL_VALUE_C) #define nh5pset_fill_value_integer_c H5_FC_FUNC_(h5pset_fill_value_integer_c, H5PSET_FILL_VALUE_INTEGER_C) #define nh5pset_fill_value_real_c H5_FC_FUNC_(h5pset_fill_value_real_c, H5PSET_FILL_VALUE_REAL_C) #define nh5pset_fill_value_double_c H5_FC_FUNC_(h5pset_fill_value_double_c, H5PSET_FILL_VALUE_DOUBLE_C) +#define nh5pget_file_image_c H5_FC_FUNC_(h5pget_file_image_c,H5PGET_FILE_IMAGE_C) #define nh5pget_fill_valuec_c H5_FC_FUNC_(h5pget_fill_valuec_c, H5PGET_FILL_VALUEC_C) #define nh5pget_fill_value_c H5_FC_FUNC_(h5pget_fill_value_c, H5PGET_FILL_VALUE_C) #define nh5pget_fill_value_integer_c H5_FC_FUNC_(h5pget_fill_value_integer_c, H5PGET_FILL_VALUE_INTEGER_C) @@ -1017,11 +1019,13 @@ H5_FCDLL int_f nh5pget_class_c ( hid_t_f *prp_id , int_f *classtype); H5_FCDLL int_f nh5pset_deflate_c ( hid_t_f *prp_id , int_f *level); H5_FCDLL int_f nh5pset_chunk_c ( hid_t_f *prp_id, int_f *rank, hsize_t_f *dims ); H5_FCDLL int_f nh5pget_chunk_c ( hid_t_f *prp_id, int_f *max_rank, hsize_t_f *dims ); +H5_FCDLL int_f nh5pset_file_image_c (hid_t_f *fapl_id, void *buf_ptr, size_t_f *buf_len); H5_FCDLL int_f nh5pset_fill_valuec_c (hid_t_f *prp_id, hid_t_f *type_id, _fcd fillvalue); H5_FCDLL int_f nh5pset_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue); H5_FCDLL int_f nh5pset_fill_value_integer_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue); H5_FCDLL int_f nh5pset_fill_value_real_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue); H5_FCDLL int_f nh5pset_fill_value_double_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue); +H5_FCDLL int_f nh5pget_file_image_c (hid_t_f *fapl_id, void **buf_ptr, size_t_f *buf_len); H5_FCDLL int_f nh5pget_fill_valuec_c (hid_t_f *prp_id, hid_t_f *type_id, _fcd fillvalue); H5_FCDLL int_f nh5pget_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue); H5_FCDLL int_f nh5pget_fill_value_integer_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue); diff --git a/fortran/src/README_DEVELOPEMENT b/fortran/src/README_DEVELOPEMENT index dc65f47..43982e1 100644 --- a/fortran/src/README_DEVELOPEMENT +++ b/fortran/src/README_DEVELOPEMENT @@ -1,13 +1,15 @@ -Procedure to add a new function: +Procedure to add a new function +--------------------------------- (1) Edit the fortran/src/H5*ff.f90 file -(2) Edit the fortran/sr/H5*f.c file +(2) Edit the fortran/src/H5*f.c file (3) Edit the fortran/src/H5f90proto.h file +(4) Add the new function to fortran/src/hdf5_fortrandll.def.in +Procedure for passing C variables to Fortran +--------------------------------------------- - -Procedure: -(1) Find the struct name you are interested in: +(1) Find the C struct name you are interested in: (a) src/H5public.h if it is a generic type, i.e. H5_* or (b) src/H5*public.h if is a specific type, i.e. H5*_ @@ -17,7 +19,7 @@ Procedure: (b) edit fortran/src/H5f90proto.h and edit nh5init_flags_c interface call (3) Edit the function call in fortran/src/H5_ff.f90 - (a) edit the call FUNCTION h5init_flags_c + (a) edit the call: FUNCTION h5init_flags_c (b) edit h5init_flags_c call in h5open_f to match the number of arguments passing (4) add the size of the array and array to fortran/src/H5f90global.f90 @@ -25,12 +27,12 @@ Procedure: NOTE: To just add a default C value argument, do steps (2a) and (4) -Adding a new file to the repository -------------------------------------- -Add the name of the file to: - (1) Makefile.am located in the same directory as the newfile - (2) MANIFEST located in the top level directory +Procedure for adding a new file to the repository +-------------------------------------------------- +Add the name of the file to the: + (1) Makefile.am located in the same directory as the newfile + (2) CMakeLists.txt located in the same directory as the newfile + (3) MANIFEST located in the top level directory -If you add a new file, be sure to add it to the MANIFEST located in the top directory diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index c549d34..41e93e4 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -454,6 +454,8 @@ H5P_mp_H5PGET_CHUNK_CACHE_F @H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PGET_PTR
@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PREGISTER_PTR
@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PINSERT_PTR
+@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PGET_FILE_IMAGE_F
+@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PSET_FILE_IMAGE_F
; H5R
H5R_PROVISIONAL_mp_H5RCREATE_OBJECT_F
H5R_PROVISIONAL_mp_H5RCREATE_REGION_F
|