summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.distdep178
-rw-r--r--src/H5.c60
-rw-r--r--src/H5I.c46
-rw-r--r--src/H5Iprivate.h7
-rw-r--r--src/H5Ipublic.h6
-rw-r--r--src/H5R.c83
-rw-r--r--src/H5Rprivate.h31
-rw-r--r--src/H5Rpublic.h35
-rw-r--r--src/Makefile.in9
9 files changed, 353 insertions, 102 deletions
diff --git a/src/.distdep b/src/.distdep
index 292675b..635b025 100644
--- a/src/.distdep
+++ b/src/.distdep
@@ -1,34 +1,3 @@
-H5.o: \
- H5.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5ACprivate.h \
- H5ACpublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Ipublic.h \
- H5Dpublic.h \
- H5Bprivate.h \
- H5Bpublic.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5Iprivate.h \
- H5MMprivate.h \
- H5MMpublic.h \
- H5Pprivate.h \
- H5Ppublic.h \
- H5Zpublic.h \
- H5Sprivate.h \
- H5Spublic.h \
- H5Gprivate.h \
- H5Gpublic.h \
- H5Oprivate.h \
- H5Opublic.h \
- H5HGprivate.h \
- H5HGpublic.h \
- H5Tprivate.h \
- H5Tpublic.h
H5A.o: \
H5A.c \
H5private.h \
@@ -324,6 +293,39 @@ H5Fstdio.o: \
H5Dpublic.h \
H5MMprivate.h \
H5MMpublic.h
+H5G.o: \
+ H5G.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Aprivate.h \
+ H5Apublic.h \
+ H5Ipublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Dprivate.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Gpkg.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5HLprivate.h \
+ H5HLpublic.h
H5Gent.o: \
H5Gent.c \
H5private.h \
@@ -440,14 +442,6 @@ H5HL.o: \
H5MFprivate.h \
H5MFpublic.h \
H5MMprivate.h
-H5I.o: \
- H5I.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Iprivate.h \
- H5Ipublic.h \
- H5Eprivate.h
H5MF.o: \
H5MF.c \
H5private.h \
@@ -824,6 +818,42 @@ H5P.o: \
H5Eprivate.h \
H5Epublic.h \
H5MMprivate.h
+H5R.o: \
+ H5R.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Eprivate.h
+H5RA.o: \
+ H5RA.c \
+ H5RAprivate.h \
+ H5RApublic.h \
+ H5Ipublic.h \
+ H5public.h \
+ H5config.h \
+ H5Dprivate.h \
+ H5Dpublic.h \
+ H5private.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h
H5S.o: \
H5S.c \
H5private.h \
@@ -1122,64 +1152,42 @@ H5Z.o: \
H5Spublic.h \
H5Zprivate.h \
H5Zpublic.h
-H5G.o: \
- H5G.c \
+H5.o: \
+ H5.c \
H5private.h \
H5public.h \
H5config.h \
- H5Aprivate.h \
- H5Apublic.h \
- H5Ipublic.h \
- H5Gprivate.h \
- H5Gpublic.h \
- H5Bprivate.h \
- H5Bpublic.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
H5Fprivate.h \
H5Fpublic.h \
+ H5Ipublic.h \
H5Dpublic.h \
- H5Dprivate.h \
- H5Oprivate.h \
- H5Opublic.h \
- H5HGprivate.h \
- H5HGpublic.h \
- H5Tprivate.h \
- H5Tpublic.h \
- H5Sprivate.h \
- H5Spublic.h \
- H5Zprivate.h \
- H5Zpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
H5Eprivate.h \
H5Epublic.h \
- H5Gpkg.h \
- H5ACprivate.h \
- H5ACpublic.h \
- H5HLprivate.h \
- H5HLpublic.h
-H5RA.o: \
- H5RA.c \
- H5RAprivate.h \
- H5RApublic.h \
- H5Ipublic.h \
- H5public.h \
- H5config.h \
- H5Dprivate.h \
- H5Dpublic.h \
- H5private.h \
- H5Fprivate.h \
- H5Fpublic.h \
+ H5Iprivate.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Pprivate.h \
+ H5Ppublic.h \
+ H5Zpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
H5Gprivate.h \
H5Gpublic.h \
- H5Bprivate.h \
- H5Bpublic.h \
H5Oprivate.h \
H5Opublic.h \
H5HGprivate.h \
H5HGpublic.h \
H5Tprivate.h \
- H5Tpublic.h \
- H5Sprivate.h \
- H5Spublic.h \
- H5Zprivate.h \
- H5Zpublic.h \
- H5Eprivate.h \
- H5Epublic.h
+ H5Tpublic.h
+H5I.o: \
+ H5I.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Eprivate.h
diff --git a/src/H5.c b/src/H5.c
index 6ac17cf..4c3b583 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -1745,6 +1745,66 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
}
break;
+ case 't':
+ if (ptr) {
+ if (vp) {
+ fprintf (out, "0x%lx", (unsigned long)vp);
+ } else {
+ fprintf(out, "NULL");
+ }
+ } else {
+ H5I_type_t id_type = va_arg (ap, H5I_type_t);
+ switch (id_type) {
+ case H5I_BADID:
+ fprintf (out, "H5I_BADID");
+ break;
+ case H5I_FILE:
+ fprintf (out, "H5I_FILE");
+ break;
+ case H5I_TEMPLATE_0:
+ case H5I_TEMPLATE_1:
+ case H5I_TEMPLATE_2:
+ case H5I_TEMPLATE_3:
+ case H5I_TEMPLATE_4:
+ case H5I_TEMPLATE_5:
+ case H5I_TEMPLATE_6:
+ case H5I_TEMPLATE_7:
+ fprintf (out, "H5I_TEMPLATE_%d",(int)(id_type-H5I_TEMPLATE_0));
+ break;
+ case H5I_GROUP:
+ fprintf (out, "H5I_GROUP");
+ break;
+ case H5I_DATATYPE:
+ fprintf (out, "H5I_DATATYPE");
+ break;
+ case H5I_DATASPACE:
+ fprintf (out, "H5I_DATASPACE");
+ break;
+ case H5I_DATASET:
+ fprintf (out, "H5I_DATASET");
+ break;
+ case H5I_ATTR:
+ fprintf (out, "H5I_ATTR");
+ break;
+ case H5I_TEMPBUF:
+ fprintf (out, "H5I_TEMPBUF");
+ break;
+ case H5I_RAGGED:
+ fprintf (out, "H5I_RAGGED");
+ break;
+ case H5I_REFERENCE:
+ fprintf (out, "H5I_REFERENCE");
+ break;
+ case H5I_MAXID:
+ fprintf (out, "H5I_MAXID");
+ break;
+ default:
+ fprintf (out, "%ld", (long)id_type);
+ break;
+ }
+ }
+ break;
+
default:
fprintf (out, "BADTYPE(I%c)", type[1]);
goto error;
diff --git a/src/H5I.c b/src/H5I.c
index 53e4330..06ee59c 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -84,13 +84,13 @@ static herr_t H5I_init_interface(void);
# define ID_CACHE_SIZE 4 /*# of previous atoms cached */
#endif
-/* # of bits to use for Group ID in each atom (change if H5I_MAXID>16) */
-#define GROUP_BITS 8
-#define GROUP_MASK 0xFF
+/* # of bits to use for Group ID in each atom (change if H5I_MAXID>32) */
+#define GROUP_BITS 5
+#define GROUP_MASK 0x1F
/* # of bits to use for the Atom index in each atom (assumes 8-bit bytes) */
#define ID_BITS ((sizeof(hid_t)*8)-GROUP_BITS)
-#define ID_MASK 0x0FFFFFFF
+#define ID_MASK 0x07FFFFFF
/* Map an atom to a Group number */
#define H5I_GROUP(a) ((H5I_type_t) \
@@ -148,6 +148,9 @@ H5I_init_interface(void)
herr_t ret_value = SUCCEED;
FUNC_ENTER(H5I_init_interface, FAIL);
+ /* Make certain the ID types don't overflow the number of bits allocated for them in an ID */
+ assert((int)H5I_MAXID<=(int)pow((double)2.0,(double)GROUP_BITS));
+
/* Registers the cleanup routine with the exit chain */
ret_value = H5_add_exit(&H5I_term_interface);
@@ -551,13 +554,38 @@ H5I_get_type(hid_t id)
FUNC_ENTER(H5I_get_type, H5I_BADID);
+ assert(id>H5I_BADID && id<H5I_MAXID);
+
ret_value = H5I_GROUP(id);
- if (ret_value <= H5I_BADID || ret_value >= H5I_MAXID) {
- HGOTO_DONE(H5I_BADID);
- }
-
- done:
+ FUNC_LEAVE(ret_value);
+}
+
+/******************************************************************************
+ NAME
+ H5Iget_type - Returns the type of an ID
+
+ DESCRIPTION
+ Retrieves the type of an ID.
+
+ RETURNS
+ Returns group if successful and H5I_BADID otherwise
+
+*******************************************************************************/
+H5I_type_t
+H5Iget_type(hid_t id)
+{
+ H5I_type_t ret_value = H5I_BADID;
+
+ FUNC_ENTER(H5Iget_type, H5I_BADID);
+ H5TRACE1("It","i",id);
+
+ if (ret_value <= H5I_BADID || ret_value >= H5I_MAXID)
+ HGOTO_DONE(H5I_BADID);
+
+ ret_value = H5I_get_type(id);
+
+done:
FUNC_LEAVE(ret_value);
}
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index 277f6e6..788afb2 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -33,9 +33,10 @@
#define H5I_DATASETID_HASHSIZE 64
#define H5I_OID_HASHSIZE 64
#define H5I_GROUPID_HASHSIZE 64
-#define H5I_ATTRID_HASHSIZE 64
-#define H5I_TEMPBUFID_HASHSIZE 64
-#define H5I_RAGGED_HASHSIZE 64
+#define H5I_ATTRID_HASHSIZE 64
+#define H5I_TEMPBUFID_HASHSIZE 64
+#define H5I_RAGGED_HASHSIZE 64
+#define H5I_REFID_HASHSIZE 64
/* Atom information structure used */
typedef struct H5I_id_info_t {
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index 370cc17..d2d960a 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -44,8 +44,10 @@ typedef enum {
H5I_DATASET, /*group ID for Dataset objects */
H5I_ATTR, /*group ID for Attribute objects */
H5I_TEMPBUF, /*group ID for Temporary buffer objects */
- H5I_RAGGED, /*group ID for Ragged array objects */
+ H5I_RAGGED, /*group ID for Ragged array objects */
+ H5I_REFERENCE, /*group ID for Reference objects */
H5I_MAXID /*highest group in group_t (Invalid as true group)*/
+ /* Change the GROUP_BITS in H5I.c if the MAXID gets larger than 32 */
} H5I_type_t;
/* Type of atoms to return to users */
@@ -55,6 +57,8 @@ typedef int hid_t;
extern "C" {
#endif
+H5I_type_t H5Iget_type(hid_t id);
+
#ifdef __cplusplus
}
diff --git a/src/H5R.c b/src/H5R.c
new file mode 100644
index 0000000..791e6e7
--- /dev/null
+++ b/src/H5R.c
@@ -0,0 +1,83 @@
+/****************************************************************************
+* NCSA HDF *
+* Software Development Group *
+* National Center for Supercomputing Applications *
+* University of Illinois at Urbana-Champaign *
+* 605 E. Springfield, Champaign IL 61820 *
+* *
+* For conditions of distribution and use, see the accompanying *
+* hdf/COPYING file. *
+* *
+****************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision$";
+#endif
+
+/* $Id$ */
+
+#include <H5private.h> /* Generic Functions */
+#include <H5Iprivate.h> /* ID Functions */
+#include <H5Eprivate.h> /* Error handling */
+#include <H5Rprivate.h> /* Data-space functions */
+
+/* Interface initialization */
+#define PABLO_MASK H5R_mask
+#define INTERFACE_INIT H5R_init_interface
+static intn interface_initialize_g = FALSE;
+static herr_t H5R_init_interface(void);
+static void H5R_term_interface(void);
+
+
+/*--------------------------------------------------------------------------
+NAME
+ H5R_init_interface -- Initialize interface-specific information
+USAGE
+ herr_t H5R_init_interface()
+
+RETURNS
+ SUCCEED/FAIL
+DESCRIPTION
+ Initializes any interface-specific data or routines.
+
+--------------------------------------------------------------------------*/
+static herr_t
+H5R_init_interface(void)
+{
+ herr_t ret_value = SUCCEED;
+ FUNC_ENTER(H5R_init_interface, FAIL);
+
+ /* Initialize the atom group for the file IDs */
+ if ((ret_value = H5I_init_group(H5I_REFERENCE, H5I_REFID_HASHSIZE,
+ H5R_RESERVED_ATOMS, (herr_t (*)(void *)) NULL)) != FAIL) {
+ ret_value = H5_add_exit(&H5R_term_interface);
+ }
+
+ FUNC_LEAVE(ret_value);
+} /* end H5R_init_interface() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5R_term_interface
+ PURPOSE
+ Terminate various H5R objects
+ USAGE
+ void H5R_term_interface()
+ RETURNS
+ SUCCEED/FAIL
+ DESCRIPTION
+ Release the atom group and any other resources allocated.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Can't report errors...
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static void
+H5R_term_interface(void)
+{
+ /* Free ID group */
+ H5I_destroy_group(H5I_REFERENCE);
+} /* end H5R_term_interface() */
+
diff --git a/src/H5Rprivate.h b/src/H5Rprivate.h
new file mode 100644
index 0000000..91824b9
--- /dev/null
+++ b/src/H5Rprivate.h
@@ -0,0 +1,31 @@
+/****************************************************************************
+ * NCSA HDF *
+ * Software Development Group *
+ * National Center for Supercomputing Applications *
+ * University of Illinois at Urbana-Champaign *
+ * 605 E. Springfield, Champaign IL 61820 *
+ * *
+ * For conditions of distribution and use, see the accompanying *
+ * hdf/COPYING file. *
+ * *
+ ****************************************************************************/
+
+/*
+ * This file contains private information about the H5S module
+ */
+#ifndef _H5Rprivate_H
+#define _H5Rprivate_H
+
+#include <H5Rpublic.h>
+
+/* Private headers needed by this file */
+#include <H5private.h>
+
+#define H5R_RESERVED_ATOMS 0
+
+/* Internal data structures */
+
+
+/* Private functions */
+
+#endif /* _H5Rprivate_H */
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
new file mode 100644
index 0000000..6d6abb3
--- /dev/null
+++ b/src/H5Rpublic.h
@@ -0,0 +1,35 @@
+/****************************************************************************
+ * NCSA HDF *
+ * Software Development Group *
+ * National Center for Supercomputing Applications *
+ * University of Illinois at Urbana-Champaign *
+ * 605 E. Springfield, Champaign IL 61820 *
+ * *
+ * For conditions of distribution and use, see the accompanying *
+ * hdf/COPYING file. *
+ * *
+ ****************************************************************************/
+
+/*
+ * This file contains public declarations for the H5S module.
+ */
+#ifndef _H5Rpublic_H
+#define _H5Rpublic_H
+
+/* Public headers needed by this file */
+#include <H5public.h>
+#include <H5Ipublic.h>
+
+/* Publicly visible datastructures */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Functions in H5R.c */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H5Rpublic_H */
diff --git a/src/Makefile.in b/src/Makefile.in
index 404c4e5..338241b 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -19,7 +19,7 @@ LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5D.c H5E.c H5F.c H5Farray.c H5Fcore.c \
H5Fstdio.c H5G.c H5Gent.c H5Gnode.c H5Gstab.c H5HG.c H5HL.c H5I.c H5MF.c \
H5MM.c H5O.c H5Oattr.c H5Ocomp.c H5Ocont.c H5Odtype.c H5Oefl.c H5Ofill.c \
H5Olayout.c H5Omtime.c H5Oname.c H5Onull.c H5Osdspace.c H5Oshared.c \
- H5Ostab.c H5P.c H5RA.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Spoint.c \
+ H5Ostab.c H5P.c H5R.c H5RA.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Spoint.c \
H5Sselect.c H5T.c H5Tbit.c H5Tconv.c H5Tinit.c H5TB.c H5V.c H5Z.c
LIB_OBJ=$(LIB_SRC:.c=.o)
@@ -31,14 +31,15 @@ MOSTLYCLEAN=H5detect.o H5detect H5Tinit.o H5Tinit.c
PUB_HDR=H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5Dpublic.h \
H5Epublic.h H5Fpublic.h H5Gpublic.h H5HGpublic.h H5HLpublic.h \
H5Ipublic.h H5MFpublic.h H5MMpublic.h H5Opublic.h H5Ppublic.h \
- H5RApublic.h H5Spublic.h H5Tpublic.h H5Zpublic.h H5config.h hdf5.h
+ H5Rpublic.h H5RApublic.h H5Spublic.h H5Tpublic.h H5Zpublic.h H5config.h \
+ hdf5.h
# Other header files (not to be installed)...
PRIVATE_HDR=H5private.h H5Aprivate.h H5Apkg.h H5ACprivate.h H5Bprivate.h \
H5Dprivate.h H5Eprivate.h H5Fprivate.h H5Gprivate.h H5Gpkg.h \
H5HGprivate.h H5HLprivate.h H5Iprivate.h H5MFprivate.h H5MMprivate.h \
- H5Oprivate.h H5Pprivate.h H5RAprivate.h H5Sprivate.h H5Tprivate.h \
- H5TBprivate.h H5Tpkg.h H5Vprivate.h H5Zprivate.h
+ H5Oprivate.h H5Pprivate.h H5Rprivate.h H5RAprivate.h H5Sprivate.h \
+ H5Tprivate.h H5TBprivate.h H5Tpkg.h H5Vprivate.h H5Zprivate.h
# Number format detection
H5Tinit.c: H5detect