diff options
-rw-r--r-- | MANIFEST | 2 | ||||
-rw-r--r-- | fortran/src/Dependencies | 53 | ||||
-rw-r--r-- | fortran/src/H5Gf.c | 53 | ||||
-rw-r--r-- | fortran/src/H5Git.c | 239 | ||||
-rw-r--r-- | fortran/src/H5Git.h | 25 | ||||
-rw-r--r-- | fortran/src/Makefile.in | 14 |
6 files changed, 37 insertions, 349 deletions
@@ -563,8 +563,6 @@ ./fortran/src/H5Fff.f90 ./fortran/src/H5Gf.c ./fortran/src/H5Gff.f90 -./fortran/src/H5Git.c -./fortran/src/H5Git.h ./fortran/src/H5If.c ./fortran/src/H5Iff.f90 ./fortran/src/H5Pf.c diff --git a/fortran/src/Dependencies b/fortran/src/Dependencies index 8f1dfc6..0697598 100644 --- a/fortran/src/Dependencies +++ b/fortran/src/Dependencies @@ -43,7 +43,6 @@ H5f90kit.lo: \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ $(top_srcdir)/fortran/src/H5f90proto.h \ - $(top_srcdir)/fortran/src/H5Git.h H5_f.lo: \ $(top_srcdir)/fortran/src/H5_f.c \ $(top_srcdir)/fortran/src/H5f90.h \ @@ -86,47 +85,6 @@ H5_f.lo: \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ $(top_srcdir)/fortran/src/H5f90proto.h \ - $(top_srcdir)/fortran/src/H5Git.h -H5Git.lo: \ - $(top_srcdir)/fortran/src/H5Git.c \ - $(top_srcdir)/src/hdf5.h \ - $(top_srcdir)/src/H5public.h \ - $(top_builddir)/src/H5pubconf.h \ - $(top_srcdir)/src/H5api_adpt.h \ - $(top_srcdir)/src/H5Ipublic.h \ - $(top_srcdir)/src/H5Apublic.h \ - $(top_srcdir)/src/H5ACpublic.h \ - $(top_srcdir)/src/H5Bpublic.h \ - $(top_srcdir)/src/H5Dpublic.h \ - $(top_srcdir)/src/H5Epublic.h \ - $(top_srcdir)/src/H5Fpublic.h \ - $(top_srcdir)/src/H5FDpublic.h \ - $(top_srcdir)/src/H5Gpublic.h \ - $(top_srcdir)/src/H5HGpublic.h \ - $(top_srcdir)/src/H5HLpublic.h \ - $(top_srcdir)/src/H5MMpublic.h \ - $(top_srcdir)/src/H5Opublic.h \ - $(top_srcdir)/src/H5Ppublic.h \ - $(top_srcdir)/src/H5Zpublic.h \ - $(top_srcdir)/src/H5Rpublic.h \ - $(top_srcdir)/src/H5Spublic.h \ - $(top_srcdir)/src/H5Tpublic.h \ - $(top_srcdir)/src/H5FDcore.h \ - $(top_srcdir)/src/H5FDfamily.h \ - $(top_srcdir)/src/H5FDfphdf5.h \ - $(top_srcdir)/src/H5FDmpio.h \ - $(top_srcdir)/src/H5FDgass.h \ - $(top_srcdir)/src/H5FDlog.h \ - $(top_srcdir)/src/H5FDmpiposix.h \ - $(top_srcdir)/src/H5FDmulti.h \ - $(top_srcdir)/src/H5FDsec2.h \ - $(top_srcdir)/src/H5FDsrb.h \ - $(top_srcdir)/src/H5FDstdio.h \ - $(top_srcdir)/src/H5FDstream.h \ - $(top_srcdir)/src/H5private.h \ - $(top_srcdir)/src/H5MPprivate.h \ - $(top_srcdir)/src/H5FSprivate.h \ - $(top_srcdir)/fortran/src/H5Git.h H5Rf.lo: \ $(top_srcdir)/fortran/src/H5Rf.c \ $(top_srcdir)/fortran/src/H5f90.h \ @@ -169,7 +127,6 @@ H5Rf.lo: \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ $(top_srcdir)/fortran/src/H5f90proto.h \ - $(top_srcdir)/fortran/src/H5Git.h H5Ff.lo: \ $(top_srcdir)/fortran/src/H5Ff.c \ $(top_srcdir)/fortran/src/H5f90.h \ @@ -212,7 +169,6 @@ H5Ff.lo: \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ $(top_srcdir)/fortran/src/H5f90proto.h \ - $(top_srcdir)/fortran/src/H5Git.h H5Sf.lo: \ $(top_srcdir)/fortran/src/H5Sf.c \ $(top_srcdir)/fortran/src/H5f90.h \ @@ -255,7 +211,6 @@ H5Sf.lo: \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ $(top_srcdir)/fortran/src/H5f90proto.h \ - $(top_srcdir)/fortran/src/H5Git.h H5Df.lo: \ $(top_srcdir)/fortran/src/H5Df.c \ $(top_srcdir)/fortran/src/H5f90.h \ @@ -298,7 +253,6 @@ H5Df.lo: \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ $(top_srcdir)/fortran/src/H5f90proto.h \ - $(top_srcdir)/fortran/src/H5Git.h H5Gf.lo: \ $(top_srcdir)/fortran/src/H5Gf.c \ $(top_srcdir)/fortran/src/H5f90.h \ @@ -341,7 +295,6 @@ H5Gf.lo: \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ $(top_srcdir)/fortran/src/H5f90proto.h \ - $(top_srcdir)/fortran/src/H5Git.h H5Af.lo: \ $(top_srcdir)/fortran/src/H5Af.c \ $(top_srcdir)/fortran/src/H5f90.h \ @@ -384,7 +337,6 @@ H5Af.lo: \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ $(top_srcdir)/fortran/src/H5f90proto.h \ - $(top_srcdir)/fortran/src/H5Git.h H5Tf.lo: \ $(top_srcdir)/fortran/src/H5Tf.c \ $(top_srcdir)/fortran/src/H5f90.h \ @@ -427,7 +379,6 @@ H5Tf.lo: \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ $(top_srcdir)/fortran/src/H5f90proto.h \ - $(top_srcdir)/fortran/src/H5Git.h H5Pf.lo: \ $(top_srcdir)/fortran/src/H5Pf.c \ $(top_srcdir)/fortran/src/H5f90.h \ @@ -470,7 +421,6 @@ H5Pf.lo: \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ $(top_srcdir)/fortran/src/H5f90proto.h \ - $(top_srcdir)/fortran/src/H5Git.h H5If.lo: \ $(top_srcdir)/fortran/src/H5If.c \ $(top_srcdir)/fortran/src/H5f90.h \ @@ -513,7 +463,6 @@ H5If.lo: \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ $(top_srcdir)/fortran/src/H5f90proto.h \ - $(top_srcdir)/fortran/src/H5Git.h H5Ef.lo: \ $(top_srcdir)/fortran/src/H5Ef.c \ $(top_srcdir)/fortran/src/H5f90.h \ @@ -556,7 +505,6 @@ H5Ef.lo: \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ $(top_srcdir)/fortran/src/H5f90proto.h \ - $(top_srcdir)/fortran/src/H5Git.h H5Zf.lo: \ $(top_srcdir)/fortran/src/H5Zf.c \ $(top_srcdir)/fortran/src/H5f90.h \ @@ -599,4 +547,3 @@ H5Zf.lo: \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ $(top_srcdir)/fortran/src/H5f90proto.h \ - $(top_srcdir)/fortran/src/H5Git.h diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index 2fd2ca7..42f5658 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -128,46 +128,50 @@ nh5gget_obj_info_idx_c (hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, _fcd obj_name, int_f *obj_namelen, int_f *obj_type) { int ret_value = -1; - hid_t c_loc_id; + hid_t c_loc_id = (hid_t)*loc_id; char *c_name; int c_namelen; - int c_obj_namelen; + size_t c_obj_namelen; char *c_obj_name = NULL; int type; - int c_idx; - herr_t c_ret_value; + hsize_t c_idx = *idx; + hid_t gid = (-1); /* Temporary group ID */ + /* * Convert FORTRAN name to C name */ c_namelen = *namelen; + c_obj_namelen = *obj_namelen; c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* * Allocate buffer to hold name of the object */ - if (*obj_namelen) c_obj_name = (char *)HDmalloc(*obj_namelen + 1); + if (c_obj_namelen) c_obj_name = (char *)HDmalloc(c_obj_namelen + 1); if (c_obj_name == NULL) { HDfree(c_name); return ret_value; } - /* - * Call H5Gget_obj_info_idx function. - */ - c_loc_id = *loc_id; - c_idx = *idx; - c_ret_value = H5Gget_obj_info_idx(c_loc_id, c_name, c_idx, &c_obj_name, (size_t)*obj_namelen, &type); - if (c_ret_value < 0) goto DONE; + /* Get a temporary group ID for the group to query */ + if((gid=H5Gopen(c_loc_id,c_name))<0) goto DONE; + + /* Query the object's information */ + if(H5Gget_objname_by_idx(gid, c_idx, c_obj_name, c_obj_namelen)<0) goto DONE; + if((type=H5Gget_objtype_by_idx(gid, c_idx))==H5G_UNKNOWN) goto DONE; *obj_type = type; + /* * Convert C name to FORTRAN and place it in the given buffer */ - c_obj_namelen = *obj_namelen; - HD5packFstring(c_obj_name, _fcdtocp(obj_name), c_obj_namelen); + HD5packFstring(c_obj_name, _fcdtocp(obj_name), (int)c_obj_namelen); ret_value = 0; DONE: + /* Close the temporary group, if it was opened */ + if(gid>0) H5Gclose(gid); + HDfree(c_obj_name); HDfree(c_name); return ret_value; @@ -189,10 +193,11 @@ int_f nh5gn_members_c (hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *nmembers) { int ret_value = -1; - hid_t c_loc_id; + hid_t c_loc_id=(hid_t)*loc_id; char *c_name; int c_namelen; - int c_nmembers; + hsize_t c_nmembers; + hid_t gid = (-1); /* * Convert FORTRAN name to C name @@ -201,17 +206,19 @@ nh5gn_members_c (hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *nmembers) c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; - /* - * Call H5Gn_members function. - */ - c_loc_id = (hid_t)*loc_id; - c_nmembers = H5Gn_members(c_loc_id, c_name); + /* Get a temporary group ID for the group to query */ + if((gid=H5Gopen(c_loc_id,c_name))<0) goto DONE; + + /* Call H5Gget_num_objs() for the number of objects in the group */ + if(H5Gget_num_objs(gid,&c_nmembers)<0) goto DONE; - if (c_nmembers < 0) goto DONE; *nmembers = (int_f)c_nmembers; ret_value = 0; DONE: + /* Close the temporary group, if it was opened */ + if(gid>0) H5Gclose(gid); + HDfree(c_name); return ret_value; } @@ -521,7 +528,7 @@ nh5gget_linkval_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size, _f /* * Allocate buffer to hold name of the value */ - if(*size) c_value = (char *)HDmalloc(*size); + if(*size) c_value = (char *)HDmalloc((size_t)*size); if(c_value == NULL) { HDfree(c_name); return ret_value; diff --git a/fortran/src/H5Git.c b/fortran/src/H5Git.c deleted file mode 100644 index 7b867fa..0000000 --- a/fortran/src/H5Git.c +++ /dev/null @@ -1,239 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This files contains C stubs for H5G Fortran APIs */ - -#include "hdf5.h" -#include "H5private.h" -#include "H5Git.h" -#define FALSE 0 - -static herr_t count_elems(hid_t loc_id, const char *name, void *opdata); -static herr_t obj_info(hid_t loc_id, const char *name, void *opdata); - -typedef struct retval { - char * name; - int type; -} retval_t; - - -/*------------------------------------------------------------------------- - * Function: H5Gn_members - * - * Purpose: Return the number of members of a group. The "members" - * are the datasets, groups, and named datatypes in the - * group. - * - * This function wraps the H5Ginterate() function in - * a completely obvious way, uses the operator - * function 'count_members()' below; - * - * See also: H5Giterate() - * - * IN: hid_t file: the file id - * IN: char *group_name: the name of the group - * - * Errors: - * - * Return: Success: The object number of members of - * the group. - * - * Failure: FAIL - * - * Programmer: REMcG - * Monday, Aug 2, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -int -H5Gn_members( hid_t loc_id, char *group_name ) -{ - int res; - int nelems = 0; - - res = H5Giterate(loc_id, group_name, NULL, count_elems, (void *)&nelems); - if (res < 0) { - return res; - } else { - return( nelems ); - } -} - - - -/*------------------------------------------------------------------------- - * Function: H5Gget_obj_info_idx - * - * Purpose: Return the name and type of the member of the group - * at index 'idx', as defined by the H5Giterator() - * function. - * - * This function wraps the H5Ginterate() function in - * a completely obvious way, uses the operator - * function 'get_objinfo()' below; - * - * See also: H5Giterate() - * - * IN: hid_t file: the file id - * IN: char *group_name: the name of the group - * IN: int idx: the index of the member object (see - * H5Giterate() - * OUT: char **objname: the name of the member object - * OUT: int *type: the type of the object (dataset, - * group, or named datatype) - * - * Errors: - * - * Return: Success: The object number of members of - * the group. - * - * Failure: FAIL - * - * Programmer: REMcG - * Monday, Aug 2, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5Gget_obj_info_idx( hid_t loc_id, char *group_name, int idx, char **objname, size_t max_objname_len, int *type ) -{ - int res; - retval_t retVal; - - res = H5Giterate(loc_id, group_name, &idx, obj_info, (void *)&retVal); - if (res < 0) { - return res; - } - - /* Only play with the string if it was returned */ - if(retVal.name!=NULL) { - /* Copy the name to return & truncate if necessary */ - strncpy(*objname,retVal.name,max_objname_len); - (*objname)[max_objname_len]='\0'; - - /* Free the name we strdup'ed in obj_info() */ - HDfree(retVal.name); - } /* end if */ - else - *(*objname)='\0'; - - *type = retVal.type; - return 0; -} - - - -/*------------------------------------------------------------------------- - * Function: count_elems - * - * Purpose: this is the operator function called by H5Gn_members(). - * - * This function is passed to H5Ginterate(). - * - * See also: H5Giterate() - * - * OUT: 'opdata' is returned as an integer with the - * number of members in the group. - * - * Errors: - * - * Return: Success: The object number of members of - * the group. - * - * Failure: FAIL - * - * Programmer: REMcG - * Monday, Aug 2, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static herr_t -count_elems(hid_t loc_id, const char *name, void *opdata) -{ - herr_t res; - H5G_stat_t statbuf; - - res = H5Gget_objinfo(loc_id, name, FALSE, &statbuf); - if (res < 0) { - return 1; - } - switch (statbuf.type) { - case H5G_GROUP: - (*(int *)opdata)++; - break; - case H5G_DATASET: - (*(int *)opdata)++; - break; - case H5G_TYPE: - (*(int *)opdata)++; - break; - default: - (*(int *)opdata)++; /* ???? count links or no? */ - break; - } - return 0; - } - - -/*------------------------------------------------------------------------- - * Function: obj_info - * - * Purpose: this is the operator function called by H5Gn_members(). - * - * This function is passed to H5Ginterate(). - * - * See also: H5Giterate() - * - * OUT: 'opdata' is returned as a 'recvar_t', containing - * the object name and type. - * - * Errors: - * - * Return: Success: The object number of members of - * the group. - * - * Failure: FAIL - * - * Programmer: REMcG - * Monday, Aug 2, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - * group, or named datatype) - */ -static herr_t -obj_info(hid_t loc_id, const char *name, void *opdata) -{ - herr_t res; - H5G_stat_t statbuf; - - res = H5Gget_objinfo(loc_id, name, FALSE, &statbuf); - if (res < 0) { - ((retval_t *)opdata)->type = 0; - ((retval_t *)opdata)->name = NULL; - return 1; - } else { - ((retval_t *)opdata)->type = statbuf.type; - ((retval_t *)opdata)->name = strdup(name); - return 1; - } - } diff --git a/fortran/src/H5Git.h b/fortran/src/H5Git.h deleted file mode 100644 index 9924bc8..0000000 --- a/fortran/src/H5Git.h +++ /dev/null @@ -1,25 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - -#ifndef _H5Git_H -#define _H5Git_H - -#include "hdf5.h" - -int H5Gn_members( hid_t loc_id, char *group_name ); - -herr_t H5Gget_obj_info_idx( hid_t loc_id, char *group_name, int idx, char **objname, size_t max_objname_len, int *type ); - -#endif /*_H5Git_H*/ diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index e5f06f3..83dc6b8 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -45,13 +45,13 @@ ADD_PARALLEL_FILES=@ADD_PARALLEL_FILES@ FPAR_MOD=${ADD_PARALLEL_FILES:yes=HDF5mpio.f90} CPARALLEL=${ADD_PARALLEL_FILES:yes=H5FDmpiof.c} -CLIB_SRC=H5f90kit.c H5_f.c H5Git.c H5Rf.c H5Ff.c H5Sf.c H5Df.c H5Gf.c \ - H5Af.c H5Tf.c H5Pf.c H5If.c H5Ef.c H5Zf.c ${CPARALLEL:no=} +CLIB_SRC=H5f90kit.c H5_f.c H5Af.c H5Df.c H5Ef.c H5Ff.c H5Gf.c \ + H5If.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c ${CPARALLEL:no=} FPARALLEL=${ADD_PARALLEL_FILES:yes=H5FDmpioff.f90} -FLIB_SRC=H5fortran_types.f90 H5fortran_flags.f90 H5f90global.f90 H5_ff.f90 \ - H5Rff.f90 H5Fff.f90 H5Sff.f90 H5Dff.f90 H5Gff.f90 H5Aff.f90 H5Tff.f90 \ - H5Pff.f90 H5Iff.f90 H5Eff.f90 H5Zff.f90 ${FPARALLEL:no=} ${FPAR_MOD:no=HDF5.f90} +FLIB_SRC=H5fortran_flags.f90 H5f90global.f90 H5fortran_types.f90 H5_ff.f90 \ + H5Aff.f90 H5Dff.f90 H5Eff.f90 H5Fff.f90 H5Gff.f90 H5Iff.f90 H5Pff.f90 \ + H5Rff.f90 H5Sff.f90 H5Tff.f90 H5Zff.f90 ${FPARALLEL:no=} ${FPAR_MOD:no=HDF5.f90} LIB_SRC=$(CLIB_SRC) $(FLIB_SRC) LIB_OBJ=$(CLIB_SRC:.c=.lo) $(FLIB_SRC:.f90=.lo) @@ -61,8 +61,9 @@ LIB_OBJ=$(CLIB_SRC:.c=.lo) $(FLIB_SRC:.f90=.lo) ## doing a parallel make, some modules could be made way before the ## modules they depend upon are actually made. *sigh* H5fortran_flags.lo: $(srcdir)/H5fortran_flags.f90 -H5fortran_types.lo: H5fortran_types.f90 H5f90global.lo: $(srcdir)/H5f90global.f90 H5fortran_flags.lo H5fortran_types.lo +H5fortran_types.lo: H5fortran_types.f90 +H5_ff.lo: $(srcdir)/H5_ff.f90 H5f90global.lo H5Aff.lo: $(srcdir)/H5Aff.f90 H5f90global.lo H5Dff.lo: $(srcdir)/H5Dff.f90 H5f90global.lo H5Eff.lo: $(srcdir)/H5Eff.f90 H5f90global.lo @@ -74,7 +75,6 @@ H5Rff.lo: $(srcdir)/H5Rff.f90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.f90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.f90 H5f90global.lo H5Zff.lo: $(srcdir)/H5Zff.f90 H5f90global.lo -H5_ff.lo: $(srcdir)/H5_ff.f90 H5f90global.lo HDF5.lo: $(srcdir)/HDF5.f90 H5f90global.lo H5Aff.lo \ H5Dff.lo H5Eff.lo H5Fff.lo H5Gff.lo H5Iff.lo \ H5Pff.lo H5Rff.lo H5Sff.lo H5Tff.lo H5Zff.lo |