summaryrefslogtreecommitdiffstats
path: root/src/H5detect.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2004-09-28 19:04:19 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2004-09-28 19:04:19 (GMT)
commit5c0011a71384223791d18028968382db43f08a6f (patch)
tree113cc1dd6c8d0ecd1996ddb8f0e9f7693f470e95 /src/H5detect.c
parenta841ea35292de8097b429f98af48b29f21c97893 (diff)
downloadhdf5-5c0011a71384223791d18028968382db43f08a6f.zip
hdf5-5c0011a71384223791d18028968382db43f08a6f.tar.gz
hdf5-5c0011a71384223791d18028968382db43f08a6f.tar.bz2
[svn-r9329]
Purpose: Feature Description: Datatypes and groups now use H5FO "file object" code that was previously only used by datasets. These objects will hold a file open if the file is closed but they have not yet been closed. If these objects are unlinked then relinked, they will not be destroyed. If they are opened twice (even by two different names), both IDs will "see" changes made to the object using the other ID. When an object is opened using two different names (e.g., if a dataset was opened under one name, then mounted and opened under its new name), calling H5Iget_name() on a given hid_t will return the name used to open that hid_t, not the current name of the object (this is a feature, and a change from the previous behavior of datasets). Solution: Used H5FO code that was already in place for datasets. Broke H5D_t's, H5T_t's, and H5G_t's into a "shared" struct and a private struct. The shared structs (H5D_shared_t, etc.) hold the object's information and are used by all IDs that point to a given object in the file. The private structs are pointed to by the hid_t and contain the object's group entry information (including its name) and a pointer to the shared struct for that object. This changed the naming of structs throughout the library (e.g., datatype->size is now datatype->shared->size). I added an updated H5Tinit.c to windows.zip. Platforms tested: Visual Studio 7, sleipnir, arabica, verbena Misc. update:
Diffstat (limited to 'src/H5detect.c')
-rw-r--r--src/H5detect.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/H5detect.c b/src/H5detect.c
index 5acfb56..ec99b49 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -507,8 +507,9 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align)
#include \"H5FLprivate.h\"\n\
#include \"H5Tpkg.h\"\n\
\n\
-/* Declare external the free list for H5T_t's */\n\
+/* Declare external the free lists for H5T_t's and H5T_shared_t's */\n\
H5FL_EXTERN(H5T_t);\n\
+H5FL_EXTERN(H5T_shared_t);\n\
\n\
\n");
@@ -545,15 +546,20 @@ H5TN_init_interface(void)\n\
printf("\
if (NULL==(dt = H5FL_CALLOC (H5T_t)))\n\
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,\"memory allocation failed\");\n\
- dt->state = H5T_STATE_IMMUTABLE;\n\
+ if (NULL==(dt->shared = H5FL_CALLOC(H5T_shared_t)))\n\
+ { \
+ H5FL_FREE(H5T_t, dt);\
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, \"memory allocation failed\");\n\
+ } \
+ dt->shared->state = H5T_STATE_IMMUTABLE;\n\
dt->ent.header = HADDR_UNDEF;\n\
- dt->type = H5T_%s;\n\
- dt->size = %d;\n\
- dt->u.atomic.order = H5T_ORDER_%s;\n\
- dt->u.atomic.offset = %d;\n\
- dt->u.atomic.prec = %d;\n\
- dt->u.atomic.lsb_pad = H5T_PAD_ZERO;\n\
- dt->u.atomic.msb_pad = H5T_PAD_ZERO;\n",
+ dt->shared->type = H5T_%s;\n\
+ dt->shared->size = %d;\n\
+ dt->shared->u.atomic.order = H5T_ORDER_%s;\n\
+ dt->shared->u.atomic.offset = %d;\n\
+ dt->shared->u.atomic.prec = %d;\n\
+ dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;\n\
+ dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;\n",
d[i].msize ? "FLOAT" : "INTEGER",/*class */
d[i].size, /*size */
d[i].perm[0] ? "BE" : "LE", /*byte order */
@@ -564,19 +570,19 @@ H5TN_init_interface(void)\n\
if (0 == d[i].msize) {
/* The part unique to fixed point types */
printf("\
- dt->u.atomic.u.i.sign = H5T_SGN_%s;\n",
+ dt->shared->u.atomic.u.i.sign = H5T_SGN_%s;\n",
d[i].sign ? "2" : "NONE");
} else {
/* The part unique to floating point types */
printf("\
- dt->u.atomic.u.f.sign = %d;\n\
- dt->u.atomic.u.f.epos = %d;\n\
- dt->u.atomic.u.f.esize = %d;\n\
- dt->u.atomic.u.f.ebias = 0x%08lx;\n\
- dt->u.atomic.u.f.mpos = %d;\n\
- dt->u.atomic.u.f.msize = %d;\n\
- dt->u.atomic.u.f.norm = H5T_NORM_%s;\n\
- dt->u.atomic.u.f.pad = H5T_PAD_ZERO;\n",
+ dt->shared->u.atomic.u.f.sign = %d;\n\
+ dt->shared->u.atomic.u.f.epos = %d;\n\
+ dt->shared->u.atomic.u.f.esize = %d;\n\
+ dt->shared->u.atomic.u.f.ebias = 0x%08lx;\n\
+ dt->shared->u.atomic.u.f.mpos = %d;\n\
+ dt->shared->u.atomic.u.f.msize = %d;\n\
+ dt->shared->u.atomic.u.f.norm = H5T_NORM_%s;\n\
+ dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO;\n",
d[i].sign, /*sign location */
d[i].epos, /*exponent loc */
d[i].esize, /*exponent size */