From 72aad5ebdf4665a5e278520d714fc10613660872 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 5 Apr 2021 16:18:08 -0700 Subject: Normalized Fortran with develop --- examples/h5_attribute.c | 5 +- examples/h5_cmprss.c | 2 +- examples/h5_dtransform.c | 40 ++++++--------- examples/h5_extlink.c | 5 ++ examples/h5_group.c | 10 ++-- examples/h5_ref_compat.c | 4 +- examples/h5_ref_extern.c | 4 +- examples/h5_vds.c | 11 ++-- examples/testh5cc.sh.in | 6 +++ fortran/src/H5Pf.c | 87 ++++++++++++++++--------------- fortran/src/H5Pff.F90 | 102 +++++++++++++++++++++++++++++++++++++ fortran/src/H5f90.h | 6 +-- fortran/src/H5f90i.h | 6 +-- fortran/src/H5f90proto.h | 6 +-- fortran/src/H5match_types.c | 4 +- fortran/src/Makefile.am | 2 +- fortran/src/hdf5_fortrandll.def.in | 2 + fortran/test/fortranlib_test.F90 | 6 ++- fortran/test/tH5P.F90 | 73 ++++++++++++++++++++++++++ 19 files changed, 288 insertions(+), 93 deletions(-) diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c index 5d90d91..97be7f5 100644 --- a/examples/h5_attribute.c +++ b/examples/h5_attribute.c @@ -184,6 +184,8 @@ main(void) printf("The value of the attribute \"Integer attribute\" is %d \n", point_out); ret = H5Aclose(attr); + //! [H5Oget_info3_snip] + /* * Find string attribute by iterating through all attributes */ @@ -203,6 +205,7 @@ main(void) ret = H5Tclose(atype); } + //! [H5Oget_info3_snip] /* * Get attribute info using iteration function. */ @@ -232,7 +235,7 @@ attr_info(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *opdata) float * float_array; /* Pointer to the array attribute. */ /* avoid warnings */ - opdata = opdata; + (void)opdata; /* * Open the attribute using its name. diff --git a/examples/h5_cmprss.c b/examples/h5_cmprss.c index 59a59f5..d8848e2 100644 --- a/examples/h5_cmprss.c +++ b/examples/h5_cmprss.c @@ -99,7 +99,7 @@ main() for (i = 0; i < numfilt; i++) { nelmts = 0; - filter_type = H5Pget_filter2(plist_id, 0, &flags, &nelmts, NULL, 0, NULL, &filter_info); + filter_type = H5Pget_filter2(plist_id, i, &flags, &nelmts, NULL, 0, NULL, &filter_info); printf("Filter Type: "); switch (filter_type) { case H5Z_FILTER_DEFLATE: diff --git a/examples/h5_dtransform.c b/examples/h5_dtransform.c index 289c102..a364ec1 100644 --- a/examples/h5_dtransform.c +++ b/examples/h5_dtransform.c @@ -36,30 +36,22 @@ #define ROWS 12 #define COLS 18 -const float windchillF[ROWS][COLS] = {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, - -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, - {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, - -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, - {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, - -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, - {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, - -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, - {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, - -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, - {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, - -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, - {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, - -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, - {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, - -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, - {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, - -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, - {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, - -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, - {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, - -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, - {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, - -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0}}; +/* clang-format off */ +const float windchillF[ROWS][COLS] = + { {36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, + {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, + {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, + {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, + {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, + {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, + {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, + {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, + {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, + {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, + {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, + {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0} + }; +/* clang-format on */ #define PRINT(array) \ { \ diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index 44ff2da..f9d4046 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -414,10 +414,15 @@ UD_hard_create(const char *link_name, hid_t loc_group, const void *udata, size_t token = *((H5O_token_t *)udata); + //! [H5Open_by_token_snip] + /* Open the object this link points to so that we can increment * its reference count. This also ensures that the token passed * in points to a real object (although this check is not perfect!) */ target_obj = H5Oopen_by_token(loc_group, token); + + //! [H5Open_by_token_snip] + if (target_obj < 0) { ret_value = -1; goto done; diff --git a/examples/h5_group.c b/examples/h5_group.c index 4b489f0..40acafe 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -171,9 +171,9 @@ static herr_t file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata) { /* avoid compiler warnings */ - loc_id = loc_id; - opdata = opdata; - linfo = linfo; + (void)loc_id; + (void)opdata; + (void)linfo; /* * Display group name. The name is passed to the function by @@ -198,8 +198,8 @@ group_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdat int rank_chunk; /* avoid warnings */ - opdata = opdata; - linfo = linfo; + (void)opdata; + (void)linfo; /* * Open the datasets using their names. diff --git a/examples/h5_ref_compat.c b/examples/h5_ref_compat.c index 82ef525..cce755b 100644 --- a/examples/h5_ref_compat.c +++ b/examples/h5_ref_compat.c @@ -76,9 +76,9 @@ main(void) /* Access reference and read dataset data through new API */ assert(H5Rget_type((const H5R_ref_t *)&new_ref_buf[0]) == H5R_OBJECT2); - H5Rget_obj_type3((const H5R_ref_t *)&new_ref_buf[0], H5P_DEFAULT, &obj_type); + H5Rget_obj_type3(&new_ref_buf[0], H5P_DEFAULT, &obj_type); assert(obj_type == H5O_TYPE_DATASET); - dset1 = H5Ropen_object((const H5R_ref_t *)&new_ref_buf[0], H5P_DEFAULT, H5P_DEFAULT); + dset1 = H5Ropen_object(&new_ref_buf[0], H5P_DEFAULT, H5P_DEFAULT); H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_buf); H5Dclose(dset1); H5Rdestroy(&new_ref_buf[0]); diff --git a/examples/h5_ref_extern.c b/examples/h5_ref_extern.c index a46f676..691d235 100644 --- a/examples/h5_ref_extern.c +++ b/examples/h5_ref_extern.c @@ -78,9 +78,9 @@ main(void) /* Access reference and read dataset data without opening original file */ assert(H5Rget_type((const H5R_ref_t *)&ref_buf[0]) == H5R_OBJECT2); - H5Rget_obj_type3((const H5R_ref_t *)&ref_buf[0], H5P_DEFAULT, &obj_type); + H5Rget_obj_type3(&ref_buf[0], H5P_DEFAULT, &obj_type); assert(obj_type == H5O_TYPE_DATASET); - dset1 = H5Ropen_object((const H5R_ref_t *)&ref_buf[0], H5P_DEFAULT, H5P_DEFAULT); + dset1 = H5Ropen_object(&ref_buf[0], H5P_DEFAULT, H5P_DEFAULT); H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_buf); H5Dclose(dset1); H5Rdestroy(&ref_buf[0]); diff --git a/examples/h5_vds.c b/examples/h5_vds.c index 6bef06f..e036204 100644 --- a/examples/h5_vds.c +++ b/examples/h5_vds.c @@ -60,7 +60,7 @@ main(void) hsize_t start_out[2], stride_out[2], count_out[2], block_out[2]; int wdata[DIM0], /* Write buffer for source dataset */ rdata[VDSDIM0][VDSDIM1], /* Read buffer for virtual dataset */ - i, j, k, l; + i, j, k, l, block_inc; int fill_value = -1; /* Fill value for VDS */ H5D_layout_t layout; /* Storage layout */ size_t num_map; /* Number of mappings */ @@ -178,13 +178,14 @@ main(void) buf = (hsize_t *)malloc(sizeof(hsize_t) * 2 * RANK2 * nblocks); status = H5Sget_select_hyper_blocklist(vspace, (hsize_t)0, nblocks, buf); for (l = 0; l < nblocks; l++) { + block_inc = 2 * RANK2 * l; printf("("); for (k = 0; k < RANK2 - 1; k++) - printf("%d,", (int)buf[k]); - printf("%d ) - (", (int)buf[k]); + printf("%d,", (int)buf[block_inc + k]); + printf("%d) - (", (int)buf[block_inc + k]); for (k = 0; k < RANK2 - 1; k++) - printf("%d,", (int)buf[RANK2 + k]); - printf("%d)\n", (int)buf[RANK2 + k]); + printf("%d,", (int)buf[block_inc + RANK2 + k]); + printf("%d)\n", (int)buf[block_inc + RANK2 + k]); } /* We also can use new APIs to get start, stride, count and block */ if (H5Sis_regular_hyperslab(vspace)) { diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in index 0c122c7..ba80f2d 100644 --- a/examples/testh5cc.sh.in +++ b/examples/testh5cc.sh.in @@ -91,6 +91,8 @@ temp_FILES="a.out $applib" cat > $appmain < $prog1 < +void sub1(void) { printf("in sub1\n"); @@ -123,6 +127,8 @@ EOF # generate prog2 cat > $prog2 < +void sub2(void) { printf("in sub2\n"); diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 864a8d2..1f74955 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -2110,10 +2110,10 @@ h5pget_btree_ratios_c(hid_t_f *prp_id, real_f *left, real_f *middle, real_f *rig * OUTPUTS * * degree - possible values are: - * H5F_CLOSE_DEFAULT - * H5F_CLOSE_WEAK - * H5F_CLOSE_SEMI - * H5F_CLOSE_STRONG + * H5F_CLOSE_DEFAULT + * H5F_CLOSE_WEAK + * H5F_CLOSE_SEMI + * H5F_CLOSE_STRONG * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -2149,10 +2149,10 @@ h5pget_fclose_degree_c(hid_t_f *fapl_id, int_f *degree) * INPUTS * fapl_id - file access identifier * degree - possible values are: - * H5F_CLOSE_DEFAULT - * H5F_CLOSE_WEAK - * H5F_CLOSE_SEMI - * H5F_CLOSE_STRONG + * H5F_CLOSE_DEFAULT + * H5F_CLOSE_WEAK + * H5F_CLOSE_SEMI + * H5F_CLOSE_STRONG * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -3525,8 +3525,10 @@ h5pset_family_offset_c(hid_t_f *prp_id, hsize_t_f *offset) */ int_f -/*h5pset_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _fcd memb_name, int_f *len, - int_f *lenmax, haddr_t_f *memb_addr, int_f *flag) */ +/* + * h5pset_fapl_multi_c(hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _fcd memb_name, + * int_f *len, int_f *lenmax, haddr_t_f *memb_addr, int_f *flag) + */ h5pset_fapl_multi_c(hid_t_f *prp_id, int_f *memb_map, hid_t_f *memb_fapl, _fcd memb_name, int_f *len, int_f *lenmax, real_f *memb_addr, int_f *flag) /******/ @@ -3976,9 +3978,10 @@ DONE: * Calls H5Pget_attr_phase_change * * INPUTS - * ocpl_id - Object (dataset or group) creation property list identifier - * Outputs max_compact - Maximum number of attributes to be stored in compact storage - * min_dense - Minimum number of attributes to be stored in dense storage + * ocpl_id - Object (dataset or group) creation property list identifier + * OUTPUTS + * max_compact - Maximum number of attributes to be stored in compact storage + * min_dense - Minimum number of attributes to be stored in dense storage * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -4018,8 +4021,9 @@ h5pget_attr_phase_change_c(hid_t_f *ocpl_id, int_f *max_compact, int_f *min_dens * Calls H5Ppset_attr_creation_order * * INPUTS - * ocpl_id - Object (dataset or group) creation property list identifier - * Outputs crt_order_flags - Flags specifying whether to track and index attribute creation order + * ocpl_id - Object (dataset or group) creation property list identifier + * OUTPUTS + * crt_order_flags - Flags specifying whether to track and index attribute creation order * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -4185,7 +4189,7 @@ h5pget_attr_creation_order_c(hid_t_f *ocpl_id, int_f *crt_order_flags) * Calls H5Pset_link_creation_order * * INPUTS - * gcpl_id - Group creation property list identifier + * gcpl_id - Group creation property list identifier * crt_order_flags - Creation order flag(s) * OUTPUTS * @@ -4222,9 +4226,10 @@ h5pset_link_creation_order_c(hid_t_f *gcpl_id, int_f *crt_order_flags) * Calls H5Pget_link_phase_change * * INPUTS - * gcpl_id - Group creation property list identifier - * Outputs max_compact - Maximum number of attributes to be stored in compact storage - * min_dense - Minimum number of attributes to be stored in dense storage + * gcpl_id - Group creation property list identifier + * OUTPUTS + * max_compact - Maximum number of attributes to be stored in compact storage + * min_dense - Minimum number of attributes to be stored in dense storage * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -4348,10 +4353,10 @@ h5pset_obj_track_times_c(hid_t_f *plist_id, int_f *flag) * * INPUTS * - * lcpl_id - Link creation property list identifier + * lcpl_id - Link creation property list identifier * crt_intermed_group - crt_intermed_group specifying whether - * to create intermediate groups upon the - * creation of an object + * to create intermediate groups upon the + * creation of an object * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -4434,8 +4439,8 @@ h5pget_link_creation_order_c(hid_t_f *gcpl_id, int_f *crt_order_flags) * * plist_id - Property list identifier * encoding - String encoding character set: - * H5T_CSET_ASCII_F -> US ASCII - * H5T_CSET_UTF8_F -> UTF-8 Unicode encoding + * H5T_CSET_ASCII_F -> US ASCII + * H5T_CSET_UTF8_F -> UTF-8 Unicode encoding * OUTPUTS * NONE * @@ -4478,8 +4483,8 @@ h5pset_char_encoding_c(hid_t_f *plist_id, int_f *encoding) * OUTPUTS * * encoding - Encoding character set: - * H5T_CSET_ASCII_F -> US ASCII - * H5T_CSET_UTF8_F -> UTF-8 Unicode encoding + * H5T_CSET_ASCII_F -> US ASCII + * H5T_CSET_UTF8_F -> UTF-8 Unicode encoding * * RETURNS * 0 on success, -1 on failure @@ -4610,7 +4615,7 @@ h5pget_copy_object_c(hid_t_f *ocp_plist_id, int_f *copy_options) * RETURNS * * Success: 0 - * Failure: -1 + * Failure: -1 * * AUTHOR * M. Scot Breitenfeld @@ -4672,7 +4677,7 @@ done: * RETURNS * * Success: 0 - * Failure: -1 + * Failure: -1 * * AUTHOR * M. Scot Breitenfeld @@ -4721,7 +4726,7 @@ done: * RETURNS * * Success: 0 - * Failure: -1 + * Failure: -1 * * AUTHOR * M. Scot Breitenfeld @@ -4764,7 +4769,7 @@ h5pget_local_heap_size_hint_c(hid_t_f *gcpl_id, size_t_f *size_hint) * RETURNS * * Success: 0 - * Failure: -1 + * Failure: -1 * * AUTHOR * M. Scot Breitenfeld @@ -4810,7 +4815,7 @@ h5pget_est_link_info_c(hid_t_f *gcpl_id, int_f *est_num_entries, int_f *est_name * RETURNS * * Success: 0 - * Failure: -1 + * Failure: -1 * * AUTHOR * M. Scot Breitenfeld @@ -4851,7 +4856,7 @@ h5pset_local_heap_size_hint_c(hid_t_f *gcpl_id, size_t_f *size_hint) * RETURNS * * Success: 0 - * Failure: -1 + * Failure: -1 * * AUTHOR * M. Scot Breitenfeld @@ -4923,7 +4928,7 @@ h5pset_link_phase_change_c(hid_t_f *gcpl_id, int_f *max_compact, int_f *min_dens * * INPUTS * - * fapl_id - File access property list identifier + * fapl_id - File access property list identifier * alignment - Required memory alignment boundary * block_size - File system block size * cbuf_size - Copy buffer size @@ -4971,7 +4976,7 @@ h5pset_fapl_direct_c(hid_t_f H5_ATTR_UNUSED *fapl_id, size_t_f H5_ATTR_UNUSED *a * * INPUTS * - * fapl_id - File access property list identifier + * fapl_id - File access property list identifier * OUTPUTS * * alignment - Required memory alignment boundary @@ -5025,9 +5030,9 @@ h5pget_fapl_direct_c(hid_t_f H5_ATTR_UNUSED *fapl_id, size_t_f H5_ATTR_UNUSED *a * Calls H5Pset_attr_phase_change * * INPUTS - * ocpl_id - Object (dataset or group) creation property list identifier - * max_compact - Maximum number of attributes to be stored in compact storage - * min_dense - Minimum number of attributes to be stored in dense storage + * ocpl_id - Object (dataset or group) creation property list identifier + * max_compact - Maximum number of attributes to be stored in compact storage + * min_dense - Minimum number of attributes to be stored in dense storage * OUTPUTS * * RETURNS @@ -5212,7 +5217,7 @@ h5pget_nlinks_c(hid_t_f *lapl_id, size_t_f *nlinks) * * INPUTS * - * lcpl_id - Link creation property list identifier + * lcpl_id - Link creation property list identifier * crt_intermed_group - Specifying whether to create intermediate groups upon * the creation of an object * RETURNS @@ -5249,7 +5254,8 @@ h5pget_create_inter_group_c(hid_t_f *lcpl_id, int_f *crt_intermed_group) * Name: h5pset_chunk_cache_c * Purpose: Calls H5Pset_chunk_cache * - * Inputs: dapl_id - Link creation property list identifier + * Inputs: + * dapl_id - Link creation property list identifier * rdcc_nslots - * rdcc_nbytes - * rdcc_w0 - @@ -5280,7 +5286,8 @@ h5pset_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, size_t_f *rdcc_nby * Name: h5pget_chunk_cache_c * Purpose: Calls H5Pget_chunk_cache * - * Inputs: dapl_id - Link creation property list identifier + * Inputs: + * dapl_id - Link creation property list identifier * Outputs: * rdcc_nslots - * rdcc_nbytes - diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 7237558..a7f2366 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -8263,5 +8263,107 @@ END SUBROUTINE h5pget_virtual_dsetname_f END SUBROUTINE h5pget_vol_id_f +!****s* H5P (F03)/h5pget_file_locking_f_F03 +! +! NAME +! h5pget_file_locking_f +! +! PURPOSE +! Gets the file locking properties. File locking is mainly used to help +! enforce SWMR semantics. +! +! INPUTS +! fapl_id - Target file access property list identifier. +! +! OUTPUTS +! use_file_locking - Whether or not to use file locks. +! ignore_disabled_locks - Whether or not to ignore file locks when locking +! is disabled on a file system. +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! Dana Robinson +! Summer 2020 +! +! Fortran2003 Interface: + SUBROUTINE h5pget_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: fapl_id + LOGICAL , INTENT(OUT) :: use_file_locking + LOGICAL , INTENT(OUT) :: ignore_disabled_locks + INTEGER , INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_use_flag + LOGICAL(C_BOOL) :: c_ignore_flag + + INTERFACE + INTEGER FUNCTION h5pget_file_locking(fapl_id, use_file_locking, ignore_disabled_locks) BIND(C, NAME='H5Pget_file_locking') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: fapl_id + LOGICAL(C_BOOL), INTENT(OUT) :: use_file_locking + LOGICAL(C_BOOL), INTENT(OUT) :: ignore_disabled_locks + END FUNCTION h5pget_file_locking + END INTERFACE + + hdferr = INT(h5pget_file_locking(fapl_id, c_use_flag, c_ignore_flag)) + + ! Transfer value of C C_BOOL type to Fortran LOGICAL + use_file_locking = c_use_flag + ignore_disabled_locks = c_ignore_flag + + END SUBROUTINE h5pget_file_locking_f + +!****s* H5P (F03)/h5pset_file_locking_f_F03 +! +! NAME +! h5pset_file_locking_f +! +! PURPOSE +! Sets the file locking properties. File locking is mainly used to help +! enforce SWMR semantics. +! +! INPUTS +! fapl_id - Target file access property list identifier. +! use_file_locking - Whether or not to use file locks. +! ignore_disabled_locks - Whether or not to ignore file locks when locking +! is disabled on a file system. +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! Dana Robinson +! Summer 2020 +! +! Fortran2003 Interface: + SUBROUTINE h5pset_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: fapl_id + LOGICAL , INTENT(IN) :: use_file_locking + LOGICAL , INTENT(IN) :: ignore_disabled_locks + INTEGER , INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_use_flag + LOGICAL(C_BOOL) :: c_ignore_flag + + INTERFACE + INTEGER FUNCTION h5pset_file_locking(fapl_id, use_file_locking, ignore_disabled_locks) BIND(C, NAME='H5Pset_file_locking') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: fapl_id + LOGICAL(C_BOOL), INTENT(IN), VALUE :: use_file_locking + LOGICAL(C_BOOL), INTENT(IN), VALUE :: ignore_disabled_locks + END FUNCTION h5pset_file_locking + END INTERFACE + + ! Transfer value of Fortran LOGICAL to C C_BOOL type + c_use_flag = use_file_locking + c_ignore_flag = ignore_disabled_locks + + hdferr = INT(h5pset_file_locking(fapl_id, c_use_flag, c_ignore_flag)) + + END SUBROUTINE h5pset_file_locking_f + END MODULE H5P diff --git a/fortran/src/H5f90.h b/fortran/src/H5f90.h index e8655e4..3cc617f 100644 --- a/fortran/src/H5f90.h +++ b/fortran/src/H5f90.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5f90_H -#define _H5f90_H +#ifndef H5f90_H +#define H5f90_H #include "hdf5.h" #include "H5private.h" @@ -27,4 +27,4 @@ #define H5_MAX(a, b) (((a) > (b)) ? (a) : (b)) -#endif /* _H5f90_H */ +#endif /* H5f90_H */ diff --git a/fortran/src/H5f90i.h b/fortran/src/H5f90i.h index 37e563b..dbb6a16 100644 --- a/fortran/src/H5f90i.h +++ b/fortran/src/H5f90i.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5f90i_H -#define _H5f90i_H +#ifndef H5f90i_H +#define H5f90i_H /* * Include generated header. This header defines integer types, @@ -36,4 +36,4 @@ typedef char *_fcd; #endif -#endif /* _H5f90i_H */ +#endif /* H5f90i_H */ diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index bed9ba9..fbbf7c2 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _H5f90proto_H -#define _H5f90proto_H +#ifndef H5f90proto_H +#define H5f90proto_H #include "H5public.h" #include "H5f90.h" @@ -643,4 +643,4 @@ H5_FCDLL int_f h5literate_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namele int_f *order, hsize_t_f *idx, H5L_iterate2_t op, void *op_data, hid_t_f *lapl_id); -#endif /* _H5f90proto_H */ +#endif /* H5f90proto_H */ diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 10d873e..017bab4 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -70,8 +70,8 @@ initCfile(void) * help@hdfgroup.org. *\n\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\ \n\n\ -#ifndef _H5f90i_gen_H\n\ -#define _H5f90i_gen_H\n\ +#ifndef H5f90i_gen_H\n\ +#define H5f90i_gen_H\n\ \n\ /* This file is automatically generated by H5match_types.c at build time. */\n\ \n\ diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 5168eb6..65ffa0c 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -155,7 +155,7 @@ H5Pff.lo: $(srcdir)/H5Pff.F90 H5f90global.lo H5fortkit.lo H5Rff.lo: $(srcdir)/H5Rff.F90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.F90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.F90 H5f90global.lo -H5VLff.lo: $(srcdir)/H5VLff.F90 H5f90global.lo +H5VLff.lo: $(srcdir)/H5VLff.F90 H5f90global.lo H5fortkit.lo H5Zff.lo: $(srcdir)/H5Zff.F90 H5f90global.lo H5_gen.lo: H5_gen.F90 H5f90global.lo H5Aff.lo H5Dff.lo H5Pff.lo HDF5.lo: $(srcdir)/HDF5.F90 H5f90global.lo H5_ff.lo H5Aff.lo \ diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 9c69e5a..4207239 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -339,6 +339,8 @@ H5P_mp_H5PGET_DSET_NO_ATTRS_HINT_F H5P_mp_H5PSET_DSET_NO_ATTRS_HINT_F H5P_mp_H5PSET_VOL_F H5P_mp_H5PGET_VOL_ID_F +H5P_mp_H5PSET_FILE_LOCKING_F +H5P_mp_H5PGET_FILE_LOCKING_F ; Parallel @H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F diff --git a/fortran/test/fortranlib_test.F90 b/fortran/test/fortranlib_test.F90 index 90f0e01..eff4657 100644 --- a/fortran/test/fortranlib_test.F90 +++ b/fortran/test/fortranlib_test.F90 @@ -183,9 +183,13 @@ PROGRAM fortranlibtest CALL write_test_status(ret_total_error, ' Multi file driver test', total_error) ret_total_error = 0 - CALL test_chunk_cache (cleanup, ret_total_error) + CALL test_chunk_cache(cleanup, ret_total_error) CALL write_test_status(ret_total_error, ' Dataset chunk cache configuration', total_error) + ret_total_error = 0 + CALL test_misc_properties(cleanup, ret_total_error) + CALL write_test_status(ret_total_error, ' Miscellaneous properties', total_error) + ! ! '=========================================' ! 'Testing ATTRIBUTE interface ' diff --git a/fortran/test/tH5P.F90 b/fortran/test/tH5P.F90 index f45d18a..1d1208c 100644 --- a/fortran/test/tH5P.F90 +++ b/fortran/test/tH5P.F90 @@ -724,4 +724,77 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) END SUBROUTINE test_chunk_cache +!------------------------------------------------------------------------- +! Function: test_misc_properties +! +! Purpose: Tests setting and getting of miscellaneous properties. Does +! not test the underlying functionality as that is done in +! the C library tests. +! +! Tests APIs: +! H5P_GET/SET_FILE_LOCKING_F +! +! Return: Success: 0 +! Failure: -1 +! +!------------------------------------------------------------------------- +! +SUBROUTINE test_misc_properties(cleanup, total_error) + + IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(INOUT) :: total_error + + INTEGER(hid_t) :: fapl_id = -1 ! Local fapl + LOGICAL :: use_file_locking ! (H5Pset/get_file_locking_f) + LOGICAL :: ignore_disabled_locks ! (H5Pset/get_file_locking_f) + INTEGER :: error + + ! Create a default fapl + CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl_id, error) + CALL check("H5Pcreate_f", error, total_error) + + ! Test H5Pset/get_file_locking_f + ! true values + use_file_locking = .TRUE. + ignore_disabled_locks = .TRUE. + CALL h5pset_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, error) + CALL check("h5pset_set_file_locking_f", error, total_error) + use_file_locking = .FALSE. + ignore_disabled_locks = .FALSE. + CALL h5pget_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, error) + CALL check("h5pget_set_file_locking_f", error, total_error) + if(use_file_locking .neqv. .TRUE.) then + total_error = total_error + 1 + write(*,*) "Got wrong use_file_locking flag from h5pget_file_locking_f" + endif + if(ignore_disabled_locks .neqv. .TRUE.) then + total_error = total_error + 1 + write(*,*) "Got wrong ignore_disabled_locks flag from h5pget_file_locking_f" + endif + + ! false values + use_file_locking = .FALSE. + ignore_disabled_locks = .FALSE. + CALL h5pset_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, error) + CALL check("h5pset_set_file_locking_f", error, total_error) + use_file_locking = .TRUE. + ignore_disabled_locks = .TRUE. + CALL h5pget_file_locking_f(fapl_id, use_file_locking, ignore_disabled_locks, error) + CALL check("h5pget_set_file_locking_f", error, total_error) + if(use_file_locking .neqv. .FALSE.) then + total_error = total_error + 1 + write(*,*) "Got wrong use_file_locking flag from h5pget_file_locking_f" + endif + if(ignore_disabled_locks .neqv. .FALSE.) then + total_error = total_error + 1 + write(*,*) "Got wrong ignore_disabled_locks flag from h5pget_file_locking_f" + endif + + ! Close the fapl + CALL H5Pclose_f(fapl_id, error) + CALL check("H5Pclose_f", error, total_error) + +END SUBROUTINE test_misc_properties + END MODULE TH5P -- cgit v0.12