summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2003-04-29 19:49:48 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2003-04-29 19:49:48 (GMT)
commitb58192dfe739118385748c776e8a99c16b82bb03 (patch)
treed2b3181ef6e49db6359eb715b08a1b7b4a81eb8a
parent67985f540fe44d0ea57415dd10a592259a25d154 (diff)
downloadhdf5-b58192dfe739118385748c776e8a99c16b82bb03.zip
hdf5-b58192dfe739118385748c776e8a99c16b82bb03.tar.gz
hdf5-b58192dfe739118385748c776e8a99c16b82bb03.tar.bz2
[svn-r6779] Purpose: Backward compatibility change
Description: 1.4 compatibility for H5G_obj_t type and H5Zregister test. Solution: use macro H5_WANT_H5_V1_4_COMPAT Platforms tested: h5committest
-rw-r--r--c++/test/dsets.cpp6
-rw-r--r--perform/chunk.c4
-rw-r--r--src/H5G.c44
-rw-r--r--src/H5Gpkg.h2
-rw-r--r--src/H5Gprivate.h8
-rw-r--r--src/H5Gpublic.h20
-rw-r--r--src/H5R.c18
-rw-r--r--test/dsets.c8
-rw-r--r--test/titerate.c4
9 files changed, 90 insertions, 24 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 8a2d77e..4ccbac2 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -650,7 +650,11 @@ test_compression(H5File& file)
TESTING("compression (app-defined method)");
// BMR: not sure how to handle this yet
- if (H5Zregister (H5Z_BOGUS)<0) goto error;
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ if (H5Zregister (H5Z_FILTER_BOGUS, "bogus", bogus)<0) goto error;
+#else /* H5_WANT_H5_V1_4_COMPAT */
+ if (H5Zregister (H5Z_BOGUS)<0) goto error;
+#endif /* H5_WANT_H5_V1_4_COMPAT */
if (H5Pset_filter (dscreatplist.getId(), H5Z_FILTER_BOGUS, 0, 0, NULL)<0) goto error;
dscreatplist.setFilter (H5Z_FILTER_BOGUS, 0, 0, NULL);
diff --git a/perform/chunk.c b/perform/chunk.c
index 46fb37d..0348e6d 100644
--- a/perform/chunk.c
+++ b/perform/chunk.c
@@ -152,7 +152,11 @@ create_dataset (void)
dcpl = H5Pcreate (H5P_DATASET_CREATE);
size[0] = size[1] = CH_SIZE;
H5Pset_chunk (dcpl, 2, size);
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ H5Zregister (FILTER_COUNTER, "counter", counter);
+#else /* H5_WANT_H5_V1_4_COMPAT */
H5Zregister (H5Z_COUNTER);
+#endif /* H5_WANT_H5_V1_4_COMPAT */
H5Pset_filter (dcpl, FILTER_COUNTER, 0, 0, NULL);
/* The dataset */
diff --git a/src/H5G.c b/src/H5G.c
index fb11f8d..0b71257 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -156,7 +156,7 @@ static herr_t H5G_move(H5G_entry_t *src_loc, const char *src_name,
static herr_t H5G_unlink(H5G_entry_t *loc, const char *name, hid_t dxpl_id);
static herr_t H5G_get_num_objs(H5G_t *grp, hsize_t *num_objs, hid_t dxpl_id);
static ssize_t H5G_get_objname_by_idx(H5G_t *grp, hsize_t idx, char* name, size_t size, hid_t dxpl_id);
-static H5G_obj_t H5G_get_objtype_by_idx(H5G_t *grp, hsize_t idx, hid_t dxpl_id);
+static int H5G_get_objtype_by_idx(H5G_t *grp, hsize_t idx, hid_t dxpl_id);
static herr_t H5G_replace_ent(void *obj_ptr, hid_t obj_id, const void *key);
static herr_t H5G_traverse_slink(H5G_entry_t *grp_ent/*in,out*/,
H5G_entry_t *obj_ent/*in,out*/, int *nlinks/*in,out*/, hid_t dxpl_id);
@@ -511,6 +511,35 @@ done:
*
*-------------------------------------------------------------------------
*/
+#ifdef H5_WANT_H5_V1_4_COMPAT
+int
+H5Gget_objtype_by_idx(hid_t group_id, hsize_t idx)
+{
+ H5G_t *group = NULL;
+ hsize_t num_objs;
+ int ret_value = H5G_UNKNOWN;
+
+ FUNC_ENTER_API(H5Gget_objtype_by_idx, FAIL);
+ H5TRACE2("Is","ih",group_id,idx);
+
+ /* Check args */
+ if (NULL==(group = H5I_object_verify(group_id,H5I_GROUP)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group");
+
+ if (H5G_get_num_objs(group, &num_objs, H5AC_ind_dxpl_id)<0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to retrieve number of members");
+ if(idx >= num_objs)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound");
+
+ /*call private function*/
+ ret_value = H5G_get_objtype_by_idx(group, idx, H5AC_ind_dxpl_id);
+
+done:
+ FUNC_LEAVE_API(ret_value);
+
+}
+
+#else /*H5_WANT_H5_V1_4_COMPAT*/
H5G_obj_t
H5Gget_objtype_by_idx(hid_t group_id, hsize_t idx)
{
@@ -531,12 +560,13 @@ H5Gget_objtype_by_idx(hid_t group_id, hsize_t idx)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound");
/*call private function*/
- ret_value = H5G_get_objtype_by_idx(group, idx, H5AC_ind_dxpl_id);
+ ret_value = (H5G_obj_t)H5G_get_objtype_by_idx(group, idx, H5AC_ind_dxpl_id);
done:
FUNC_LEAVE_API(ret_value);
}
+#endif /*H5_WANT_H5_V1_4_COMPAT*/
/*-------------------------------------------------------------------------
@@ -1003,7 +1033,7 @@ H5G_term_interface(void)
*-------------------------------------------------------------------------
*/
herr_t
-H5G_register_type(H5G_obj_t type, htri_t(*isa)(H5G_entry_t*, hid_t), const char *_desc)
+H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*, hid_t), const char *_desc)
{
char *desc = NULL;
size_t i;
@@ -2298,7 +2328,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-H5G_obj_t
+int
H5G_get_type(H5G_entry_t *ent, hid_t dxpl_id)
{
htri_t isa;
@@ -2521,10 +2551,10 @@ done:
*
*-------------------------------------------------------------------------
*/
-static H5G_obj_t
+static int
H5G_get_objtype_by_idx(H5G_t *grp, hsize_t idx, hid_t dxpl_id)
{
- H5G_obj_t ret_value = H5G_UNKNOWN;
+ int ret_value = H5G_UNKNOWN;
H5G_bt_ud3_t udata;
FUNC_ENTER_NOAPI(H5G_get_objtype_by_idx, FAIL);
@@ -3057,7 +3087,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_replace_name(H5G_obj_t type, H5G_entry_t *loc,
+H5G_replace_name(int type, H5G_entry_t *loc,
H5RS_str_t *src_name, H5G_entry_t *src_loc,
H5RS_str_t *dst_name, H5G_entry_t *dst_loc, H5G_names_op_t op )
{
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 53e8a31..5f9adfb 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -126,7 +126,7 @@ typedef struct H5G_bt_ud3_t {
hsize_t idx; /*index of group member to be querried */
char *name; /*member name to be returned */
hsize_t num_objs; /*the number of objects having been traversed*/
- H5G_obj_t type; /*member type to be returned */
+ int type; /*member type to be returned */
} H5G_bt_ud3_t;
/*
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 66fd86e..64b7689 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -120,7 +120,7 @@ typedef struct H5G_t H5G_t;
* is allocated dynamically.
*/
typedef struct H5G_typeinfo_t {
- H5G_obj_t type; /*one of the public H5G_* types */
+ int type; /*one of the public H5G_* types */
htri_t (*isa)(H5G_entry_t*, hid_t); /*function to determine type */
char *desc; /*description of object type */
} H5G_typeinfo_t;
@@ -148,7 +148,7 @@ struct H5O_stab_t;
* Library prototypes... These are the ones that other packages routinely
* call.
*/
-H5_DLL herr_t H5G_register_type(H5G_obj_t type, htri_t(*isa)(H5G_entry_t*, hid_t),
+H5_DLL herr_t H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*, hid_t),
const char *desc);
H5_DLL H5G_entry_t *H5G_loc(hid_t loc_id);
H5_DLL herr_t H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_entry);
@@ -158,7 +158,7 @@ H5_DLL H5G_t *H5G_open(H5G_entry_t *loc, const char *name, hid_t dxpl_id);
H5_DLL H5G_t *H5G_open_oid(H5G_entry_t *ent, hid_t dxpl_id);
H5_DLL herr_t H5G_close(H5G_t *grp);
H5_DLL H5G_t *H5G_rootof(H5F_t *f);
-H5_DLL H5G_obj_t H5G_get_type(H5G_entry_t *ent, hid_t dxpl_id);
+H5_DLL int H5G_get_type(H5G_entry_t *ent, hid_t dxpl_id);
H5_DLL herr_t H5G_get_objinfo(H5G_entry_t *loc, const char *name,
hbool_t follow_link,
H5G_stat_t *statbuf/*out*/, hid_t dxpl_id);
@@ -167,7 +167,7 @@ H5_DLL herr_t H5G_insert(H5G_entry_t *loc, const char *name,
H5_DLL herr_t H5G_find(H5G_entry_t *loc, const char *name,
H5G_entry_t *grp_ent/*out*/, H5G_entry_t *ent/*out*/, hid_t dxpl_id);
H5_DLL H5F_t *H5G_insertion_file(H5G_entry_t *loc, const char *name, hid_t dxpl_id);
-H5_DLL herr_t H5G_replace_name(H5G_obj_t type, H5G_entry_t *loc,
+H5_DLL herr_t H5G_replace_name(int type, H5G_entry_t *loc,
H5RS_str_t *src_name, H5G_entry_t *src_loc,
H5RS_str_t *dst_name, H5G_entry_t *dst_loc, H5G_names_op_t op);
H5_DLL herr_t H5G_free_grp_name(H5G_t *grp);
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 88b6c45..5a48e30 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -52,6 +52,17 @@ typedef enum H5G_link_t {
* application is running. An object may satisfy the `isa' function for more
* than one type.
*/
+#ifdef H5_WANT_H5_V1_4_COMPAT
+#define H5G_UNKNOWN -1 /* Unknown object type */
+#define H5G_LINK 0 /* Object is a symbolic link */
+#define H5G_GROUP 1 /* Object is a group */
+#define H5G_DATASET 2 /* Object is a dataset */
+#define H5G_TYPE 3 /* Object is a named data type */
+#define H5G_RESERVED_4 4 /* Reserved for future use */
+#define H5G_RESERVED_5 5 /* Reserved for future use */
+#define H5G_RESERVED_6 6 /* Reserved for future use */
+#define H5G_RESERVED_7 7 /* Reserved for future use */
+#else /*H5_WANT_H5_V1_4_COMPAT*/
typedef enum H5G_obj_t {
H5G_UNKNOWN = -1, /* Unknown object type */
H5G_LINK, /* Object is a symbolic link */
@@ -63,6 +74,7 @@ typedef enum H5G_obj_t {
H5G_RESERVED_6, /* Reserved for future use */
H5G_RESERVED_7 /* Reserved for future use */
} H5G_obj_t;
+#endif /*H5_WANT_H5_V1_4_COMPAT*/
#define H5G_NTYPES 256 /* Max possible number of types */
#define H5G_NLIBTYPES 8 /* Number of internal types */
@@ -74,7 +86,11 @@ typedef struct H5G_stat_t {
unsigned long fileno[2]; /*file number */
unsigned long objno[2]; /*object number */
unsigned nlink; /*number of hard links to object*/
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ int type; /*basic object type */
+#else /*H5_WANT_H5_V1_4_COMPAT*/
H5G_obj_t type; /*basic object type */
+#endif /*H5_WANT_H5_V1_4_COMPAT*/
time_t mtime; /*modification time */
size_t linklen; /*symbolic link value length */
} H5G_stat_t;
@@ -95,7 +111,11 @@ H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx,
H5G_iterate_t op, void *op_data);
H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs);
H5_DLL ssize_t H5Gget_objname_by_idx(hid_t group_id, hsize_t idx, char* name, size_t size);
+#ifdef H5_WANT_H5_V1_4_COMPAT
+H5_DLL int H5Gget_objtype_by_idx(hid_t group_id, hsize_t idx);
+#else /*H5_WANT_H5_V1_4_COMPAT*/
H5_DLL H5G_obj_t H5Gget_objtype_by_idx(hid_t group_id, hsize_t idx);
+#endif /*H5_WANT_H5_V1_4_COMPAT*/
H5_DLL herr_t H5Gmove2(hid_t src_loc, const char *src, hid_t dst_loc,
const char *dst);
H5_DLL herr_t H5Glink2(hid_t src_loc, const char *cur_name, H5G_link_t type,
diff --git a/src/H5R.c b/src/H5R.c
index ee1c7e4..a085995 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -40,7 +40,7 @@ static herr_t H5R_create(void *ref, H5G_entry_t *loc, const char *name,
H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id);
static hid_t H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref);
static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref);
-static H5G_obj_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref);
+static int H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref);
/*--------------------------------------------------------------------------
@@ -337,7 +337,7 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
H5T_t *datatype; /* Pointer to datatype to open */
H5G_entry_t ent; /* Symbol table entry */
uint8_t *p; /* Pointer to OID to store */
- H5G_obj_t oid_type; /* type of object being dereferenced */
+ int oid_type; /* type of object being dereferenced */
hid_t ret_value;
FUNC_ENTER_NOINIT(H5R_dereference);
@@ -647,13 +647,13 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static H5G_obj_t
-H5R_get_object_type(H5F_t *file, void *_ref)
+static int
+H5R_get_object_type(H5F_t *file, hid_t dxpl_id, void *_ref)
{
H5G_entry_t ent; /* Symbol table entry */
hobj_ref_t *ref=(hobj_ref_t *)_ref; /* Only object references currently supported */
uint8_t *p; /* Pointer to OID to store */
- H5G_obj_t ret_value;
+ int ret_value;
FUNC_ENTER_NOINIT(H5R_get_object_type);
@@ -670,7 +670,7 @@ H5R_get_object_type(H5F_t *file, void *_ref)
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(ent.header));
/* Get the OID type */
- ret_value=H5G_get_type(&ent);
+ ret_value=H5G_get_type(&ent, dxpl_id);
#ifdef LATER
done:
@@ -721,7 +721,7 @@ H5Rget_object_type(hid_t id, void *_ref)
file=loc->file;
/* Get the object information */
- if ((ret_value=H5R_get_object_type(file,_ref))<0)
+ if ((ret_value=H5R_get_object_type(file,H5AC_ind_dxpl_id,_ref))<0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type");
done:
@@ -752,12 +752,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static H5G_obj_t
+static int
H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
{
H5G_entry_t ent; /* Symbol table entry */
uint8_t *p; /* Pointer to OID to store */
- H5G_obj_t ret_value;
+ int ret_value;
FUNC_ENTER_NOINIT(H5R_get_obj_type);
diff --git a/test/dsets.c b/test/dsets.c
index ee54058..c229e13 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -2253,7 +2253,11 @@ test_can_apply(hid_t file)
printf(" Line %d: Can't set chunk sizes\n",__LINE__);
goto error;
} /* end if */
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ if(H5Zregister (H5Z_FILTER_BOGUS, "bogus", filter_bogus)<0) {
+#else /* H5_WANT_H5_V1_4_COMPAT */
if(H5Zregister (H5Z_CAN_APPLY)<0) {
+#endif /* H5_WANT_H5_V1_4_COMPAT */
H5_FAILED();
printf(" Line %d: Can't register 'can apply' filter\n",__LINE__);
goto error;
@@ -2555,7 +2559,11 @@ test_set_local(const char *filename, hid_t fapl)
printf(" Line %d: Can't set chunk sizes\n",__LINE__);
goto error;
} /* end if */
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ if(H5Zregister (H5Z_FILTER_BOGUS2, "bogus2", filter_bogus2)<0) {
+#else /* H5_WANT_H5_V1_4_COMPAT */
if(H5Zregister (H5Z_SET_LOCAL)<0) {
+#endif /* H5_WANT_H5_V1_4_COMPAT */
H5_FAILED();
printf(" Line %d: Can't register 'set local' filter\n",__LINE__);
goto error;
diff --git a/test/titerate.c b/test/titerate.c
index ebe12ec..63c6281 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -671,8 +671,8 @@ static void test_grp_memb_funcs(void)
obj_names[i]=HDstrdup(dataset_name);
CHECK(dnames[i], NULL, "strdup");
- ret = H5Gget_objtype_by_idx(root_group, (hsize_t)i);
- CHECK(ret, H5G_UNKNOWN, "H5Gget_objsname_by_idx");
+ ret = (herr_t)H5Gget_objtype_by_idx(root_group, (hsize_t)i);
+ CHECK(ret, FAIL, "H5Gget_objsname_by_idx");
if(!HDstrcmp(dataset_name, "grp"))
VERIFY(ret, H5G_GROUP, "H5Gget_objsname_by_idx");