summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST1
-rw-r--r--src/H5D.c10
-rw-r--r--src/H5F.c6
-rw-r--r--src/H5G.c173
-rw-r--r--src/H5Gpkg.h2
-rw-r--r--src/H5Gprivate.h12
-rw-r--r--src/H5Gpublic.h2
-rw-r--r--src/H5Gstab.c16
-rw-r--r--src/H5P.c135
-rwxr-xr-xsrc/H5Pocpl.c94
-rw-r--r--src/H5Pprivate.h4
-rw-r--r--src/H5Ppublic.h24
-rw-r--r--src/H5T.c19
-rw-r--r--src/H5Tcommit.c86
-rw-r--r--src/H5Tpublic.h1
-rwxr-xr-xsrc/Makefile.am3
-rw-r--r--src/Makefile.in22
-rw-r--r--test/tmisc.c240
18 files changed, 791 insertions, 59 deletions
diff --git a/MANIFEST b/MANIFEST
index a30000a..743fecf 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -931,6 +931,7 @@
./src/H5Pdxpl.c
./src/H5Pfapl.c
./src/H5Pfcpl.c
+./src/H5Pocpl.c
./src/H5Ppkg.h
./src/H5Pprivate.h
./src/H5Ppublic.h
diff --git a/src/H5D.c b/src/H5D.c
index 440a9888..0f12a93 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -210,7 +210,7 @@ H5D_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
- if(H5P_get_nprops_pclass(xfer_pclass,&nprops)<0)
+ if(H5P_get_nprops_pclass(xfer_pclass,&nprops,FALSE)<0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
@@ -302,7 +302,7 @@ H5D_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
- if(H5P_get_nprops_pclass(crt_pclass,&nprops)<0)
+ if(H5P_get_nprops_pclass(crt_pclass,&nprops,FALSE)<0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
@@ -2095,6 +2095,10 @@ done:
* Nat Furrer and James Laird
* June 7, 2004
* Added checked_filters flag
+ *
+ * Peter X. Cao
+ * May 09, 2005
+ * Add property to create intermediate groups
*
*-------------------------------------------------------------------------
*/
@@ -2373,7 +2377,7 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
* "H5G_entry_t" object to the group this dataset is being initially
* created in.
*/
- if (H5G_insert(loc, name, &new_dset->ent, dxpl_id) < 0)
+ if (H5G_insert(loc, name, &new_dset->ent, dxpl_id, dc_plist) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to name dataset")
/* Add the dataset to the list of opened objects in the file */
diff --git a/src/H5F.c b/src/H5F.c
index 468fcaa..54dee30 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -244,7 +244,7 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
- if(H5P_get_nprops_pclass(crt_pclass,&nprops)<0)
+ if(H5P_get_nprops_pclass(crt_pclass,&nprops,FALSE)<0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
@@ -301,7 +301,7 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
- if(H5P_get_nprops_pclass(acs_pclass,&nprops)<0)
+ if(H5P_get_nprops_pclass(acs_pclass,&nprops,FALSE)<0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
@@ -387,7 +387,7 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
/* Get the number of properties in the class */
- if(H5P_get_nprops_pclass(mnt_pclass,&nprops)<0)
+ if(H5P_get_nprops_pclass(mnt_pclass,&nprops,FALSE)<0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
/* Assume that if there are properties in the class, they are the default ones */
diff --git a/src/H5G.c b/src/H5G.c
index 06c1d33..5c19ced 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -105,6 +105,7 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
/* Local macros */
#define H5G_INIT_HEAP 8192
@@ -120,6 +121,7 @@
#define H5G_TARGET_NORMAL 0x0000
#define H5G_TARGET_SLINK 0x0001
#define H5G_TARGET_MOUNT 0x0002
+#define H5G_CRT_INTMD_GROUP 0x0004
/* Local typedefs */
@@ -165,7 +167,8 @@ H5FL_DEFINE(H5G_shared_t);
H5FL_BLK_EXTERN(str_buf);
/* Private prototypes */
-static H5G_t *H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint, hid_t dxpl_id);
+static H5G_t *H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint,
+ hid_t dxpl_id, hid_t gcpl_id, hid_t gapl_id);
#ifdef NOT_YET
static H5G_t *H5G_reopen(H5G_t *grp);
#endif /* NOT_YET */
@@ -241,7 +244,8 @@ H5Gcreate(hid_t loc_id, const char *name, size_t size_hint)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given");
/* Create the group */
- if (NULL == (grp = H5G_create(loc, name, size_hint, H5AC_dxpl_id)))
+ if (NULL == (grp = H5G_create(loc, name, size_hint, H5AC_dxpl_id,
+ H5P_GROUP_CREATE_DEFAULT, H5P_DEFAULT)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group");
if ((ret_value = H5I_register(H5I_GROUP, grp)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group");
@@ -257,6 +261,81 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Gcreate_expand
+ *
+ * Purpose: Creates a new group relative to LOC_ID and gives it the
+ * specified NAME, and creation property list GCPL_ID and access
+ * property list GAPL_ID.
+ *
+ * The optional SIZE_HINT specifies how much file space to
+ * reserve to store the names that will appear in this
+ * group. If a non-positive value is supplied for the SIZE_HINT
+ * then a default size is chosen.
+ *
+ * Given the default setting, H5Gcreate_expand() will have the
+ * same function of H5Gcreate()
+ *
+ * See also: H5Gcreate(), H5Dcreate_expand()
+ *
+ * Errors:
+ *
+ * Return: Success: The object ID of a new, empty group open for
+ * writing. Call H5Gclose() when finished with
+ * the group.
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Peter Cao
+ * May 08, 2005
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Gcreate_expand(hid_t loc_id, const char *name, size_t size_hint, hid_t gcpl_id, hid_t gapl_id)
+{
+ H5G_entry_t *loc = NULL;
+ H5G_t *grp = NULL;
+ hid_t ret_value;
+
+ FUNC_ENTER_API(H5Gcreate_expand, FAIL)
+
+ /* Check arguments */
+ if (NULL==(loc=H5G_loc (loc_id)))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if (!name || !*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
+
+ /* Check group creation property list */
+ if(H5P_DEFAULT == gcpl_id)
+ gcpl_id = H5P_GROUP_CREATE_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list")
+
+#ifdef LATER
+ /* Check the group access property list */
+ if(H5P_DEFAULT == gapl_id)
+ gapl_id = H5P_GROUP_ACCESS_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list")
+#endif /* LATER */
+
+ if (NULL == (grp = H5G_create(loc, name, size_hint, H5AC_dxpl_id, gcpl_id, gapl_id)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
+ if ((ret_value = H5I_register(H5I_GROUP, grp)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
+
+done:
+ if(ret_value<0) {
+ if(grp!=NULL)
+ H5G_close(grp);
+ } /* end if */
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Gcreate_expand() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Gopen
*
* Purpose: Opens an existing group for modification. When finished,
@@ -970,7 +1049,8 @@ done:
static herr_t
H5G_init_interface(void)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value=SUCCEED; /* Return value */
+ H5P_genclass_t *crt_pclass;
FUNC_ENTER_NOAPI_NOINIT(H5G_init_interface);
@@ -989,6 +1069,23 @@ H5G_init_interface(void)
H5G_register_type(H5G_DATASET, H5D_isa, "dataset");
H5G_register_type(H5G_LINK, H5G_link_isa, "link");
+ /* ========== group Creation Property Class Initialization ============*/
+ assert(H5P_CLS_GROUP_CREATE_g!=-1);
+
+ /* Get the pointer to group creation class */
+ if(NULL == (crt_pclass = H5I_object(H5P_CLS_GROUP_CREATE_g)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
+
+ /* Put group creation property insertion code here when it's needed. */
+ /* (See example in H5D_init_interface() ) */
+
+ /* Only register the default property list if it hasn't been created yet */
+ if(H5P_LST_GROUP_CREATE_g==(-1)) {
+ /* Register the default group creation property list */
+ if((H5P_LST_GROUP_CREATE_g = H5P_create_id(crt_pclass))<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class")
+ } /* end if */
+
done:
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -1494,11 +1591,35 @@ H5G_namei(const H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/
case H5G_NAMEI_INSERT:
if(!last_comp) {
if (H5G_stab_find(grp_ent, H5G_comp_g, obj_ent/*out*/, dxpl_id )<0) {
- /*
- * Component was not found in the current symbol table, possibly
- * because GRP_ENT isn't a symbol table.
- */
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found");
+ /* If an intermediate group doesn't exist & flag is set, create the group */
+ if (target & H5G_CRT_INTMD_GROUP) {
+ H5G_entry_t new_ent;
+
+ /* Reset group entry */
+ HDmemset(&new_ent, 0, sizeof(H5G_entry_t));
+
+ /* Create the group entry */
+ if (H5G_stab_create(grp_ent->file, dxpl_id, 0, &new_ent/*out*/) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create grp");
+
+ /* Insert new group into current group's symbol table */
+ if (H5G_stab_insert(grp_ent, H5G_comp_g, &new_ent, dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert intermediate group");
+
+ /* Close new group entry */
+ if (H5O_close(&new_ent) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close");
+
+ /* Copy newly created group's entry, so we can traverse into it */
+ if (H5G_ent_copy(obj_ent, &new_ent, H5G_COPY_NULL)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to copy entry");
+
+ /* Insert the name into the new symbol entry */
+ if (H5G_stab_insert_name(grp_ent, obj_ent, H5G_comp_g ) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name");
+ }
+ else
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found");
}
} /* end if */
else {
@@ -1771,10 +1892,12 @@ done:
*-------------------------------------------------------------------------
*/
static H5G_t *
-H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint, hid_t dxpl_id)
+H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint,
+ hid_t dxpl_id, hid_t gcpl_id, hid_t UNUSED gapl_id)
{
H5G_t *grp = NULL; /*new group */
H5F_t *file = NULL; /* File new group will be in */
+ H5P_genplist_t *gc_plist; /* Property list created */
unsigned stab_init=0; /* Flag to indicate that the symbol table was created successfully */
H5G_t *ret_value; /* Return value */
@@ -1783,6 +1906,10 @@ H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint, hid_t dxpl_id)
/* check args */
assert(loc);
assert(name && *name);
+ assert(gcpl_id != H5P_DEFAULT);
+#ifdef LATER
+ assert(gapl_id != H5P_DEFAULT);
+#endif /* LATER */
/* create an open group */
if (NULL==(grp = H5FL_CALLOC(H5G_t)))
@@ -1799,8 +1926,12 @@ H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint, hid_t dxpl_id)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "can't create grp");
stab_init=1; /* Indicate that the symbol table information is valid */
+ /* Get the property list */
+ if (NULL == (gc_plist = H5I_object(gcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
+
/* insert child name into parent */
- if(H5G_insert(loc,name,&(grp->ent), dxpl_id)<0)
+ if(H5G_insert(loc,name,&(grp->ent), dxpl_id, gc_plist)<0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group");
/* Add group to list of open objects in file */
@@ -2219,12 +2350,17 @@ done:
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002
* Added `id to name' support.
*
+ * Peter Cao
+ * May 09, 2005
+ * Add flag 'crt_intmd_group' to support creating missing groups
+ *
*-------------------------------------------------------------------------
*/
herr_t
-H5G_insert(H5G_entry_t *loc, const char *name, H5G_entry_t *ent, hid_t dxpl_id)
+H5G_insert(H5G_entry_t *loc, const char *name, H5G_entry_t *ent, hid_t dxpl_id, H5P_genplist_t *oc_plist)
{
herr_t ret_value=SUCCEED; /* Return value */
+ unsigned target=H5G_TARGET_NORMAL;
FUNC_ENTER_NOAPI(H5G_insert, FAIL);
@@ -2233,10 +2369,21 @@ H5G_insert(H5G_entry_t *loc, const char *name, H5G_entry_t *ent, hid_t dxpl_id)
assert (name && *name);
assert (ent);
+ /* Check for intermediate group creation flag present */
+ if(oc_plist != NULL) {
+ unsigned crt_intmd_group;
+
+ if(H5P_get(oc_plist, H5G_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups");
+
+ if (crt_intmd_group > 0)
+ target |= H5G_CRT_INTMD_GROUP;
+ } /* end if */
+
/*
* Lookup and insert the name -- it shouldn't exist yet.
*/
- if (H5G_namei(loc, name, NULL, NULL, NULL, H5G_TARGET_NORMAL, NULL, H5G_NAMEI_INSERT, ent, dxpl_id)<0)
+ if (H5G_namei(loc, name, NULL, NULL, NULL, target, NULL, H5G_NAMEI_INSERT, ent, dxpl_id)<0)
HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "already exists");
/*
@@ -2547,7 +2694,7 @@ H5G_link (H5G_entry_t *cur_loc, const char *cur_name, H5G_entry_t *new_loc,
if (H5G_namei(cur_loc, norm_cur_name, NULL, NULL, &cur_obj, namei_flags, NULL, H5G_NAMEI_TRAVERSE, NULL, dxpl_id)<0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "source object not found");
cur_obj_init=1; /* Indicate that the cur_obj struct is initialized */
- if (H5G_insert (new_loc, norm_new_name, &cur_obj, dxpl_id)<0)
+ if (H5G_insert (new_loc, norm_new_name, &cur_obj, dxpl_id, 0)<0)
HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to create new name/link for object");
break;
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 47056d4..e190ba0 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -140,6 +140,8 @@ H5_DLL herr_t H5G_stab_find(H5G_entry_t *grp_ent, const char *name,
H5G_entry_t *obj_ent/*out*/, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_insert(H5G_entry_t *grp_ent, const char *name,
H5G_entry_t *obj_ent, hid_t dxpl_id);
+H5_DLL herr_t H5G_stab_insert_name(H5G_entry_t *loc, H5G_entry_t *obj,
+ const char *name);
H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, haddr_t btree_addr, haddr_t heap_addr);
H5_DLL herr_t H5G_stab_remove(H5G_entry_t *grp_ent, const char *name, hid_t dxpl_id);
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 61ddee4..ec83f3f 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -62,6 +62,13 @@
4 + /*reserved */ \
H5G_SIZEOF_SCRATCH) /*scratch pad space */
+/* ========= group Creation properties ============ */
+
+/* Definitions for creating intermediate groups */
+#define H5G_CRT_INTERMEDIATE_GROUP_NAME "intermediate_group"
+#define H5G_CRT_INTERMEDIATE_GROUP_SIZE sizeof(unsigned)
+#define H5G_CRT_INTERMEDIATE_GROUP_DEF 0
+
/*
* Various types of object header information can be cached in a symbol
* table entry (it's normal home is the object header to which the entry
@@ -132,6 +139,9 @@ typedef enum {
H5G_COPY_DEEP /* Deep copy from source to destination, including duplicating name & old name fields */
} H5G_ent_copy_depth_t;
+/* Forward declarations for prototype arguments */
+struct H5P_genplist_t;
+
/*
* Library prototypes... These are the ones that other packages routinely
* call.
@@ -148,7 +158,7 @@ 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);
H5_DLL herr_t H5G_insert(H5G_entry_t *loc, const char *name,
- H5G_entry_t *ent, hid_t dxpl_id);
+ H5G_entry_t *ent, hid_t dxpl_id, struct H5P_genplist_t *oc_plist);
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);
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index c907f5e..094a4a2 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -111,6 +111,8 @@ H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name,
const char *comment);
H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize,
char *buf);
+H5_DLL hid_t H5Gcreate_expand(hid_t loc_id, const char *name, size_t size_hint,
+ hid_t gcpl_id, hid_t gapl_id);
#ifdef __cplusplus
}
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 36e2119..01c439e 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -33,8 +33,6 @@
H5FL_BLK_EXTERN(str_buf);
/* Private prototypes */
-static herr_t H5G_insert_name(H5G_entry_t *loc, H5G_entry_t *obj,
- const char *name);
/*-------------------------------------------------------------------------
@@ -171,12 +169,12 @@ H5G_stab_find(H5G_entry_t *grp_ent, const char *name,
/* change OBJ_ENT only if found */
else {
if (obj_ent) {
- /* do a NULL copy, since the obj_ent name will be constructed in H5G_insert_name() */
+ /* do a NULL copy, since the obj_ent name will be constructed in H5G_stab_insert_name() */
if (H5G_ent_copy(obj_ent, &(udata.ent),H5G_COPY_NULL)<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to copy entry");
/* insert the name into the symbol entry OBJ_ENT */
- if (H5G_insert_name( grp_ent, obj_ent, name ) < 0)
+ if (H5G_stab_insert_name( grp_ent, obj_ent, name ) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name");
} /* end if */
} /* end else */
@@ -225,7 +223,7 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent, hi
HGOTO_ERROR(H5E_SYM, H5E_LINK, FAIL, "interfile hard links are not allowed");
/* insert the name into the symbol entry OBJ_ENT */
- if(H5G_insert_name(grp_ent, obj_ent, name) < 0)
+ if(H5G_stab_insert_name(grp_ent, obj_ent, name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name");
/* initialize data to pass through B-tree */
@@ -293,7 +291,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G_insert_name
+ * Function: H5G_stab_insert_name
*
* Purpose: Insert a name into the symbol entry OBJ, located at LOC
*
@@ -309,13 +307,13 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5G_insert_name(H5G_entry_t *loc, H5G_entry_t *obj, const char *name)
+herr_t
+H5G_stab_insert_name(H5G_entry_t *loc, H5G_entry_t *obj, const char *name)
{
size_t name_len; /* Length of name to append */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT(H5G_insert_name);
+ FUNC_ENTER_NOAPI_NOINIT(H5G_stab_insert_name);
assert(loc);
assert(obj);
diff --git a/src/H5P.c b/src/H5P.c
index fc3359f..014f226 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -43,11 +43,17 @@
* H5P_init_interface() in this source file.
*/
hid_t H5P_CLS_NO_CLASS_g = FAIL;
+hid_t H5P_CLS_OBJ_CLASS_g = FAIL;
hid_t H5P_CLS_FILE_CREATE_g = FAIL;
hid_t H5P_CLS_FILE_ACCESS_g = FAIL;
hid_t H5P_CLS_DATASET_CREATE_g = FAIL;
+hid_t H5P_CLS_DATASET_ACCESS_g = FAIL;
hid_t H5P_CLS_DATASET_XFER_g = FAIL;
hid_t H5P_CLS_MOUNT_g = FAIL;
+hid_t H5P_CLS_GROUP_CREATE_g = FAIL;
+hid_t H5P_CLS_GROUP_ACCESS_g = FAIL;
+hid_t H5P_CLS_DATATYPE_CREATE_g = FAIL;
+hid_t H5P_CLS_DATATYPE_ACCESS_g = FAIL;
/*
* Predefined property lists for each predefined class. These are initialized
@@ -57,8 +63,13 @@ hid_t H5P_LST_NO_CLASS_g = FAIL;
hid_t H5P_LST_FILE_CREATE_g = FAIL;
hid_t H5P_LST_FILE_ACCESS_g = FAIL;
hid_t H5P_LST_DATASET_CREATE_g = FAIL;
+hid_t H5P_LST_DATASET_ACCESS_g = FAIL;
hid_t H5P_LST_DATASET_XFER_g = FAIL;
hid_t H5P_LST_MOUNT_g = FAIL;
+hid_t H5P_LST_GROUP_CREATE_g = FAIL;
+hid_t H5P_LST_GROUP_ACCESS_g = FAIL;
+hid_t H5P_LST_DATATYPE_CREATE_g = FAIL;
+hid_t H5P_LST_DATATYPE_ACCESS_g = FAIL;
/* Track the revision count of a class, to make comparisons faster */
static unsigned H5P_next_rev=0;
@@ -201,13 +212,25 @@ RETURNS
DESCRIPTION
Initializes any interface-specific data or routines.
+Modification:
+
+ Peter Cao
+ May 08, 2005
+ Add Group creation property, Add object creation property class.
+ group, dataset and datatype creation property classes are inherited from
+ the object creation property class
+
--------------------------------------------------------------------------*/
static herr_t
H5P_init_interface(void)
{
H5P_genclass_t *root_class; /* Pointer to root property list class created */
+ H5P_genclass_t *obj_class; /* Pointer to object(dataset, group, or datatype) property list class created */
H5P_genclass_t *pclass; /* Pointer to property list class to create */
herr_t ret_value = SUCCEED;
+ unsigned intmd_group = H5G_CRT_INTERMEDIATE_GROUP_DEF;
+ size_t nprops; /* Number of properties */
+
FUNC_ENTER_NOAPI_NOINIT(H5P_init_interface);
@@ -230,6 +253,29 @@ H5P_init_interface(void)
if ((H5P_CLS_NO_CLASS_g = H5I_register (H5I_GENPROP_CLS, root_class))<0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
+ /* Create object property class */
+
+ /* Allocate the object class */
+ assert(H5P_CLS_OBJ_CLASS_g==(-1));
+ if (NULL==(obj_class = H5P_create_class (root_class,"object",1,NULL,NULL,NULL,NULL,NULL,NULL)))
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed");
+
+ /* Register the object class */
+ if ((H5P_CLS_OBJ_CLASS_g = H5I_register (H5I_GENPROP_CLS, obj_class))<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
+
+ /* Get the number of properties in the object class */
+ if(H5P_get_nprops_pclass(obj_class,&nprops,FALSE)<0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties")
+
+ /* Assume that if there are properties in the class, they are the default ones */
+ if(nprops==0) {
+ /* register create intermediate groups */
+ if(H5P_register(obj_class,H5G_CRT_INTERMEDIATE_GROUP_NAME,H5G_CRT_INTERMEDIATE_GROUP_SIZE,
+ &intmd_group,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ }
+
/* Register the file creation and file access property classes */
/* Allocate the file creation class */
@@ -250,17 +296,26 @@ H5P_init_interface(void)
if ((H5P_CLS_FILE_ACCESS_g = H5I_register (H5I_GENPROP_CLS, pclass))<0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
- /* Register the dataset creation and data xfer property classes */
+ /* Register the dataset creation, dataset access and data xfer property classes */
/* Allocate the dataset creation class */
assert(H5P_CLS_DATASET_CREATE_g==(-1));
- if (NULL==(pclass = H5P_create_class (root_class,"dataset create",1,NULL,NULL,H5D_crt_copy,NULL,H5D_crt_close,NULL)))
+ if (NULL==(pclass = H5P_create_class (obj_class,"dataset create",1,NULL,NULL,H5D_crt_copy,NULL,H5D_crt_close,NULL)))
HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed");
/* Register the dataset creation class */
if ((H5P_CLS_DATASET_CREATE_g = H5I_register (H5I_GENPROP_CLS, pclass))<0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
+ /* Allocate the dataset access class */
+ assert(H5P_CLS_DATASET_ACCESS_g==(-1));
+ if (NULL==(pclass = H5P_create_class (root_class,"dataset access",1,NULL,NULL,NULL,NULL,NULL,NULL)))
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed");
+
+ /* Register the dataset access class */
+ if ((H5P_CLS_DATASET_ACCESS_g = H5I_register (H5I_GENPROP_CLS, pclass))<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
+
/* Allocate the data xfer class */
assert(H5P_CLS_DATASET_XFER_g==(-1));
if (NULL==(pclass = H5P_create_class (root_class,"data xfer",1,H5D_xfer_create,NULL,H5D_xfer_copy,NULL,H5D_xfer_close,NULL)))
@@ -279,6 +334,45 @@ H5P_init_interface(void)
if ((H5P_CLS_MOUNT_g = H5I_register (H5I_GENPROP_CLS, pclass))<0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
+
+ /* added by Peter Cao. To create missing groups. May 08, 2005 */
+
+ /* Allocate the group creation class */
+ assert(H5P_CLS_GROUP_CREATE_g==(-1));
+ if (NULL==(pclass = H5P_create_class (obj_class,"group create",1,NULL,NULL,NULL,NULL,NULL,NULL)))
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed");
+
+ /* Register the group creation class */
+ if ((H5P_CLS_GROUP_CREATE_g = H5I_register (H5I_GENPROP_CLS, pclass))<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
+
+ /* Allocate the group access class */
+ assert(H5P_CLS_GROUP_ACCESS_g==(-1));
+ if (NULL==(pclass = H5P_create_class (root_class,"group access",1,NULL,NULL,NULL,NULL,NULL,NULL)))
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed");
+
+ /* Register the group access class */
+ if ((H5P_CLS_GROUP_ACCESS_g = H5I_register (H5I_GENPROP_CLS, pclass))<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
+
+ /* Allocate the datatype creation class */
+ assert(H5P_CLS_DATATYPE_CREATE_g==(-1));
+ if (NULL==(pclass = H5P_create_class (obj_class,"datatype create",1,NULL,NULL,NULL,NULL,NULL,NULL)))
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed");
+
+ /* Register the datatype creation class */
+ if ((H5P_CLS_DATATYPE_CREATE_g = H5I_register (H5I_GENPROP_CLS, pclass))<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
+
+ /* Allocate the datatype access class */
+ assert(H5P_CLS_DATATYPE_ACCESS_g==(-1));
+ if (NULL==(pclass = H5P_create_class (root_class,"datatype access",1,NULL /*H5T_acs_create*/,NULL,NULL /*H5T_acs_copy*/,NULL,NULL /*H5T_acs_close*/,NULL)))
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed");
+
+ /* Register the datatype access class */
+ if ((H5P_CLS_DATATYPE_ACCESS_g = H5I_register (H5I_GENPROP_CLS, pclass))<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
+
done:
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -330,7 +424,12 @@ H5P_term_interface(void)
H5P_LST_FILE_CREATE_g =
H5P_LST_FILE_ACCESS_g =
H5P_LST_DATASET_CREATE_g =
+ H5P_LST_DATASET_ACCESS_g =
H5P_LST_DATASET_XFER_g =
+ H5P_LST_GROUP_CREATE_g =
+ H5P_LST_GROUP_ACCESS_g =
+ H5P_LST_DATATYPE_CREATE_g =
+ H5P_LST_DATATYPE_ACCESS_g =
H5P_LST_MOUNT_g = (-1);
} /* end if */
} /* end if */
@@ -341,11 +440,17 @@ H5P_term_interface(void)
/* Reset the default property lists, if they've been closed */
if(H5I_nmembers(H5I_GENPROP_CLS)==0) {
- H5P_CLS_NO_CLASS_g =
+ H5P_CLS_NO_CLASS_g =
+ H5P_CLS_OBJ_CLASS_g =
H5P_CLS_FILE_CREATE_g =
H5P_CLS_FILE_ACCESS_g =
H5P_CLS_DATASET_CREATE_g =
+ H5P_CLS_DATASET_ACCESS_g =
H5P_CLS_DATASET_XFER_g =
+ H5P_CLS_GROUP_CREATE_g =
+ H5P_CLS_GROUP_ACCESS_g =
+ H5P_CLS_DATATYPE_CREATE_g =
+ H5P_CLS_DATATYPE_ACCESS_g =
H5P_CLS_MOUNT_g = (-1);
} /* end if */
} /* end if */
@@ -3243,11 +3348,12 @@ H5P_get_nprops_plist(H5P_genplist_t *plist, size_t *nprops)
herr_t H5P_get_nprops_pclass(pclass, nprops)
H5P_genclass_t *pclass; IN: Property class to check
size_t *nprops; OUT: Number of properties in the property list
+ hbool_t recurse; IN: Include properties in parent class(es) also
RETURNS
- Success: non-negative value
+ Success: non-negative value (can't fail)
Failure: negative value
DESCRIPTION
- This routine retrieves the number of a properties in a property class.
+ This routine retrieves the number of a properties in a property class.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
@@ -3255,20 +3361,27 @@ H5P_get_nprops_plist(H5P_genplist_t *plist, size_t *nprops)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5P_get_nprops_pclass(H5P_genclass_t *pclass, size_t *nprops)
+H5P_get_nprops_pclass(H5P_genclass_t *pclass, size_t *nprops, hbool_t recurse)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5P_get_nprops_pclass, FAIL);
+ FUNC_ENTER_NOAPI(H5P_get_nprops_pclass, FAIL)
assert(pclass);
assert(nprops);
- /* Get property size */
+ /* Get number of properties */
*nprops=pclass->nprops;
+ /* Check if the class is derived, and walk up the chain, if so */
+ if(recurse)
+ while(pclass->parent!=NULL) {
+ pclass = pclass->parent;
+ *nprops += pclass->nprops;
+ } /* end while */
+
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5P_get_nprops_pclass() */
@@ -3321,7 +3434,7 @@ H5Pget_nprops(hid_t id, size_t *nprops)
if(H5I_GENPROP_CLS == H5I_get_type(id)) {
if (NULL == (pclass = H5I_object(id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class");
- if (H5P_get_nprops_pclass(pclass,nprops)<0)
+ if (H5P_get_nprops_pclass(pclass,nprops,FALSE)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query # of properties in pclass");
} /* end if */
else
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
new file mode 100755
index 0000000..e0f7da7
--- /dev/null
+++ b/src/H5Pocpl.c
@@ -0,0 +1,94 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#define H5P_PACKAGE /*suppress error about including H5Ppkg */
+
+/* Private header files */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Ppkg.h" /* Property lists */
+
+/* Local datatypes */
+
+/* Static function prototypes */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_create_intermediate_group
+ *
+ * Purpose: set crt_intmd_group so that H5Gcreate(), H5Dcreate, etc.
+ * will create missing groups along the given path "name"
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Peter Cao
+ * May 08, 2005
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd_group)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pset_create_intermediate_group, FAIL);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
+
+ /* Set value */
+ crt_intmd_group = crt_intmd_group > 0 ? 1 : 0;
+ if(H5P_set(plist, H5G_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set intermediate group creation flag")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_create_intermediate_group() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_create_intermediate_group
+ *
+ * Purpose: Returns the crt_intmd_group, which is set at H5Gcreate(hid_t loc_id,
+ * const char* name, ... ) for create missing groups
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Peter Cao
+ * May 08, 2005
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd_group /*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_create_intermediate_group, FAIL);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID")
+
+ /* Get values */
+ if (crt_intmd_group)
+ if(H5P_get(plist, H5G_CRT_INTERMEDIATE_GROUP_NAME, crt_intmd_group) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get intermediate group creation flag")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_create_intermediate_group() */
+
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 69990e3..0d09b96 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -45,7 +45,7 @@ H5_DLL herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size,
H5_DLL herr_t H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name);
H5_DLL htri_t H5P_exist_plist(H5P_genplist_t *plist, const char *name);
H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass);
-H5_DLL herr_t H5P_get_nprops_pclass(H5P_genclass_t *pclass, size_t *nprops);
+H5_DLL herr_t H5P_get_nprops_pclass(H5P_genclass_t *pclass, size_t *nprops, hbool_t recurse);
H5_DLL herr_t H5P_register(H5P_genclass_t *pclass, const char *name, size_t size,
void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set,
H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete,
@@ -58,7 +58,7 @@ H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id,
H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist,
H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func,
void *free_info);
-H5_DLL herr_t H5P_is_fill_value_defined(const struct H5O_fill_t *fill,
+H5_DLL herr_t H5P_is_fill_value_defined(const H5O_fill_t *fill,
H5D_fill_value_t *status);
/* *SPECIAL* Don't make more of these! -QAK */
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index be2f2ee..49d8288 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -84,14 +84,24 @@ typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data);
#define H5P_FILE_CREATE (H5OPEN H5P_CLS_FILE_CREATE_g)
#define H5P_FILE_ACCESS (H5OPEN H5P_CLS_FILE_ACCESS_g)
#define H5P_DATASET_CREATE (H5OPEN H5P_CLS_DATASET_CREATE_g)
+#define H5P_DATASET_ACCESS (H5OPEN H5P_CLS_DATASET_ACCESS_g)
#define H5P_DATASET_XFER (H5OPEN H5P_CLS_DATASET_XFER_g)
#define H5P_MOUNT (H5OPEN H5P_CLS_MOUNT_g)
+#define H5P_GROUP_CREATE (H5OPEN H5P_CLS_GROUP_CREATE_g)
+#define H5P_GROUP_ACCESS (H5OPEN H5P_CLS_GROUP_ACCESS_g)
+#define H5P_DATATYPE_CREATE (H5OPEN H5P_CLS_DATATYPE_CREATE_g)
+#define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_g)
H5_DLLVAR hid_t H5P_CLS_NO_CLASS_g;
H5_DLLVAR hid_t H5P_CLS_FILE_CREATE_g;
H5_DLLVAR hid_t H5P_CLS_FILE_ACCESS_g;
H5_DLLVAR hid_t H5P_CLS_DATASET_CREATE_g;
+H5_DLLVAR hid_t H5P_CLS_DATASET_ACCESS_g;
H5_DLLVAR hid_t H5P_CLS_DATASET_XFER_g;
H5_DLLVAR hid_t H5P_CLS_MOUNT_g;
+H5_DLLVAR hid_t H5P_CLS_GROUP_CREATE_g;
+H5_DLLVAR hid_t H5P_CLS_GROUP_ACCESS_g;
+H5_DLLVAR hid_t H5P_CLS_DATATYPE_CREATE_g;
+H5_DLLVAR hid_t H5P_CLS_DATATYPE_ACCESS_g;
/*
* The library created default property lists
@@ -100,17 +110,28 @@ H5_DLLVAR hid_t H5P_CLS_MOUNT_g;
*
*/
#define H5P_NO_CLASS_DEFAULT (H5OPEN H5P_LST_NO_CLASS_g)
+#define H5P_OBJ_CLASS_DEFAULT (H5OPEN H5P_LST_OBJ_CLASS_g)
#define H5P_FILE_CREATE_DEFAULT (H5OPEN H5P_LST_FILE_CREATE_g)
#define H5P_FILE_ACCESS_DEFAULT (H5OPEN H5P_LST_FILE_ACCESS_g)
#define H5P_DATASET_CREATE_DEFAULT (H5OPEN H5P_LST_DATASET_CREATE_g)
+#define H5P_DATASET_ACCESS_DEFAULT (H5OPEN H5P_LST_DATASET_ACCESS_g)
#define H5P_DATASET_XFER_DEFAULT (H5OPEN H5P_LST_DATASET_XFER_g)
#define H5P_MOUNT_DEFAULT (H5OPEN H5P_LST_MOUNT_g)
+#define H5P_GROUP_CREATE_DEFAULT (H5OPEN H5P_LST_GROUP_CREATE_g)
+#define H5P_GROUP_ACCESS_DEFAULT (H5OPEN H5P_LST_GROUP_ACCESS_g)
+#define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_g)
+#define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_g)
H5_DLLVAR hid_t H5P_LST_NO_CLASS_g;
H5_DLLVAR hid_t H5P_LST_FILE_CREATE_g;
H5_DLLVAR hid_t H5P_LST_FILE_ACCESS_g;
H5_DLLVAR hid_t H5P_LST_DATASET_CREATE_g;
+H5_DLLVAR hid_t H5P_LST_DATASET_ACCESS_g;
H5_DLLVAR hid_t H5P_LST_DATASET_XFER_g;
H5_DLLVAR hid_t H5P_LST_MOUNT_g;
+H5_DLLVAR hid_t H5P_LST_GROUP_CREATE_g;
+H5_DLLVAR hid_t H5P_LST_GROUP_ACCESS_g;
+H5_DLLVAR hid_t H5P_LST_DATATYPE_CREATE_g;
+H5_DLLVAR hid_t H5P_LST_DATATYPE_ACCESS_g;
/* Public functions */
H5_DLL hid_t H5Pcreate_class(hid_t parent, const char *name,
@@ -306,6 +327,9 @@ H5_DLL herr_t H5Premove_filter(hid_t plist_id, H5Z_filter_t filter);
H5_DLL herr_t H5Pset_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t op, void* operate_data);
H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, void** operate_data);
+H5_DLL herr_t H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd);
+H5_DLL herr_t H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd /*out*/);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/H5T.c b/src/H5T.c
index d4dd9f3..d5b8cc8 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -699,6 +699,7 @@ H5T_init_interface(void)
hsize_t dim[1]={1}; /* Dimension info for array datatype */
herr_t status;
unsigned copied_dtype=1; /* Flag to indicate whether datatype was copied or allocated (for error cleanup) */
+ H5P_genclass_t *crt_pclass; /* Property list class for datatype creation properties */
herr_t ret_value=SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5T_init_interface);
@@ -1258,6 +1259,24 @@ H5T_init_interface(void)
if (status<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function(s)");
+ /* ========== Datatype Creation Property Class Initialization ============*/
+ assert(H5P_CLS_DATATYPE_CREATE_g!=-1);
+
+ /* Get the pointer to group creation class */
+ if(NULL == (crt_pclass = H5I_object(H5P_CLS_DATATYPE_CREATE_g)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class")
+
+ /* Register datatype creation property class properties here. See similar
+ * code in H5D_init_interface(), etc. for example.
+ */
+
+ /* Only register the default property list if it hasn't been created yet */
+ if(H5P_LST_DATATYPE_CREATE_g==(-1)) {
+ /* Register the default datatype creation property list */
+ if((H5P_LST_DATATYPE_CREATE_g = H5P_create_id(crt_pclass))<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class")
+ } /* end if */
+
done:
/* General cleanup */
if (compound!=NULL)
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 9732dde..fceec6d 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -28,10 +28,12 @@
#include "H5FOprivate.h" /* File objects */
#include "H5Iprivate.h" /* IDs */
#include "H5Oprivate.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
#include "H5Tpkg.h" /* Datatypes */
/* Static local functions */
-static herr_t H5T_commit(H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id);
+static herr_t H5T_commit(H5G_entry_t *loc, const char *name, H5T_t *type,
+ hid_t dxpl_id, hid_t tcpl_id, hid_t tapl_id);
/*--------------------------------------------------------------------------
@@ -90,7 +92,66 @@ H5Tcommit(hid_t loc_id, const char *name, hid_t type_id)
HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Commit the type */
- if (H5T_commit (loc, name, type, H5AC_dxpl_id)<0)
+ if (H5T_commit(loc, name, type, H5AC_dxpl_id, H5P_DATATYPE_CREATE_DEFAULT,
+ H5P_DEFAULT)<0)
+ HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Tcommit_expand
+ *
+ * Purpose: Save a transient datatype to a file and turn the type handle
+ * into a named, immutable type.
+ * Add property to create missing groups along the path.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Peter Cao
+ * May 17, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Tcommit_expand(hid_t loc_id, const char *name, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
+{
+ H5G_entry_t *loc = NULL;
+ H5T_t *type = NULL;
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Tcommit_expand, FAIL)
+
+ /* Check arguments */
+ if (NULL==(loc=H5G_loc (loc_id)))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if (!name || !*name)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if (NULL==(type=H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
+ /* Get correct property list */
+ if(H5P_DEFAULT == tcpl_id)
+ tcpl_id = H5P_DATATYPE_CREATE_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not datatype create property list")
+
+#ifdef LATER
+ /* Get correct property list */
+ if(H5P_DEFAULT == tcpl_id)
+ tapl_id = H5P_DATATYPE_ACCESS_DEFAULT;
+ else
+ if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not datatype access property list")
+#endif /* LATER */
+
+ /* Commit the type */
+ if (H5T_commit(loc, name, type, H5AC_dxpl_id, tcpl_id, tapl_id)<0)
HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
done:
@@ -110,20 +171,29 @@ done:
* Monday, June 1, 1998
*
* Modifications:
+ * Added datatype creation & access property lists
+ * Peter Cao
+ * May 17, 2005
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id)
+H5T_commit(H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id,
+ hid_t tcpl_id, hid_t UNUSED tapl_id)
{
H5F_t *file = NULL;
- herr_t ret_value=SUCCEED; /* Return value */
+ H5P_genplist_t *tc_plist; /* Property list created */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5T_commit)
HDassert (loc);
HDassert (name && *name);
HDassert (type);
+ HDassert (tcpl_id != H5P_DEFAULT);
+#ifdef LATER
+ HDassert (tapl_id != H5P_DEFAULT);
+#endif /* LATER */
/*
* Check arguments. We cannot commit an immutable type because H5Tclose()
@@ -156,8 +226,14 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id)
HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header")
if (H5O_modify (&(type->ent), H5O_DTYPE_ID, 0, H5O_FLAG_CONSTANT, H5O_UPDATE_TIME, type, dxpl_id)<0)
HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message")
- if (H5G_insert (loc, name, &(type->ent), dxpl_id)<0)
+
+ /* Get the property list */
+ if (NULL == (tc_plist = H5I_object(tcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
+
+ if (H5G_insert (loc, name, &(type->ent), dxpl_id, tc_plist)<0)
HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to name datatype")
+
type->shared->state = H5T_STATE_OPEN;
type->shared->fo_count=1;
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index a6feb73..1971b8f 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -491,6 +491,7 @@ H5_DLL herr_t H5Tclose(hid_t type_id);
H5_DLL htri_t H5Tequal(hid_t type1_id, hid_t type2_id);
H5_DLL herr_t H5Tlock(hid_t type_id);
H5_DLL herr_t H5Tcommit(hid_t loc_id, const char *name, hid_t type_id);
+H5_DLL herr_t H5Tcommit_expand(hid_t loc_id, const char *name, hid_t type_id, hid_t tcpl_id, hid_t tapl_id);
H5_DLL htri_t H5Tcommitted(hid_t type_id);
H5_DLL herr_t H5Tencode(hid_t obj_id, void *buf, size_t *nalloc);
H5_DLL hid_t H5Tdecode(const void *buf);
diff --git a/src/Makefile.am b/src/Makefile.am
index ec21d50..c09c07c 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -58,7 +58,8 @@ libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
H5Oattr.c H5Obogus.c \
H5Ocont.c H5Odtype.c H5Oefl.c H5Ofill.c H5Olayout.c H5Omtime.c \
H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \
- H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Ptest.c H5R.c H5RC.c \
+ H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pocpl.c H5Ptest.c \
+ H5R.c H5RC.c \
H5RS.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \
H5Sselect.c H5Stest.c H5SH.c H5SHcache.c H5SHdbg.c \
H5SL.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 6b35caf..d0cb452 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -96,15 +96,15 @@ am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5B2.lo \
H5Oattr.lo H5Obogus.lo H5Ocont.lo H5Odtype.lo H5Oefl.lo \
H5Ofill.lo H5Olayout.lo H5Omtime.lo H5Oname.lo H5Onull.lo \
H5Opline.lo H5Osdspace.lo H5Oshared.lo H5Ostab.lo H5P.lo \
- H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo H5Ptest.lo H5R.lo \
- H5RC.lo H5RS.lo H5S.lo H5Sall.lo H5Shyper.lo H5Smpio.lo \
- H5Snone.lo H5Spoint.lo H5Sselect.lo H5Stest.lo H5SH.lo \
- H5SHcache.lo H5SHdbg.lo H5SL.lo H5ST.lo H5T.lo H5Tarray.lo \
- H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo H5Tcset.lo \
- H5Tenum.lo H5Tfields.lo H5Tfixed.lo H5Tfloat.lo H5Tinit.lo \
- H5Tnative.lo H5Toffset.lo H5Topaque.lo H5Torder.lo H5Tpad.lo \
- H5Tprecis.lo H5Tstrpad.lo H5Tvlen.lo H5TS.lo H5V.lo H5Z.lo \
- H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \
+ H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo H5Pocpl.lo \
+ H5Ptest.lo H5R.lo H5RC.lo H5RS.lo H5S.lo H5Sall.lo H5Shyper.lo \
+ H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo H5Stest.lo \
+ H5SH.lo H5SHcache.lo H5SHdbg.lo H5SL.lo H5ST.lo H5T.lo \
+ H5Tarray.lo H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo \
+ H5Tcset.lo H5Tenum.lo H5Tfields.lo H5Tfixed.lo H5Tfloat.lo \
+ H5Tinit.lo H5Tnative.lo H5Toffset.lo H5Topaque.lo H5Torder.lo \
+ H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo H5Tvlen.lo H5TS.lo H5V.lo \
+ H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \
H5Zszip.lo H5Zscaleoffset.lo H5Ztrans.lo
libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS)
PROGRAMS = $(noinst_PROGRAMS)
@@ -375,7 +375,8 @@ libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
H5Oattr.c H5Obogus.c \
H5Ocont.c H5Odtype.c H5Oefl.c H5Ofill.c H5Olayout.c H5Omtime.c \
H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \
- H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Ptest.c H5R.c H5RC.c \
+ H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pocpl.c H5Ptest.c \
+ H5R.c H5RC.c \
H5RS.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \
H5Sselect.c H5Stest.c H5SH.c H5SHcache.c H5SHdbg.c \
H5SL.c H5ST.c H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c \
@@ -591,6 +592,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pdxpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfapl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfcpl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pocpl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ptest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5R.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5RC.Plo@am__quote@
diff --git a/test/tmisc.c b/test/tmisc.c
index 1558639..84fd88a 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -245,7 +245,7 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset
#define MISC21_CHUNK_DIM0 2048
#define MISC21_CHUNK_DIM1 2048
-/* Definitions for misc. test #21 */
+/* Definitions for misc. test #22 */
#define MISC22_FILE "tmisc22.h5"
#define MISC22_DSET_NAME "Dataset"
#define MISC22_SPACE_RANK 2
@@ -254,6 +254,9 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset
#define MISC22_SPACE_DIM0 639
#define MISC22_SPACE_DIM1 1308
+/* Definitions for misc. test #23 */
+#define MISC23_FILE "tmisc23.h5"
+
/****************************************************************
**
** test_misc1(): test unlinking a dataset from a group and immediately
@@ -3705,6 +3708,239 @@ test_misc22(void)
/****************************************************************
**
+** test_misc23(): Test intermediate group creation.
+**
+****************************************************************/
+static void
+test_misc23(void)
+{
+ herr_t status;
+ hsize_t dims[] = {10};
+ hid_t file_id=0, group_id=0, type_id=0, space_id=0,
+ tmp_id=0, create_id=H5P_DEFAULT, access_id=H5P_DEFAULT;
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing intermediate group creation\n"));
+
+ /* Create a new file using default properties. */
+ file_id = H5Fcreate(MISC23_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(file_id, FAIL, "H5Fcreate");
+
+
+ /* Build some infrastructure */
+ group_id = H5Gcreate(file_id, "/A", 0);
+ CHECK(group_id, FAIL, "H5Gcreate");
+
+ space_id = H5Screate_simple(1, dims, NULL);
+ CHECK(space_id, FAIL, "H5Screate_simple");
+
+ type_id = H5Tcopy( H5T_STD_I32BE);
+ CHECK(type_id, FAIL, "H5Tcopy");
+
+
+ /**********************************************************************
+ * test the old APIs
+ **********************************************************************/
+
+ H5E_BEGIN_TRY {
+ tmp_id = H5Gcreate(file_id, "/A/B00a/grp", 0);
+ } H5E_END_TRY;
+ VERIFY(tmp_id, FAIL, "H5Gcreate");
+
+
+ tmp_id = H5Gcreate(file_id, "/A/grp", 0);
+ CHECK(tmp_id, FAIL, "H5Gcreate");
+
+ status = H5Gclose(tmp_id);
+ CHECK(status, FAIL, "H5Gclose");
+
+
+ H5E_BEGIN_TRY {
+ tmp_id = H5Dcreate(file_id, "/A/B00c/dset", type_id, space_id, create_id);
+ } H5E_END_TRY;
+ VERIFY(tmp_id, FAIL, "H5Dcreate");
+
+
+ tmp_id = H5Dcreate(file_id, "/A/dset", type_id, space_id, create_id);
+ CHECK(tmp_id, FAIL, "H5Dcreate");
+
+ status = H5Dclose(tmp_id);
+ CHECK(status, FAIL, "H5Dclose");
+
+ /**********************************************************************
+ * test H5Gcreate_expand()
+ **********************************************************************/
+
+ /* Create group creation property list */
+ create_id = H5Pcreate(H5P_GROUP_CREATE);
+ CHECK(create_id, FAIL, "H5Pcreate");
+
+ /* Set flag for intermediate group creation */
+ status = H5Pset_create_intermediate_group(create_id, TRUE);
+ CHECK(status, FAIL, "H5Pset_create_intermediate_group");
+
+
+ tmp_id = H5Gcreate_expand(file_id, "/A/B01/grp", 0, create_id, access_id);
+ CHECK(tmp_id, FAIL, "H5Gcreate_expand");
+
+ status = H5Gclose(tmp_id);
+ CHECK(status, FAIL, "H5Gclose");
+
+
+ tmp_id = H5Gcreate_expand(file_id, "/A/B02/C02/grp", 0, create_id, access_id);
+ CHECK(tmp_id, FAIL, "H5Gcreate_expand");
+
+ status = H5Gclose(tmp_id);
+ CHECK(status, FAIL, "H5Gclose");
+
+
+ tmp_id = H5Gcreate_expand(group_id, "B03/grp/", 0, create_id, access_id);
+ CHECK(tmp_id, FAIL, "H5Gcreate_expand");
+
+ status = H5Gclose(tmp_id);
+ CHECK(status, FAIL, "H5Gclose");
+
+
+ if ( (tmp_id = H5Gcreate_expand(group_id, "/A/B04/grp/", 0, create_id, access_id)) < 0)
+ CHECK(tmp_id, FAIL, "H5Gcreate_expand");
+
+ status = H5Gclose(tmp_id);
+ CHECK(status, FAIL, "H5Gclose");
+
+
+ if ( (tmp_id = H5Gcreate_expand(file_id, "/A/B05/C05/A", 0, create_id, access_id)) < 0)
+ CHECK(tmp_id, FAIL, "H5Gcreate_expand");
+
+ status = H5Gclose(tmp_id);
+ CHECK(status, FAIL, "H5Gclose");
+
+
+ status = H5Pclose(create_id);
+ CHECK(status, FAIL, "H5Pclose");
+
+
+ /**********************************************************************
+ * test new H5Dcreate
+ **********************************************************************/
+
+ /* Create dataset creation property list */
+ create_id = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(create_id, FAIL, "H5Pcreate");
+
+ /* Set flag for intermediate group creation */
+ status = H5Pset_create_intermediate_group(create_id, TRUE);
+ CHECK(status, FAIL, "H5Pset_create_intermediate_group");
+
+
+ tmp_id = H5Dcreate(file_id, "/A/B06/dset", type_id, space_id, create_id);
+ CHECK(tmp_id, FAIL, "H5Dcreate");
+
+ status = H5Dclose(tmp_id);
+ CHECK(status, FAIL, "H5Dclose");
+
+
+ tmp_id = H5Dcreate(file_id, "/A/B07/B07/dset", type_id, space_id, create_id);
+ CHECK(tmp_id, FAIL, "H5Dcreate");
+
+ status = H5Dclose(tmp_id);
+ CHECK(status, FAIL, "H5Dclose");
+
+
+ tmp_id = H5Dcreate(group_id, "B08/dset", type_id, space_id, create_id);
+ CHECK(tmp_id, FAIL, "H5Dcreate");
+
+ status = H5Dclose(tmp_id);
+ CHECK(status, FAIL, "H5Dclose");
+
+
+ tmp_id = H5Dcreate(group_id, "/A/B09/dset", type_id, space_id, create_id);
+ CHECK(tmp_id, FAIL, "H5Dcreate");
+
+ status = H5Dclose(tmp_id);
+ CHECK(status, FAIL, "H5Dclose");
+
+
+ tmp_id = H5Dcreate(file_id, "/A/B10/C10/A/dset", type_id, space_id, create_id);
+ CHECK(tmp_id, FAIL, "H5Dcreate");
+
+ status = H5Dclose(tmp_id);
+ CHECK(status, FAIL, "H5Dclose");
+
+
+ status = H5Pclose(create_id);
+ CHECK(status, FAIL, "H5Pclose");
+
+
+ /**********************************************************************
+ * test new H5Tcommit
+ **********************************************************************/
+
+ /* Create datatype creation property list */
+ create_id = H5Pcreate(H5P_DATATYPE_CREATE);
+ CHECK(create_id, FAIL, "H5Pcreate");
+
+ /* Set flag for intermediate group creation */
+ status = H5Pset_create_intermediate_group(create_id, TRUE);
+ CHECK(status, FAIL, "H5Pset_create_intermediate_group");
+
+
+ tmp_id = H5Tcopy(H5T_NATIVE_INT16);
+ CHECK(tmp_id, FAIL, "H5Tcopy");
+
+ status = H5Tcommit_expand(file_id, "/A/B11/dtype", tmp_id, create_id, access_id);
+ CHECK(status, FAIL, "H5Tcommit_expand");
+
+ status = H5Tclose(tmp_id);
+ CHECK(status, FAIL, "H5Tclose");
+
+
+ tmp_id = H5Tcopy(H5T_NATIVE_INT32);
+ CHECK(tmp_id, FAIL, "H5Tcopy");
+
+ status = H5Tcommit_expand(file_id, "/A/B12/C12/dtype", tmp_id, create_id, access_id);
+ CHECK(status, FAIL, "H5Tcommit_expand");
+
+ status = H5Tclose(tmp_id);
+ CHECK(status, FAIL, "H5Tclose");
+
+
+ tmp_id = H5Tcopy(H5T_NATIVE_INT64);
+ CHECK(tmp_id, FAIL, "H5Tcopy");
+
+ status = H5Tcommit_expand(group_id, "B13/dtype", tmp_id, create_id, access_id);
+ CHECK(status, FAIL, "H5Tcommit_expand");
+
+ status = H5Tclose(tmp_id);
+ CHECK(status, FAIL, "H5Tclose");
+
+
+ tmp_id = H5Tcopy(H5T_NATIVE_FLOAT);
+ CHECK(tmp_id, FAIL, "H5Tcopy");
+
+ status = H5Tcommit_expand(group_id, "/A/B14/dtype", tmp_id, create_id, access_id);
+ CHECK(status, FAIL, "H5Tcommit_expand");
+
+ status = H5Tclose(tmp_id);
+ CHECK(status, FAIL, "H5Tclose");
+
+
+ tmp_id = H5Tcopy(H5T_NATIVE_DOUBLE);
+ CHECK(tmp_id, FAIL, "H5Tcopy");
+
+ status = H5Tcommit_expand(file_id, "/A/B15/C15/A/dtype", tmp_id, create_id, access_id);
+ CHECK(status, FAIL, "H5Tcommit_expand");
+
+ status = H5Tclose(tmp_id);
+ CHECK(status, FAIL, "H5Tclose");
+
+
+ status = H5Pclose(create_id);
+ CHECK(status, FAIL, "H5Pclose");
+
+} /* end test_misc23() */
+
+/****************************************************************
+**
** test_misc(): Main misc. test routine.
**
****************************************************************/
@@ -3738,6 +3974,7 @@ test_misc(void)
test_misc21(); /* Test that "late" allocation time is treated the same as "incremental", for chunked datasets w/a filters */
test_misc22(); /* check szip bits per pixel */
#endif /* H5_HAVE_FILTER_SZIP */
+ test_misc23(); /* Test intermediate group creation */
} /* test_misc() */
@@ -3786,5 +4023,6 @@ cleanup_misc(void)
HDremove(MISC21_FILE);
HDremove(MISC22_FILE);
#endif /* H5_HAVE_FILTER_SZIP */
+ HDremove(MISC23_FILE);
}