summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-10-30 23:46:27 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-10-30 23:46:27 (GMT)
commit3f69573f575390295536c0faa6d083c58a7291fa (patch)
tree554230227da6e04f650668ec3421052806a9a8df /src
parentc19a43d85474fc21308cb3e5e59dbc535edf4174 (diff)
downloadhdf5-3f69573f575390295536c0faa6d083c58a7291fa.zip
hdf5-3f69573f575390295536c0faa6d083c58a7291fa.tar.gz
hdf5-3f69573f575390295536c0faa6d083c58a7291fa.tar.bz2
[svn-r12832] Description:
Clean up formatting and re-organize a bit... Tested on: Max OS X/32 10.4.8 (amazon) FreeBSD/32 4.11 (sleipnir) Linux/32 2.4 (heping) Linux/64 2.4 (mir)
Diffstat (limited to 'src')
-rw-r--r--src/H5Dpublic.h2
-rw-r--r--src/H5G.c1
-rw-r--r--src/H5Gpublic.h113
-rw-r--r--src/H5Lexternal.c2
-rw-r--r--src/H5Lprivate.h7
-rw-r--r--src/H5Lpublic.h35
-rw-r--r--src/H5O.c62
-rw-r--r--src/H5Plapl.c4
8 files changed, 134 insertions, 92 deletions
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index b44bc8b..34a7803 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -18,6 +18,8 @@
#ifndef _H5Dpublic_H
#define _H5Dpublic_H
+/* System headers needed by this file */
+
/* Public headers needed by this file */
#include "H5public.h"
#include "H5Ipublic.h"
diff --git a/src/H5G.c b/src/H5G.c
index 0edacab..b848c93 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -2426,4 +2426,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_copy() */
-
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index e6851f4..ada6ca8 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -18,27 +18,56 @@
* Jul 11 1997
* Robb Matzke <matzke@llnl.gov>
*
- * Purpose: Public declarations for the H5G package (symbol
- * tables).
+ * Purpose: Public declarations for the H5G package
*
*-------------------------------------------------------------------------
*/
#ifndef _H5Gpublic_H
#define _H5Gpublic_H
-/* Public headers needed by this file */
+/* System headers needed by this file */
#include <sys/types.h>
+/* Public headers needed by this file */
#include "H5public.h"
#include "H5Ipublic.h"
#include "H5Lpublic.h"
#include "H5Opublic.h"
#include "H5Tpublic.h"
+/*****************/
+/* Public Macros */
+/*****************/
+
+/* Macros for types of objects in a group (see H5G_obj_t definition) */
+#define H5G_NTYPES 256 /* Max possible number of types */
+#define H5G_NLIBTYPES 8 /* Number of internal types */
+#define H5G_NUSERTYPES (H5G_NTYPES-H5G_NLIBTYPES)
+#define H5G_USERTYPE(X) (8+(X)) /* User defined types */
+
+/* Flags for object copy (H5Gcopy) */
+#define H5G_COPY_SHALLOW_HIERARCHY_FLAG (0x0001u) /* Copy only immediate members */
+#define H5G_COPY_EXPAND_SOFT_LINK_FLAG (0x0002u) /* Expand soft links into new objects */
+#define H5G_COPY_EXPAND_EXT_LINK_FLAG (0x0004u) /* Expand external links into new objects */
+#define H5G_COPY_EXPAND_REFERENCE_FLAG (0x0008u) /* Copy objects that are pointed by references */
+#define H5G_COPY_WITHOUT_ATTR_FLAG (0x0010u) /* Copy object without copying attributes */
+#define H5G_COPY_ALL (0x001Fu) /* All object copying flags (for internal checking) */
+
+/* Deprecated macros, for backward compatibility */
+#define H5G_LINK_ERROR H5L_TYPE_ERROR
+#define H5G_LINK_HARD H5L_TYPE_HARD
+#define H5G_LINK_SOFT H5L_TYPE_SOFT
+#define H5G_link_t H5L_type_t
+#define H5G_SAME_LOC H5L_SAME_LOC
+
#ifdef __cplusplus
extern "C" {
#endif
+/*******************/
+/* Public Typedefs */
+/*******************/
+
/*
* An object has a certain type. The first few numbers are reserved for use
* internally by HDF5. Users may add their own types with higher values. The
@@ -58,11 +87,6 @@ typedef enum H5G_obj_t {
H5G_RESERVED_7 /* Reserved for future use */
} H5G_obj_t;
-#define H5G_NTYPES 256 /* Max possible number of types */
-#define H5G_NLIBTYPES 8 /* Number of internal types */
-#define H5G_NUSERTYPES (H5G_NTYPES-H5G_NLIBTYPES)
-#define H5G_USERTYPE(X) (8+(X)) /* User defined types */
-
/* Information about an object */
typedef struct H5G_stat_t {
unsigned long fileno[2]; /*file number */
@@ -74,63 +98,66 @@ typedef struct H5G_stat_t {
H5O_stat_t ohdr; /* Object header information */
} H5G_stat_t;
-typedef herr_t (*H5G_iterate_t)(hid_t group, const char *name,
- void *op_data);
+/* Prototype for H5Giterate() operator */
+typedef herr_t (*H5G_iterate_t)(hid_t group, const char *name, void *op_data);
+
+/*
+ * The types of indices on links in groups. Primarily used for "<do> <foo> by
+ * index" routines and for iterating over links in groups.
+ */
+typedef enum H5G_index_t {
+ H5G_INDEX_UNKNOWN = -1, /* Unknown index type */
+ H5G_INDEX_NAME, /* Index on names of links */
+ H5G_INDEX_CORDER, /* Index on creation order of links */
+ H5G_INDEX_N /* Number of indices defined on links in groups */
+} H5G_index_t;
+
+/********************/
+/* Public Variables */
+/********************/
-/* Flags for object copy (H5Gcopy) */
-#define H5G_COPY_SHALLOW_HIERARCHY_FLAG (0x0002u) /* Copy only immediate members */
-#define H5G_COPY_EXPAND_SOFT_LINK_FLAG (0x0004u) /* Expand soft links into new objects */
-#define H5G_COPY_EXPAND_EXT_LINK_FLAG (0x0008u) /* Expand external links into new objects */
-#define H5G_COPY_EXPAND_REFERENCE_FLAG (0x0010u) /* Copy objects that are pointed by references */
-#define H5G_COPY_WITHOUT_ATTR_FLAG (0x0020u) /* Copy object without copying attributes */
-#define H5G_COPY_ALL (0x003Fu) /* All object copying flags (for internal checking) */
+/*********************/
+/* Public Prototypes */
+/*********************/
H5_DLL hid_t H5Gcreate(hid_t loc_id, const char *name, size_t size_hint);
+H5_DLL hid_t H5Gcreate_expand(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id);
H5_DLL hid_t H5Gopen(hid_t loc_id, const char *name);
H5_DLL hid_t H5Gopen_expand(hid_t loc_id, const char *name, hid_t gapl_id);
H5_DLL herr_t H5Gclose(hid_t group_id);
H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx,
- H5G_iterate_t op, void *op_data);
+ 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 loc_id, hsize_t idx, char* name, size_t size);
H5_DLL H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx);
H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name,
- hbool_t follow_link, H5G_stat_t *statbuf/*out*/);
-H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name,
- const char *comment);
+ hbool_t follow_link, H5G_stat_t *statbuf/*out*/);
+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, hid_t gcpl_id,
- hid_t gapl_id);
+ char *buf);
H5_DLL hid_t H5Gget_create_plist(hid_t group_id);
H5_DLL herr_t H5Gcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
- const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
+ const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
/* Functions and variables defined for compatibility with previous versions
* of the HDF5 API.
- * Use of these functions and variables is depreciated.
+ *
+ * Use of these functions and variables is deprecated.
*/
-H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5L_type_t type,
- const char *cur_name, const char *new_name);
+H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5L_type_t type, const char *cur_name,
+ const char *new_name);
H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name,
- const char *dst_name);
-H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name,
- H5L_type_t type, hid_t new_loc_id, const char *new_name);
-H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name,
- hid_t dst_loc_id, const char *dst_name);
+ const char *dst_name);
+H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_type_t type,
+ hid_t new_loc_id, const char *new_name);
+H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
+ const char *dst_name);
H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name);
-H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name,
- size_t size, char *buf/*out*/);
-
-#define H5G_LINK_ERROR H5L_TYPE_ERROR
-#define H5G_LINK_HARD H5L_TYPE_HARD
-#define H5G_LINK_SOFT H5L_TYPE_SOFT
-#define H5G_link_t H5L_type_t
-#define H5G_SAME_LOC H5L_SAME_LOC
-
+H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size,
+ char *buf/*out*/);
#ifdef __cplusplus
}
#endif
-#endif
+#endif /* _H5Gpublic_H */
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index ab2d7e6..6255764 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -76,7 +76,7 @@ H5L_init_extern_interface(void)
*
* Given a filename and path packed into the link udata,
* attempts to open an object within an external file.
- * If the H5L_ELINK_PREFIX_PROP property is set in the
+ * If the H5L_ELINK_PREFIX_NAME property is set in the
* link access property list, appends that prefix to the
* filename being opened.
*
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index 0d1c81d..308a6c6 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -40,10 +40,7 @@
#define H5L_ELINK_PREFIX_SIZE sizeof(char *)
#define H5L_ELINK_PREFIX_DEF NULL /*default is no prefix */
-/* Functions that understand link messages */
-/* forward reference for later use */
-struct H5HL_t; /* defined in H5HLprivate.h */
-
+/* General operations on links */
H5_DLL herr_t H5L_link(H5G_loc_t *new_loc, const char *new_name,
H5G_loc_t *obj_loc, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id);
H5_DLL hid_t H5L_get_default_lcpl(void);
@@ -57,5 +54,5 @@ H5_DLL herr_t H5L_register(const H5L_class_t *cls);
H5_DLL herr_t H5L_unregister(H5L_type_t id);
H5_DLL const H5L_class_t *H5L_find_class(H5L_type_t id);
-
#endif /* _H5Lprivate_H */
+
diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h
index 6462170..0611760 100644
--- a/src/H5Lpublic.h
+++ b/src/H5Lpublic.h
@@ -30,14 +30,28 @@
#include "H5Ipublic.h"
#include "H5Tpublic.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+/*****************/
+/* Public Macros */
+/*****************/
/* Maximum length of a link's name */
/* (encoded in a 32-bit unsigned integer) */
#define H5L_MAX_LINK_NAME_LEN ((uint32_t)(-1)) /* (4GB - 1) */
+/* Macro to indicate operation occurs on same location */
+#define H5L_SAME_LOC 0
+
+/* Current version of the H5L_class_t struct */
+#define H5L_LINK_CLASS_T_VERS 0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
/* Link class types.
* Values less than 64 are reserved for the HDF5 library's internal use.
* Values 64 to 255 are for "user-defined" link class types; these types are
@@ -68,15 +82,10 @@ typedef struct {
} u;
} H5L_linkinfo_t;
-#define H5L_SAME_LOC 0
-
/* The H5L_class_t struct can be used to override the behavior of a
* "user-defined" link class. Users should populate the struct with callback
* functions defined below.
*/
-/* Current version of the H5L_class_t struct */
-#define H5L_LINK_CLASS_T_VERS (0)
-
/* Callback prototypes for user-defined links */
/* Link creation callback */
typedef herr_t (*H5L_create_func_t)(const char * link_name, hid_t loc_group, void * udata, size_t udata_size, hid_t lcpl_id);
@@ -110,10 +119,14 @@ typedef struct {
H5L_query_func_t query_func; /* Callback for queries */
} H5L_class_t;
-#define H5L_ELINK_PREFIX_PROP "elink_prefix"
+/********************/
+/* Public Variables */
+/********************/
-/* Public prototypes */
+/*********************/
+/* Public Prototypes */
+/*********************/
H5_DLL herr_t H5Llink(hid_t cur_loc_id, const char *cur_name,
hid_t obj_id, hid_t lcpl_id, hid_t lapl_id);
H5_DLL herr_t H5Lmove(hid_t src_loc, const char *src_name, hid_t dst_loc,
@@ -148,5 +161,5 @@ H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name,
#ifdef __cplusplus
}
#endif
-#endif
+#endif /* _H5Lpublic_H */
diff --git a/src/H5O.c b/src/H5O.c
index c2528f9..74ae1d7 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -276,6 +276,7 @@ H5FL_DEFINE_STATIC(H5O_addr_map_t);
*
* The opened object should be closed again with H5Oclose
* or H5Gclose, H5Tclose, or H5Dclose.
+ *
* Return: Success: An open object identifier
* Failure: Negative
*
@@ -564,35 +565,38 @@ H5O_open_by_loc(H5G_loc_t *obj_loc, hid_t dxpl_id)
/* Get the type of the object and open it in the correct way */
switch(H5O_obj_type(obj_loc->oloc, dxpl_id))
{
- case(H5G_GROUP):
- /* Open the group */
- if((grp = H5G_open(obj_loc, dxpl_id)) == NULL)
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
- /* Register an atom for the group */
- if((ret_value = H5I_register(H5I_GROUP, grp)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
- break;
-
- case(H5G_DATASET):
- /* Open the group */
- if((dset = H5D_open(obj_loc, dxpl_id)) == NULL)
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open dataset")
- /* Register an atom for the group */
- if((ret_value = H5I_register(H5I_DATASET, dset)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataset")
- break;
-
- case(H5G_TYPE):
- /* Open the group */
- if((type = H5T_open(obj_loc, dxpl_id)) == NULL)
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open datatype")
- /* Register an atom for the group */
- if((ret_value = H5I_register(H5I_DATATYPE, type)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
- break;
-
- default:
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "invalid object type")
+ case(H5G_GROUP):
+ /* Open the group */
+ if((grp = H5G_open(obj_loc, dxpl_id)) == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
+
+ /* Register an atom for the group */
+ if((ret_value = H5I_register(H5I_GROUP, grp)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ break;
+
+ case(H5G_DATASET):
+ /* Open the group */
+ if((dset = H5D_open(obj_loc, dxpl_id)) == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open dataset")
+
+ /* Register an atom for the group */
+ if((ret_value = H5I_register(H5I_DATASET, dset)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataset")
+ break;
+
+ case(H5G_TYPE):
+ /* Open the group */
+ if((type = H5T_open(obj_loc, dxpl_id)) == NULL)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open datatype")
+
+ /* Register an atom for the group */
+ if((ret_value = H5I_register(H5I_DATATYPE, type)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "invalid object type")
}
done:
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index 1a2dd0e..b91aa05 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -106,7 +106,7 @@ H5Pget_nlinks(hid_t plist_id, size_t *nlinks)
/* Get the current number of links */
if(H5P_get(plist, H5L_NLINKS_NAME, nlinks) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of links")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of links")
done:
FUNC_LEAVE_API(ret_value)
@@ -187,7 +187,7 @@ H5Pget_elink_prefix(hid_t plist_id, char **prefix)
/* Get the current prefix */
if(H5P_get(plist, H5L_ELINK_PREFIX_NAME, prefix) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix")
done:
FUNC_LEAVE_API(ret_value)