diff options
Diffstat (limited to 'fortran/src/H5Of.c')
-rw-r--r-- | fortran/src/H5Of.c | 187 |
1 files changed, 110 insertions, 77 deletions
diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c index 7d065a5..edbfcbe 100644 --- a/fortran/src/H5Of.c +++ b/fortran/src/H5Of.c @@ -22,16 +22,20 @@ #include "H5f90.h" #include "H5Eprivate.h" int_f -fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info); +fill_h5o_info_t_f(H5O_info2_t Oinfo, H5O_info_t_f *object_info); int_f -fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info) { +fill_h5o_info_t_f(H5O_info2_t Oinfo, H5O_info_t_f *object_info) { + + /* This function does not used the field parameter because we want + * this function to fill the unfilled fields with C's default values. + */ struct tm *ts; object_info->fileno = Oinfo.fileno; - object_info->addr = (haddr_t_f)Oinfo.addr; - + object_info->token = Oinfo.token; + object_info->type = (int_f)Oinfo.type; object_info->rc = (int_f)Oinfo.rc; @@ -81,22 +85,6 @@ fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info) { object_info->num_attrs = (hsize_t_f)Oinfo.num_attrs; - object_info->hdr.version = (int_f)Oinfo.hdr.version; - object_info->hdr.nmesgs = (int_f)Oinfo.hdr.nmesgs; - object_info->hdr.nchunks = (int_f)Oinfo.hdr.nchunks; - object_info->hdr.flags = (int_f)Oinfo.hdr.flags; - - object_info->hdr.space.total = (hsize_t_f)Oinfo.hdr.space.total; - object_info->hdr.space.meta = (hsize_t_f)Oinfo.hdr.space.meta; - object_info->hdr.space.mesg = (hsize_t_f)Oinfo.hdr.space.mesg; - object_info->hdr.space.free = (hsize_t_f)Oinfo.hdr.space.free; - - object_info->hdr.mesg.present = Oinfo.hdr.mesg.present; - object_info->hdr.mesg.shared = Oinfo.hdr.mesg.shared; - - object_info->meta_size.obj.index_size = (hsize_t_f)Oinfo.meta_size.obj.index_size; - object_info->meta_size.obj.heap_size = (hsize_t_f)Oinfo.meta_size.obj.heap_size; - return 0; } @@ -138,7 +126,7 @@ h5olink_c (hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, size_t_f *namelen * Call H5Olink function. */ if((hid_t_f)H5Olink((hid_t)*object_id, (hid_t)*new_loc_id, c_name, - (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0) + (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); done: @@ -196,7 +184,7 @@ h5oopen_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, hid_ * PURPOSE * Call H5Oclose * INPUTS - * object_id - Object identifier + * object_id - Object identifier * RETURNS * 0 on success, -1 on failure * AUTHOR @@ -209,10 +197,10 @@ h5oclose_c ( hid_t_f *object_id ) /******/ { int_f ret_value=0; /* Return value */ - + if (H5Oclose((hid_t)*object_id) < 0) HGOTO_DONE(FAIL); - + done: return ret_value; } @@ -229,6 +217,7 @@ h5oclose_c ( hid_t_f *object_id ) * idx - Iteration position at which to start * op - Callback function passing data regarding the link to the calling application * op_data - User-defined pointer to data required by the application for its processing of the link + * fields - Flags specifying the fields to include in object_info. * * OUTPUTS * idx - Position at which an interrupted iteration may be restarted @@ -241,7 +230,8 @@ h5oclose_c ( hid_t_f *object_id ) * SOURCE */ int_f -h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data ) +h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate2_t op, + void *op_data, int_f *fields ) /******/ { int_f ret_value = -1; /* Return value */ @@ -250,24 +240,25 @@ h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, /* * Call H5Ovisit */ - func_ret_value = H5Ovisit( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data); + + func_ret_value = H5Ovisit3( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, (unsigned)*fields); ret_value = (int_f)func_ret_value; return ret_value; } -/****if* H5Of/h5oopen_by_addr_c +/****if* H5Of/h5oopen_by_token_c * NAME - * h5oopen_by_addr_c + * h5oopen_by_token_c * PURPOSE - * Calls H5open_by_addr + * Calls H5open_by_token * INPUTS - * loc_id - File or group identifier - * addr - Object’s address in the file + * loc_id - File or group identifier + * token - Object’s token in the file * * OUTPUTS - * obj_id - Dataset identifier + * obj_id - Object identifier * * RETURNS * 0 on success, -1 on failure @@ -277,15 +268,15 @@ h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, * SOURCE */ int_f -h5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id) +h5oopen_by_token_c(hid_t_f *loc_id, H5O_token_t *token, hid_t_f *obj_id) /******/ { int_f ret_value = 0; /* Return value */ /* - * Call H5Oopen_by_address function. + * Call H5Oopen_by_token function. */ - if((*obj_id = (hid_t_f)H5Oopen_by_addr((hid_t)*loc_id, (haddr_t)*addr)) < 0) + if((*obj_id = (hid_t_f)H5Oopen_by_token((hid_t)*loc_id, *token)) < 0) HGOTO_DONE(FAIL); done: @@ -302,6 +293,7 @@ h5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id) * name - Name of group, relative to loc_id. * namelen - Name length. * lapl_id - Link access property list. + * fields - Flags specifying the fields to include in object_info. * OUTPUTS * object_info - Buffer in which to return object information. * @@ -314,13 +306,13 @@ h5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id) */ int_f h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, - H5O_info_t_f *object_info) + H5O_info_t_f *object_info, int_f *fields) /******/ { char *c_name = NULL; /* Buffer to hold C string */ int_f ret_value = 0; /* Return value */ - H5O_info_t Oinfo; - + H5O_info2_t Oinfo; + /* * Convert FORTRAN name to C name */ @@ -330,11 +322,11 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l /* * Call H5Oinfo_by_name function. */ - if(H5Oget_info_by_name((hid_t)*loc_id, c_name, - &Oinfo, (hid_t)*lapl_id) < 0) + if(H5Oget_info_by_name3((hid_t)*loc_id, c_name, + &Oinfo, (unsigned)*fields, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); - ret_value = fill_h5o_info_t_f(Oinfo,object_info); + ret_value = fill_h5o_info_t_f(Oinfo, object_info); done: if(c_name) @@ -354,6 +346,7 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l * lapl_id - Link access property list. * OUTPUTS * object_info - Buffer in which to return object information. + * fields - Flags specifying the fields to include in object_info. * * RETURNS * 0 on success, -1 on failure @@ -363,16 +356,16 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l * SOURCE */ int_f -h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, - int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info) +h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, + int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info, int_f *fields) /******/ { char *c_group_name = NULL; /* Buffer to hold C string */ int_f ret_value = 0; /* Return value */ - H5O_info_t Oinfo; + H5O_info2_t Oinfo; H5_index_t c_index_field; H5_iter_order_t c_order; - + /* * Convert FORTRAN name to C name */ @@ -385,8 +378,8 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, /* * Call H5Oinfo_by_idx function. */ - if(H5Oget_info_by_idx((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, - &Oinfo, (hid_t)*lapl_id) < 0) + if(H5Oget_info_by_idx3((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, + &Oinfo, (unsigned)*fields, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -404,6 +397,7 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, * Calls H5Oget_info * INPUTS * object_id - Identifier for target object. + * fields - Flags specifying the fields to include in object_info. * OUTPUTS * object_info - Buffer in which to return object information. * @@ -415,16 +409,16 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, * SOURCE */ int_f -h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info) +h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info, int_f *fields) /******/ { int_f ret_value = 0; /* Return value */ - H5O_info_t Oinfo; - + H5O_info2_t Oinfo; + /* * Call H5Oinfo_by_name function. */ - if(H5Oget_info((hid_t)*object_id, &Oinfo) < 0) + if(H5Oget_info3((hid_t)*object_id, &Oinfo, (unsigned)*fields) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -438,12 +432,12 @@ h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info) * H5Ocopy_c * PURPOSE * Calls H5Ocopy - * INPUTS - * src_loc_id - Object identifier indicating the location of the source object to be copied - * src_name - Name of the source object to be copied + * INPUTS + * src_loc_id - Object identifier indicating the location of the source object to be copied + * src_name - Name of the source object to be copied * src_name_len - Length of src_name - * dst_loc_id - Location identifier specifying the destination - * dst_name - Name to be assigned to the new copy + * dst_loc_id - Location identifier specifying the destination + * dst_name - Name to be assigned to the new copy * dst_name_len - Length of dst_name * ocpypl_id - Object copy property list * lcpl_id - Link creation property list for the new hard link @@ -457,15 +451,15 @@ h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info) */ int_f h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, - hid_t_f *dst_loc_id, _fcd dst_name, size_t_f *dst_name_len, - hid_t_f *ocpypl_id, hid_t_f *lcpl_id ) + hid_t_f *dst_loc_id, _fcd dst_name, size_t_f *dst_name_len, + hid_t_f *ocpypl_id, hid_t_f *lcpl_id ) /******/ { char *c_src_name = NULL; /* Buffer to hold C string */ char *c_dst_name = NULL; /* Buffer to hold C string */ - + int_f ret_value = 0; /* Return value */ - + /* * Convert FORTRAN name to C name */ @@ -477,8 +471,8 @@ h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, /* * Call H5Ocopy function. */ - if(H5Ocopy( (hid_t)*src_loc_id, c_src_name, (hid_t)*dst_loc_id, c_dst_name, - (hid_t)*ocpypl_id, (hid_t)*lcpl_id) < 0) + if(H5Ocopy( (hid_t)*src_loc_id, c_src_name, (hid_t)*dst_loc_id, c_dst_name, + (hid_t)*ocpypl_id, (hid_t)*lcpl_id) < 0) HGOTO_DONE(FAIL); done: @@ -503,6 +497,7 @@ h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, * idx - Iteration position at which to start * op - Callback function passing data regarding the link to the calling application * op_data - User-defined pointer to data required by the application for its processing of the link + * fields - Flags specifying the fields to include in object_info. * * OUTPUTS * idx - Position at which an interrupted iteration may be restarted @@ -516,7 +511,7 @@ h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, */ int_f h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order, - H5O_iterate_t op, void *op_data, hid_t_f *lapl_id ) + H5O_iterate2_t op, void *op_data, hid_t_f *lapl_id, int_f *fields ) /******/ { int_f ret_value = -1; /* Return value */ @@ -530,10 +525,10 @@ h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f HGOTO_DONE(FAIL); /* - * Call H5Ovisit + * Call H5Ovisit_by_name */ - func_ret_value = H5Ovisit_by_name( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, - op, op_data, (hid_t)*lapl_id); + func_ret_value = H5Ovisit_by_name3( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, + op, op_data, (unsigned)*fields, (hid_t)*lapl_id); ret_value = (int_f)func_ret_value; done: @@ -694,8 +689,8 @@ h5oset_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentlen) * Calls H5Oset_comment_by_name * INPUTS * object_id - Identifier of the target object. - * name - Name of the object whose comment is to be set or reset, - * specified as a path relative to loc_id. + * name - Name of the object whose comment is to be set or reset, + * specified as a path relative to loc_id. * namelen - Length of the name. * comment - The new comment. * commentlen - Length of the comment. @@ -762,15 +757,15 @@ h5oset_comment_by_name_c (hid_t_f *object_id, _fcd name, size_t_f *namelen, _fc * SOURCE */ int_f -h5oopen_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, - int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id) +h5oopen_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, + int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id) /******/ { char *c_group_name = NULL; /* Buffer to hold C string */ int_f ret_value = 0; H5_index_t c_index_type; H5_iter_order_t c_order; - + /* * Convert FORTRAN string to C string */ @@ -823,13 +818,13 @@ h5oget_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssi /* * Allocate buffer to hold comment name */ - + if(NULL == (c_comment = (char *)HDmalloc(c_commentsize))) HGOTO_DONE(FAIL); /* * Call H5Oget_comment function. - */ + */ if((*bufsize = (hssize_t_f)H5Oget_comment((hid_t)*object_id, c_comment, (size_t)*commentsize)) < 0) HGOTO_DONE(FAIL); @@ -867,8 +862,8 @@ h5oget_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssi * SOURCE */ int_f -h5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size, - _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id) +h5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size, + _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id) /******/ { char *c_comment = NULL; /* Buffer to hold C string */ @@ -888,13 +883,13 @@ h5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size, /* * Allocate buffer to hold comment name */ - + if(NULL == (c_comment = (char *)HDmalloc(c_commentsize))) HGOTO_DONE(FAIL); /* * Call H5Oget_comment_by_name function. - */ + */ if((c_bufsize = H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, (size_t)*commentsize,(hid_t)*lapl_id )) < 0) HGOTO_DONE(FAIL); @@ -922,3 +917,41 @@ h5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size, return ret_value; } + +/****if* H5Of/h5otoken_cmp_c + * NAME + * h5otoken_cmp_c + * PURPOSE + * Calls H5Otoken_cmp + * INPUTS + * loc_id - Identifier of an object in the file / container. + * token1 - The first token to compare. + * token2 - The second token to compare. + * cmp_value - Whether the tokens are equal. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * Quincey Koziol + * January 10, 2019 + * SOURCE +*/ +int_f +h5otoken_cmp_c(hid_t_f *loc_id, H5O_token_t *token1, H5O_token_t *token2, + int_f *cmp_value_f) +/******/ +{ + int cmp_value; /* Token comparison result */ + int_f ret_value = 0; /* Return value */ + + /* Call H5Otoken_cmp function */ + cmp_value = 0; + if(H5Otoken_cmp((hid_t)*loc_id, token1, token2, &cmp_value) < 0) + HGOTO_DONE(FAIL); + + /* Set the comparison value to return */ + *cmp_value_f = cmp_value; + +done: + return ret_value; +} + |