diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Aprivate.h | 108 | ||||
-rw-r--r-- | src/H5D.c | 108 | ||||
-rw-r--r-- | src/H5Dprivate.h | 2 | ||||
-rw-r--r-- | src/H5Dpublic.h | 2 | ||||
-rw-r--r-- | src/H5E.c | 2 | ||||
-rw-r--r-- | src/H5Epublic.h | 2 | ||||
-rw-r--r-- | src/H5F.c | 28 | ||||
-rw-r--r-- | src/H5Fpublic.h | 2 | ||||
-rw-r--r-- | src/H5G.c | 36 | ||||
-rw-r--r-- | src/H5Gpublic.h | 2 | ||||
-rw-r--r-- | src/H5I.c (renamed from src/H5A.c) | 576 | ||||
-rw-r--r-- | src/H5Iprivate.h | 107 | ||||
-rw-r--r-- | src/H5Ipublic.h (renamed from src/H5Apublic.h) | 16 | ||||
-rw-r--r-- | src/H5P.c | 100 | ||||
-rw-r--r-- | src/H5Ppublic.h | 2 | ||||
-rw-r--r-- | src/H5S.c | 40 | ||||
-rw-r--r-- | src/H5Spublic.h | 2 | ||||
-rw-r--r-- | src/H5T.c | 222 | ||||
-rw-r--r-- | src/H5Tconv.c | 38 | ||||
-rw-r--r-- | src/H5Tpublic.h | 2 | ||||
-rw-r--r-- | src/H5detect.c | 4 | ||||
-rw-r--r-- | src/Makefile.in | 12 | ||||
-rw-r--r-- | src/debug.c | 4 | ||||
-rw-r--r-- | src/hdf5.h | 2 |
24 files changed, 705 insertions, 714 deletions
diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h deleted file mode 100644 index db7ca4d..0000000 --- a/src/H5Aprivate.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** - * 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. * - * * - ****************************************************************************/ - -/*----------------------------------------------------------------------------- - * File: atom.h - * Purpose: header file for atom API - *---------------------------------------------------------------------------*/ - -/* avoid re-inclusion */ -#ifndef _H5Aprivate_H -#define _H5Aprivate_H - -#include <H5Apublic.h> /*include Public Definitions */ - -/* Private headers needed by this file */ -#include <H5private.h> - -/* Atom Features control */ - -/* - * Define the following macro for fast hash calculations (but limited - * hash sizes) - */ -#define HASH_SIZE_POWER_2 - -/* Define the following macro for atom caching over all the atoms */ -#define ATOMS_ARE_CACHED - -#ifdef ATOMS_ARE_CACHED -# define ATOM_CACHE_SIZE 4 /*# of previous atoms cached */ -#endif - -/* Map an atom to a Group number */ -#define ATOM_TO_GROUP(a) ((group_t)((((hid_t)(a))>> \ - ((sizeof(hid_t)*8)-GROUP_BITS)) \ - &GROUP_MASK)) - -#ifdef HASH_SIZE_POWER_2 - -/* - * Map an atom to a hash location (assumes s is a power of 2 and smaller - * than the ATOM_MASK constant). - */ -# define ATOM_TO_LOC(a,s) ((hid_t)(a)&((s)-1)) -#else - -/* - * Map an atom to a hash location. - */ -# define ATOM_TO_LOC(a,s) (((hid_t)(a)&ATOM_MASK)%(s)) -#endif - -/* Default sizes of the hash-tables for various atom groups */ -#define H5A_ERRSTACK_HASHSIZE 64 -#define H5A_FILEID_HASHSIZE 64 -#define H5A_TEMPID_HASHSIZE 64 -#define H5A_DATATYPEID_HASHSIZE 64 -#define H5A_DATASPACEID_HASHSIZE 64 -#define H5A_DATASETID_HASHSIZE 64 -#define H5A_OID_HASHSIZE 64 -#define H5A_GROUPID_HASHSIZE 64 - -/* Atom information structure used */ -typedef struct atom_info_t { - hid_t id; /*atom ID for this info */ - uintn count; /*ref. count for this atom */ - void *obj_ptr; /*pointer associated with the atom */ - struct atom_info_t *next; /*link to next atom (in case of hash-clash)*/ -} atom_info_t; - -/* Atom group structure used */ -typedef struct atom_group_struct_tag { - uintn count; /*# of times this group has been initialized */ - uintn reserved; /*# of atoms to reserve for constant atoms */ - uintn wrapped; /*whether the id count has wrapped around */ - intn hash_size; /*sizeof the hash table to store the atoms in*/ - uintn atoms; /*current number of atoms held */ - uintn nextid; /*atom ID to use for the next atom */ - herr_t (*free_func)(void*);/*func to call to release object */ - atom_info_t **atom_list; /*pointer to an array of ptrs to atoms */ -} atom_group_t; - -/* Type of the function to compare objects & keys */ -typedef intn (*H5A_search_func_t) (const void * obj, const void * key); - -/* Private Functions in H5A.c */ -intn H5A_init_group (group_t grp, intn hash_size, uintn reserved, - herr_t (*free_func)(void *)); -herr_t H5A_destroy_group (group_t grp); -hid_t H5A_register (group_t grp, void *object); -void *H5A_object (hid_t atm); -group_t H5A_group (hid_t atm); -void *H5A_remove (hid_t atm); -void *H5A_search (group_t grp, H5A_search_func_t func, const void *key); -void H5A_term_interface (void); -intn H5A_dec_ref (hid_t atm); -hid_t H5A_inc_ref (hid_t atm); - -#endif @@ -17,7 +17,7 @@ static char RcsId[] = "@(#)$Revision$"; /* $Id$ */ #include <H5private.h> /* Generic Functions */ -#include <H5Aprivate.h> /* Atoms */ +#include <H5Iprivate.h> /* IDs */ #include <H5ACprivate.h> /* Cache */ #include <H5Dprivate.h> /* Dataset functions */ #include <H5Eprivate.h> /* Error handling */ @@ -95,7 +95,7 @@ H5D_init_interface(void) FUNC_ENTER(H5D_init_interface, FAIL); /* Initialize the atom group for the dataset IDs */ - if ((ret_value = H5A_init_group(H5_DATASET, H5A_DATASETID_HASHSIZE, + if ((ret_value = H5I_init_group(H5_DATASET, H5I_DATASETID_HASHSIZE, H5D_RESERVED_ATOMS, (herr_t (*)(void *)) H5D_close)) != FAIL) { ret_value = H5_add_exit(H5D_term_interface); @@ -124,7 +124,7 @@ H5D_init_interface(void) static void H5D_term_interface(void) { - H5A_destroy_group(H5_DATASET); + H5I_destroy_group(H5_DATASET); } /*------------------------------------------------------------------------- @@ -181,24 +181,24 @@ H5Dcreate(hid_t file_id, const char *name, hid_t type_id, hid_t space_id, FUNC_ENTER(H5Dcreate, FAIL); /* Check arguments */ - if (H5_FILE != H5A_group(file_id) || - NULL == (f = H5A_object(file_id))) { + if (H5_FILE != H5I_group(file_id) || + NULL == (f = H5I_object(file_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); } if (!name || !*name) { HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); } - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (type = H5A_object(type_id))) { + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (type = H5I_object(type_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type"); } - if (H5_DATASPACE != H5A_group(space_id) || - NULL == (space = H5A_object(space_id))) { + if (H5_DATASPACE != H5I_group(space_id) || + NULL == (space = H5I_object(space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } if (create_parms_id >= 0) { if (H5P_DATASET_CREATE != H5Pget_class(create_parms_id) || - NULL == (create_parms = H5A_object(create_parms_id))) { + NULL == (create_parms = H5I_object(create_parms_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); } @@ -212,7 +212,7 @@ H5Dcreate(hid_t file_id, const char *name, hid_t type_id, hid_t space_id, "unable to create dataset"); } /* Register the new datatype and get an ID for it */ - if ((ret_value = H5A_register(H5_DATASET, new_dset)) < 0) { + if ((ret_value = H5I_register(H5_DATASET, new_dset)) < 0) { H5D_close(new_dset); HRETURN_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset"); @@ -254,8 +254,8 @@ H5Dopen(hid_t file_id, const char *name) FUNC_ENTER(H5Dopen, FAIL); /* Check args */ - if (H5_FILE != H5A_group(file_id) || - NULL == (file = H5A_object(file_id))) { + if (H5_FILE != H5I_group(file_id) || + NULL == (file = H5I_object(file_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); } if (!name || !*name) { @@ -268,7 +268,7 @@ H5Dopen(hid_t file_id, const char *name) } /* Create an atom for the dataset */ - if ((ret_value = H5A_register(H5_DATASET, dataset)) < 0) { + if ((ret_value = H5I_register(H5_DATASET, dataset)) < 0) { H5D_close(dataset); HRETURN_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register dataset"); @@ -306,8 +306,8 @@ H5Dclose(hid_t dataset_id) FUNC_ENTER(H5Dclose, FAIL); /* Check args */ - if (H5_DATASET != H5A_group(dataset_id) || - NULL == (dataset = H5A_object(dataset_id)) || + if (H5_DATASET != H5I_group(dataset_id) || + NULL == (dataset = H5I_object(dataset_id)) || NULL == dataset->ent.file) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } @@ -315,7 +315,7 @@ H5Dclose(hid_t dataset_id) * Decrement the counter on the dataset. It will be freed if the count * reaches zero. */ - if (H5A_dec_ref(dataset_id) < 0) { + if (H5I_dec_ref(dataset_id) < 0) { HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't free"); } FUNC_LEAVE(SUCCEED); @@ -349,8 +349,8 @@ H5Dget_space (hid_t dataset_id) FUNC_ENTER (H5Dget_space, FAIL); /* Check args */ - if (H5_DATASET!=H5A_group (dataset_id) || - NULL==(dataset=H5A_object (dataset_id))) { + if (H5_DATASET!=H5I_group (dataset_id) || + NULL==(dataset=H5I_object (dataset_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } @@ -361,7 +361,7 @@ H5Dget_space (hid_t dataset_id) } /* Create an atom */ - if ((ret_value=H5A_register (H5_DATASPACE, copied_space))<0) { + if ((ret_value=H5I_register (H5_DATASPACE, copied_space))<0) { HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register data space"); } @@ -399,8 +399,8 @@ H5Dget_type (hid_t dataset_id) FUNC_ENTER (H5Dget_type, FAIL); /* Check args */ - if (H5_DATASET!=H5A_group (dataset_id) || - NULL==(dataset=H5A_object (dataset_id))) { + if (H5_DATASET!=H5I_group (dataset_id) || + NULL==(dataset=H5I_object (dataset_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } @@ -411,7 +411,7 @@ H5Dget_type (hid_t dataset_id) } /* Create an atom */ - if ((ret_value=H5A_register (H5_DATATYPE, copied_type))<0) { + if ((ret_value=H5I_register (H5_DATATYPE, copied_type))<0) { HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register data type"); } @@ -447,8 +447,8 @@ H5Dget_create_plist (hid_t dataset_id) FUNC_ENTER (H5Dget_create_plist, FAIL); /* Check args */ - if (H5_DATASET!=H5A_group (dataset_id) || - NULL==(dataset=H5A_object (dataset_id))) { + if (H5_DATASET!=H5I_group (dataset_id) || + NULL==(dataset=H5I_object (dataset_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } @@ -460,7 +460,7 @@ H5Dget_create_plist (hid_t dataset_id) } /* Create an atom */ - if ((ret_value=H5A_register ((group_t)(H5_TEMPLATE_0+H5P_DATASET_CREATE), + if ((ret_value=H5I_register ((H5I_group_t)(H5_TEMPLATE_0+H5P_DATASET_CREATE), copied_parms))<0) { HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register creation property list"); @@ -524,31 +524,31 @@ H5Dread(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, FUNC_ENTER(H5Dread, FAIL); /* check arguments */ - if (H5_DATASET != H5A_group(dataset_id) || - NULL == (dataset = H5A_object(dataset_id)) || + if (H5_DATASET != H5I_group(dataset_id) || + NULL == (dataset = H5I_object(dataset_id)) || NULL == dataset->ent.file) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } - if (H5_DATATYPE != H5A_group(mem_type_id) || - NULL == (mem_type = H5A_object(mem_type_id))) { + if (H5_DATATYPE != H5I_group(mem_type_id) || + NULL == (mem_type = H5I_object(mem_type_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } if (H5S_ALL != mem_space_id) { - if (H5_DATASPACE != H5A_group(mem_space_id) || - NULL == (mem_space = H5A_object(mem_space_id))) { + if (H5_DATASPACE != H5I_group(mem_space_id) || + NULL == (mem_space = H5I_object(mem_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } } if (H5S_ALL != file_space_id) { - if (H5_DATASPACE != H5A_group(file_space_id) || - NULL == (file_space = H5A_object(file_space_id))) { + if (H5_DATASPACE != H5I_group(file_space_id) || + NULL == (file_space = H5I_object(file_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } } if (H5P_DEFAULT == xfer_parms_id) { xfer_parms = &H5D_xfer_dflt; } else if (H5P_DATASET_XFER != H5Pget_class(xfer_parms_id) || - NULL == (xfer_parms = H5A_object(xfer_parms_id))) { + NULL == (xfer_parms = H5I_object(xfer_parms_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); } if (!buf) { @@ -613,31 +613,31 @@ H5Dwrite(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, FUNC_ENTER(H5Dwrite, FAIL); /* check arguments */ - if (H5_DATASET != H5A_group(dataset_id) || - NULL == (dataset = H5A_object(dataset_id)) || + if (H5_DATASET != H5I_group(dataset_id) || + NULL == (dataset = H5I_object(dataset_id)) || NULL == dataset->ent.file) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } - if (H5_DATATYPE != H5A_group(mem_type_id) || - NULL == (mem_type = H5A_object(mem_type_id))) { + if (H5_DATATYPE != H5I_group(mem_type_id) || + NULL == (mem_type = H5I_object(mem_type_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } if (H5S_ALL != mem_space_id) { - if (H5_DATASPACE != H5A_group(mem_space_id) || - NULL == (mem_space = H5A_object(mem_space_id))) { + if (H5_DATASPACE != H5I_group(mem_space_id) || + NULL == (mem_space = H5I_object(mem_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } } if (H5S_ALL != file_space_id) { - if (H5_DATASPACE != H5A_group(file_space_id) || - NULL == (file_space = H5A_object(file_space_id))) { + if (H5_DATASPACE != H5I_group(file_space_id) || + NULL == (file_space = H5I_object(file_space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } } if (H5P_DEFAULT == xfer_parms_id) { xfer_parms = &H5D_xfer_dflt; } else if (H5P_DATASET_XFER != H5Pget_class(xfer_parms_id) || - NULL == (xfer_parms = H5A_object(xfer_parms_id))) { + NULL == (xfer_parms = H5I_object(xfer_parms_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); } if (!buf) { @@ -678,8 +678,8 @@ H5Dextend (hid_t dataset_id, const size_t *size) FUNC_ENTER (H5Dextend, FAIL); /* Check args */ - if (H5_DATASET!=H5A_group (dataset_id) || - NULL==(dataset=H5A_object (dataset_id))) { + if (H5_DATASET!=H5I_group (dataset_id) || + NULL==(dataset=H5I_object (dataset_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); } if (!size) { @@ -1132,8 +1132,8 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types"); } else if (H5T_conv_noop!=tconv_func) { - if ((src_id=H5A_register(H5_DATATYPE, H5T_copy(dataset->type)))<0 || - (dst_id=H5A_register(H5_DATATYPE, H5T_copy(mem_type)))<0) { + if ((src_id=H5I_register(H5_DATATYPE, H5T_copy(dataset->type)))<0 || + (dst_id=H5I_register(H5_DATATYPE, H5T_copy(mem_type)))<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion"); } @@ -1282,8 +1282,8 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, ret_value = SUCCEED; done: - if (src_id >= 0) H5A_dec_ref(src_id); - if (dst_id >= 0) H5A_dec_ref(dst_id); + if (src_id >= 0) H5I_dec_ref(src_id); + if (dst_id >= 0) H5I_dec_ref(dst_id); if (tconv_buf && NULL==xfer_parms->tconv_buf) { H5MM_xfree(tconv_buf); } @@ -1357,8 +1357,8 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types"); } else if (H5T_conv_noop!=tconv_func) { - if ((src_id = H5A_register(H5_DATATYPE, H5T_copy(mem_type)))<0 || - (dst_id = H5A_register(H5_DATATYPE, H5T_copy(dataset->type)))<0) { + if ((src_id = H5I_register(H5_DATATYPE, H5T_copy(mem_type)))<0 || + (dst_id = H5I_register(H5_DATATYPE, H5T_copy(dataset->type)))<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion"); } @@ -1510,8 +1510,8 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, ret_value = SUCCEED; done: - if (src_id >= 0) H5A_dec_ref(src_id); - if (dst_id >= 0) H5A_dec_ref(dst_id); + if (src_id >= 0) H5I_dec_ref(src_id); + if (dst_id >= 0) H5I_dec_ref(dst_id); if (tconv_buf && NULL==xfer_parms->tconv_buf) { H5MM_xfree(tconv_buf); } diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 14a471a..681928f 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -71,7 +71,7 @@ herr_t H5D_read (H5D_t *dataset, const H5T_t *mem_type, herr_t H5D_write (H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, const H5S_t *file_space, const H5D_xfer_t *xfer_parms, const void *buf); -hid_t H5D_find_name (hid_t file_id, group_t UNUSED, const char *name); +hid_t H5D_find_name (hid_t file_id, H5I_group_t UNUSED, const char *name); herr_t H5D_extend (H5D_t *dataset, const size_t *size); #endif diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 192ed96..2987056 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -18,7 +18,7 @@ /* Public headers needed by this file */ #include <H5public.h> -#include <H5Apublic.h> +#include <H5Ipublic.h> /* Values for the H5D_LAYOUT property */ typedef enum H5D_layout_t { @@ -29,7 +29,7 @@ * */ #include <H5private.h> /* Generic Functions */ -#include <H5Aprivate.h> /* Atoms */ +#include <H5Iprivate.h> /* IDs */ #include <H5Eprivate.h> /* Private error routines */ #include <H5MMprivate.h> /* Memory management */ diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 78af952..682be53 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -20,7 +20,7 @@ /* Public headers needed by this file */ #include <H5public.h> -#include <H5Apublic.h> +#include <H5Ipublic.h> /* * Declare an enumerated type which holds all the valid major HDF error codes. @@ -38,7 +38,7 @@ static char RcsId[] = "@(#)$Revision$"; /* Packages needed by this file... */ #include <H5private.h> /*library functions */ -#include <H5Aprivate.h> /*atoms */ +#include <H5Iprivate.h> /* IDs */ #include <H5ACprivate.h> /*cache */ #include <H5Eprivate.h> /*error handling */ #include <H5Gprivate.h> /*symbol tables */ @@ -133,7 +133,7 @@ H5F_init_interface(void) FUNC_ENTER(H5F_init_interface, FAIL); /* Initialize the atom group for the file IDs */ - if (H5A_init_group(H5_FILE, H5A_FILEID_HASHSIZE, 0, + if (H5I_init_group(H5_FILE, H5I_FILEID_HASHSIZE, 0, (herr_t (*)(void*))H5F_close)<0 || H5_add_exit(H5F_term_interface)<0) { HRETURN_ERROR (H5E_ATOM, H5E_CANTINIT, FAIL, @@ -184,7 +184,7 @@ H5F_init_interface(void) static void H5F_term_interface(void) { - H5A_destroy_group(H5_FILE); + H5I_destroy_group(H5_FILE); } @@ -254,7 +254,7 @@ H5Fget_create_template(hid_t fid) FUNC_ENTER(H5Fget_create_template, FAIL); /* check args */ - if (H5_FILE != H5A_group(fid) || NULL==(file=H5A_object (fid))) { + if (H5_FILE != H5I_group(fid) || NULL==(file=H5I_object (fid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); } @@ -304,7 +304,7 @@ H5Fget_access_template (hid_t file_id) FUNC_ENTER (H5Fget_access_template, FAIL); /* Check args */ - if (H5_FILE!=H5A_group (file_id) || NULL==(f=H5A_object (file_id))) { + if (H5_FILE!=H5I_group (file_id) || NULL==(f=H5I_object (file_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); } @@ -707,7 +707,7 @@ H5F_open(const char *name, uintn flags, HRETURN_ERROR(H5E_FILE, H5E_WRITEERROR, NULL, "file is not writable"); } - if ((old = H5A_search(H5_FILE, H5F_compare_files, &search))) { + if ((old = H5I_search(H5_FILE, H5F_compare_files, &search))) { if (flags & H5F_ACC_TRUNC) { HRETURN_ERROR(H5E_FILE, H5E_FILEOPEN, NULL, "file already open - TRUNC failed"); @@ -1074,14 +1074,14 @@ H5Fcreate(const char *filename, uintn flags, hid_t create_id, if (H5P_DEFAULT==create_id) { create_parms = &H5F_create_dflt; } else if (H5P_FILE_CREATE!=H5Pget_class (create_id) || - NULL == (create_parms = H5A_object(create_id))) { + NULL == (create_parms = H5I_object(create_id))) { HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file creation property list"); } if (H5P_DEFAULT==access_id) { access_parms = &H5F_access_dflt; } else if (H5P_FILE_ACCESS!=H5Pget_class (access_id) || - NULL == (access_parms = H5A_object(access_id))) { + NULL == (access_parms = H5I_object(access_id))) { HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); } @@ -1105,7 +1105,7 @@ H5Fcreate(const char *filename, uintn flags, hid_t create_id, } /* Get an atom for the file */ - if ((ret_value = H5A_register(H5_FILE, new_file)) < 0) { + if ((ret_value = H5I_register(H5_FILE, new_file)) < 0) { HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file"); } @@ -1179,7 +1179,7 @@ H5Fopen(const char *filename, uintn flags, hid_t access_id) if (H5P_DEFAULT==access_id) { access_parms = &H5F_access_dflt; } else if (H5P_FILE_ACCESS!=H5Pget_class (access_id) || - NULL == (access_parms = H5A_object(access_id))) { + NULL == (access_parms = H5I_object(access_id))) { HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); } @@ -1190,7 +1190,7 @@ H5Fopen(const char *filename, uintn flags, hid_t access_id) } /* Get an atom for the file */ - if ((ret_value = H5A_register(H5_FILE, new_file)) < 0) { + if ((ret_value = H5I_register(H5_FILE, new_file)) < 0) { HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't atomize file"); } @@ -1392,10 +1392,10 @@ H5Fclose(hid_t fid) FUNC_ENTER(H5Fclose, FAIL); /* Check/fix arguments. */ - if (H5_FILE != H5A_group(fid)) { + if (H5_FILE != H5I_group(fid)) { HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file atom"); } - if (NULL == H5A_object(fid)) { + if (NULL == H5I_object(fid)) { HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't unatomize file"); } @@ -1403,7 +1403,7 @@ H5Fclose(hid_t fid) * Decrement reference count on atom. When it reaches zero the file will * be closed. */ - H5A_dec_ref (fid); + H5I_dec_ref (fid); done: FUNC_LEAVE(ret_value < 0 ? FAIL : SUCCEED); diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index db209d2..1fb72af 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -18,7 +18,7 @@ /* Public header files needed by this file */ #include <H5public.h> -#include <H5Apublic.h> +#include <H5Ipublic.h> /* * These are the bits that can be passed to the `flags' argument of @@ -34,7 +34,7 @@ /* Packages needed by this file... */ #include <H5private.h> -#include <H5Aprivate.h> +#include <H5Iprivate.h> #include <H5Bprivate.h> #include <H5Eprivate.h> #include <H5Gpkg.h> @@ -94,8 +94,8 @@ H5Gcreate(hid_t file_id, const char *name, size_t size_hint) FUNC_ENTER(H5Gcreate, FAIL); /* Check arguments */ - if (H5_FILE != H5A_group(file_id) || - NULL == (f = H5A_object(file_id))) { + if (H5_FILE != H5I_group(file_id) || + NULL == (f = H5I_object(file_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); } if (!name || !*name) { @@ -105,7 +105,7 @@ H5Gcreate(hid_t file_id, const char *name, size_t size_hint) if (NULL == (grp = H5G_create(f, name, size_hint))) { HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group"); } - if ((ret_value = H5A_register(H5_GROUP, grp)) < 0) { + if ((ret_value = H5I_register(H5_GROUP, grp)) < 0) { H5G_close(grp); HRETURN_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group"); @@ -142,8 +142,8 @@ H5Gopen(hid_t file_id, const char *name) FUNC_ENTER(H5Gopen, FAIL); /* Check args */ - if (H5_FILE != H5A_group(file_id) || - NULL == (f = H5A_object(file_id))) { + if (H5_FILE != H5I_group(file_id) || + NULL == (f = H5I_object(file_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); } if (!name || !*name) { @@ -154,7 +154,7 @@ H5Gopen(hid_t file_id, const char *name) HRETURN_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group"); } /* Register an atom for the group */ - if ((ret_value = H5A_register(H5_GROUP, grp)) < 0) { + if ((ret_value = H5I_register(H5_GROUP, grp)) < 0) { H5G_close(grp); HRETURN_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group"); @@ -185,15 +185,15 @@ H5Gclose(hid_t grp_id) FUNC_ENTER(H5Gclose, FAIL); /* Check args */ - if (H5_GROUP != H5A_group(grp_id) || - NULL == H5A_object(grp_id)) { + if (H5_GROUP != H5I_group(grp_id) || + NULL == H5I_object(grp_id)) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group"); } /* * Decrement the counter on the group atom. It will be freed if the count * reaches zero. */ - if (H5A_dec_ref(grp_id) < 0) { + if (H5I_dec_ref(grp_id) < 0) { HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close group"); } FUNC_LEAVE(SUCCEED); @@ -235,8 +235,8 @@ H5Gset(hid_t file_id, const char *name) FUNC_ENTER(H5Gset, FAIL); /* Check/fix arguments */ - if (H5_FILE != H5A_group(file_id) || - NULL == (f = H5A_object(file_id))) { + if (H5_FILE != H5I_group(file_id) || + NULL == (f = H5I_object(file_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); } if (!name || !*name) { @@ -293,8 +293,8 @@ H5Gpush(hid_t file_id, const char *name) FUNC_ENTER(H5Gpush, FAIL); /* Check arguments */ - if (H5_FILE != H5A_group(file_id) || - NULL == (f = H5A_object(file_id))) { + if (H5_FILE != H5I_group(file_id) || + NULL == (f = H5I_object(file_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); } if (!name || !*name) { @@ -352,8 +352,8 @@ H5Gpop(hid_t file_id) FUNC_ENTER(H5Gpop, FAIL); /* Check arguments */ - if (H5_FILE != H5A_group(file_id) || - NULL == (f = H5A_object(file_id))) { + if (H5_FILE != H5I_group(file_id) || + NULL == (f = H5I_object(file_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); } /* pop */ @@ -394,7 +394,7 @@ H5G_init_interface(void) FUNC_ENTER(H5G_init_interface, FAIL); /* Initialize the atom group for the group IDs */ - if (H5A_init_group(H5_GROUP, H5A_GROUPID_HASHSIZE, H5G_RESERVED_ATOMS, + if (H5I_init_group(H5_GROUP, H5I_GROUPID_HASHSIZE, H5G_RESERVED_ATOMS, (herr_t (*)(void *)) H5G_close) < 0 || H5_add_exit(H5G_term_interface) < 0) { HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, @@ -420,7 +420,7 @@ H5G_init_interface(void) static void H5G_term_interface(void) { - H5A_destroy_group(H5_GROUP); + H5I_destroy_group(H5_GROUP); } /*------------------------------------------------------------------------- diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 3ca5cd4..b0a33b8 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -21,7 +21,7 @@ /* Public headers needed by this file */ #include <sys/types.h> #include <H5public.h> -#include <H5Apublic.h> +#include <H5Ipublic.h> #ifdef __cplusplus extern "C" { @@ -18,37 +18,37 @@ static char RcsId[] = "@(#)$Revision$"; /* FILE - atom.c - Internal storage routines for handling "atoms" + H5I.c - Internal storage routines for handling "IDs" REMARKS - Atoms are just ID's which allow objects (void *'s currently) to be - bundled into "groups" for more general storage. + ID's which allow objects (void *'s currently) to be bundled into "groups" + for more general storage. DESIGN The groups are stored in an array of pointers to store each group in an - element. Each "atomic group" node contains a link to a hash table to - manage the atoms in each group. The allowed "atomic groups" are stored - in an enum (called group_t) in atom.h. + element. Each "group" node contains a link to a hash table to manage the IDs + in each group. The allowed "groups" are stored in an enum (called group_t) + in H5Ipublic.h. BUGS/LIMITATIONS - Can't interate over the atoms in a group. + Can't interate over the IDs in a group. LOCAL ROUTINES - H5A_find_atom - Returns a pointer to an atom_info_t from a atom ID - H5A_get_atom_node - Gets an atom node (uses the atom free list) - H5A_release_atom_node - Releases an atom node (uses the atom free list) + H5I_find_id - Returns a pointer to an HAI_id_info_t from an ID + H5I_get_id_node - Gets an ID node (uses the ID free list) + H5I_release_id_node - Releases an ID node (uses the ID free list) EXPORTED ROUTINES - Atom Functions: - H5A_register - Register an object in a group and get an atom for it - H5A_object - Get the object for an atom - H5A_group - Get the group for an atom - H5A_remove - Remove an atom from a group - H5A_search - Search a group for a particular object - Atom Group Functions: - H5A_init_group - Initialize a group to store atoms in - H5A_destroy_group - Destroy an atomic group - Atom Group Cleanup: - H5Ashutdown - Terminate various static buffers. + ID Functions: + H5I_register - Register an object in a group and get an ID for it + H5I_object - Get the object for an ID + H5I_group - Get the group for an ID + H5I_remove - Remove an ID from a group + H5I_search - Search a group for a particular object + ID Group Functions: + H5I_init_group - Initialize a group to store IDs in + H5I_destroy_group - Destroy an ID group + ID Group Cleanup: + H5Ishutdown - Terminate various static buffers. AUTHOR Quincey Koziol @@ -60,68 +60,70 @@ static char RcsId[] = "@(#)$Revision$"; */ #include <H5private.h> -#include <H5Aprivate.h> +#include <H5Iprivate.h> #include <H5Eprivate.h> #include <H5MMprivate.h> -#define PABLO_MASK H5A_mask +#define PABLO_MASK H5I_mask /*-------------------- Locally scoped variables -----------------------------*/ -#ifdef ATOMS_ARE_CACHED -/* Array of pointers to atomic groups */ -static hid_t atom_id_cache[ATOM_CACHE_SIZE] = {-1, -1, -1, -1}; -static void *atom_obj_cache[ATOM_CACHE_SIZE]; +#ifdef IDS_ARE_CACHED +/* Array of pointers to ID groups */ +static hid_t H5I_id_cache[ID_CACHE_SIZE] = {-1, -1, -1, -1}; +static void *H5I_obj_cache[ID_CACHE_SIZE]; #endif /* Array of pointers to atomic groups */ -static atom_group_t *atom_group_list[MAXGROUP]; +static H5I_id_group_t *id_group_list[MAXGROUP]; /* Pointer to the atom node free list */ -static atom_info_t *atom_free_list = NULL; +static H5I_id_info_t *id_free_list = NULL; /* Interface initialialization? */ static hbool_t interface_initialize_g = FALSE; -#define INTERFACE_INIT H5A_init_interface -static herr_t H5A_init_interface(void); +#define INTERFACE_INIT H5I_init_interface +static herr_t H5I_init_interface(void); /*--------------------- Local function prototypes ---------------------------*/ -static atom_info_t *H5A_find_atom(hid_t atm); -static atom_info_t *H5A_get_atom_node(void); -static herr_t H5A_release_atom_node(atom_info_t *atm); +static H5I_id_info_t *H5I_find_id(hid_t id); +static H5I_id_info_t *H5I_get_id_node(void); +static herr_t H5I_release_id_node(H5I_id_info_t *id); + /*-------------------------------------------------------------------------- NAME - H5A_init_interface -- Initialize interface-specific information + H5I_init_interface -- Initialize interface-specific information USAGE - herr_t H5A_init_interface() + herr_t H5I_init_interface() RETURNS SUCCEED/FAIL DESCRIPTION Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ static herr_t -H5A_init_interface(void) +H5I_init_interface(void) { herr_t ret_value = SUCCEED; - FUNC_ENTER(H5A_init_interface, FAIL); + FUNC_ENTER(H5I_init_interface, FAIL); /* Registers the cleanup routine with the exit chain */ - ret_value = H5_add_exit(&H5A_term_interface); + ret_value = H5_add_exit(&H5I_term_interface); FUNC_LEAVE(ret_value); } + /****************************************************************************** NAME - H5A_init_group - Initialize an atomic group + H5I_init_group - Initialize an ID group DESCRIPTION - Creates a global atomic group to store atoms in. If the group has already + Creates a global ID group to store IDs in. If the group has already been initialized, this routine just increments the count of # of initializations and returns without trying to change the size of the hash table. A specific number of group entries may be reserved to enable - "constant" values to be handed out which are valid atoms in the group, but + "constant" values to be handed out which are valid IDs in the group, but which do not map to any data structures and are not allocated dynamicly later. @@ -130,16 +132,16 @@ H5A_init_interface(void) ******************************************************************************/ intn -H5A_init_group(group_t grp, /* IN: Group to initialize */ +H5I_init_group(H5I_group_t grp, /* IN: Group to initialize */ intn hash_size, /* IN: Minimum hash table size to use for group */ uintn reserved, /* IN: Number of hash table entries to reserve */ herr_t (*free_func) (void *) /* IN: Function to call when releasing ref counted objects */ ) { - atom_group_t *grp_ptr = NULL; /* ptr to the atomic group */ + H5I_id_group_t *grp_ptr = NULL; /* ptr to the atomic group */ intn ret_value = SUCCEED; - FUNC_ENTER(H5A_init_group, FAIL); + FUNC_ENTER(H5I_init_group, FAIL); if ((grp <= BADGROUP || grp >= MAXGROUP) && hash_size > 0) { HGOTO_DONE(FAIL); @@ -164,40 +166,34 @@ H5A_init_group(group_t grp, /* IN: Group to initialize */ HGOTO_DONE(FAIL); #endif /* HASH_SIZE_POWER_2 */ - if (atom_group_list[grp] == NULL) { + if (id_group_list[grp] == NULL) { /* Allocate the group information */ - grp_ptr = H5MM_xcalloc(1, sizeof(atom_group_t)); - atom_group_list[grp] = grp_ptr; + grp_ptr = H5MM_xcalloc(1, sizeof(H5I_id_group_t)); + id_group_list[grp] = grp_ptr; } else { /* Get the pointer to the existing group */ - grp_ptr = atom_group_list[grp]; + grp_ptr = id_group_list[grp]; } - if (grp_ptr->count == 0) { - /* Initialize the atom group structure */ + /* Initialize the ID group structure */ grp_ptr->hash_size = hash_size; grp_ptr->reserved = reserved; grp_ptr->wrapped = 0; - grp_ptr->atoms = 0; + grp_ptr->ids = 0; grp_ptr->nextid = reserved; grp_ptr->free_func = free_func; - grp_ptr->atom_list = H5MM_xcalloc(hash_size, sizeof(atom_info_t *)); + grp_ptr->id_list = H5MM_xcalloc(hash_size, sizeof(H5I_id_info_t *)); } /* Increment the count of the times this group has been initialized */ grp_ptr->count++; -#ifdef QAK - printf("%s: group ID=%d, count=%d, current # of active atoms=%d\n", - FUNC, grp, grp_ptr->count, grp_ptr->atoms); -#endif /* QAK */ - done: if (ret_value == FAIL) { /* Error condition cleanup */ if (grp_ptr != NULL) { - H5MM_xfree (grp_ptr->atom_list); + H5MM_xfree (grp_ptr->id_list); H5MM_xfree (grp_ptr); } } @@ -208,14 +204,14 @@ H5A_init_group(group_t grp, /* IN: Group to initialize */ /*------------------------------------------------------------------------- - * Function: H5A_destroy_group + * Function: H5I_destroy_group * - * Purpose: Decrements the reference count on an entire group of atoms. + * Purpose: Decrements the reference count on an entire group of IDs. * If the group reference count becomes zero then the group is * destroyed along with all atoms in that group regardless of - * their reference counts. Destroying atoms involves calling - * the free-func for each atom object and then adding the atom - * struct to the atom free list. + * their reference counts. Destroying IDs involves calling + * the free-func for each ID's object and then adding the ID + * struct to the ID free list. * * Return: Success: SUCCEED * @@ -226,31 +222,27 @@ H5A_init_group(group_t grp, /* IN: Group to initialize */ * Modifications: * * Robb Matzke, 25 Feb 1998 - * Atoms are freed when a group is destroyed. + * IDs are freed when a group is destroyed. * *------------------------------------------------------------------------- */ herr_t -H5A_destroy_group(group_t grp) +H5I_destroy_group(H5I_group_t grp) { - atom_group_t *grp_ptr = NULL; /* ptr to the atomic group */ - atom_info_t *cur=NULL, *next=NULL; + H5I_id_group_t *grp_ptr = NULL; /* ptr to the atomic group */ + H5I_id_info_t *cur=NULL, *next=NULL; intn ret_value = SUCCEED; intn i; - FUNC_ENTER(H5A_destroy_group, FAIL); + FUNC_ENTER(H5I_destroy_group, FAIL); if (grp <= BADGROUP || grp >= MAXGROUP) HGOTO_DONE(FAIL); - grp_ptr = atom_group_list[grp]; + grp_ptr = id_group_list[grp]; if (grp_ptr == NULL || grp_ptr->count <= 0) HGOTO_DONE(FAIL); -#ifdef QAK - printf("%s: group ID=%d, count=%d, current # of active atoms=%d\n", - FUNC, grp, grp_ptr->count, grp_ptr->atoms); -#endif /* QAK */ /* * Decrement the number of users of the atomic group. If this is the * last user of the group then release all atoms from the group. The @@ -258,37 +250,37 @@ H5A_destroy_group(group_t grp) */ if ((--(grp_ptr->count)) == 0) { -#ifdef ATOMS_ARE_CACHED +#ifdef IDS_ARE_CACHED /* * Remove atoms from the global atom cache. */ - for (i=0; i<ATOM_CACHE_SIZE; i++) { - if (ATOM_TO_GROUP(atom_id_cache[i]) == grp) { - atom_id_cache[i] = (-1); - atom_obj_cache[i] = NULL; + for (i=0; i<ID_CACHE_SIZE; i++) { + if (ID_TO_GROUP(H5I_id_cache[i]) == grp) { + H5I_id_cache[i] = (-1); + H5I_obj_cache[i] = NULL; } } -#endif /* ATOMS_ARE_CACHED */ +#endif /* IDS_ARE_CACHED */ /* * Free all objects. */ if (grp_ptr->free_func) { for (i=0; i<grp_ptr->hash_size; i++) { - for (cur=grp_ptr->atom_list[i]; cur; cur=next) { - /* Free the object */ - (grp_ptr->free_func)(cur->obj_ptr); - - /* Add atom struct to free list */ - next = cur->next; - cur->next = atom_free_list; - atom_free_list = cur; - } + for (cur=grp_ptr->id_list[i]; cur; cur=next) { + /* Free the object */ + (grp_ptr->free_func)(cur->obj_ptr); + + /* Add ID struct to free list */ + next = cur->next; + cur->next = id_free_list; + id_free_list = cur; + } } } /* Free local cache and reset group */ - H5MM_xfree(grp_ptr->atom_list); + H5MM_xfree(grp_ptr->id_list); HDmemset (grp_ptr, 0, sizeof(grp_ptr)); } @@ -298,66 +290,66 @@ H5A_destroy_group(group_t grp) /****************************************************************************** NAME - H5A_register - Register an object in a group and get an atom for it. + H5I_register - Register an object in a group and get an ID for it. DESCRIPTION - Registers an object in a group and returns an atom for it. This routine + Registers an object in a group and returns an ID for it. This routine does _not_ check for unique-ness of the objects, if you register an object - twice, you will get two different atoms for it. This routine does make - certain that each atom in a group is unique. Atoms are created by getting - a unique number for the group the atom is in and incorporating the group - into the atom which is returned to the user. + twice, you will get two different IDs for it. This routine does make + certain that each ID in a group is unique. IDs are created by getting + a unique number for the group the ID is in and incorporating the group + into the ID which is returned to the user. RETURNS - Returns atom if successful and FAIL otherwise + Returns ID if successful and FAIL otherwise *******************************************************************************/ hid_t -H5A_register(group_t grp, /* IN: Group to register the object in */ +H5I_register(H5I_group_t grp, /* IN: Group to register the object in */ void *object /* IN: Object to attach to atom */ ) { - atom_group_t *grp_ptr = NULL; /* ptr to the atomic group */ - atom_info_t *atm_ptr = NULL; /* ptr to the new atom */ - hid_t atm_id; /* new atom ID */ + H5I_id_group_t *grp_ptr = NULL; /* ptr to the group */ + H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID information */ + hid_t new_id; /* new ID */ uintn hash_loc; /* new item's hash table location */ hid_t ret_value = SUCCEED; - FUNC_ENTER(H5A_register, FAIL); + FUNC_ENTER(H5I_register, FAIL); if (grp <= BADGROUP || grp >= MAXGROUP) HGOTO_DONE(FAIL); - grp_ptr = atom_group_list[grp]; + grp_ptr = id_group_list[grp]; if (grp_ptr == NULL || grp_ptr->count <= 0) HGOTO_DONE(FAIL); - if ((atm_ptr = H5A_get_atom_node()) == NULL) + if ((id_ptr = H5I_get_id_node()) == NULL) HGOTO_DONE(FAIL); - /* Create the atom & it's ID */ - atm_id = MAKE_ATOM(grp, grp_ptr->nextid); - atm_ptr->id = atm_id; - atm_ptr->count = 1; /*initial reference count*/ - atm_ptr->obj_ptr = object; - atm_ptr->next = NULL; + /* Create the struct & it's ID */ + new_id = MAKE_ID(grp, grp_ptr->nextid); + id_ptr->id = new_id; + id_ptr->count = 1; /*initial reference count*/ + id_ptr->obj_ptr = object; + id_ptr->next = NULL; /* hash bucket already full, prepend to front of chain */ hash_loc = grp_ptr->nextid % (uintn) grp_ptr->hash_size; - if (grp_ptr->atom_list[hash_loc] != NULL) - atm_ptr->next = grp_ptr->atom_list[hash_loc]; + if (grp_ptr->id_list[hash_loc] != NULL) + id_ptr->next = grp_ptr->id_list[hash_loc]; /* Insert into the group */ - grp_ptr->atom_list[hash_loc] = atm_ptr; - grp_ptr->atoms++; + grp_ptr->id_list[hash_loc] = id_ptr; + grp_ptr->ids++; grp_ptr->nextid++; /* * This next section of code checks for the 'nextid' getting too large and - * wrapping around, thus necessitating checking for duplicate atoms being + * wrapping around, thus necessitating checking for duplicate IDs being * handed out. */ - if (grp_ptr->nextid > (uintn) ATOM_MASK || grp_ptr->wrapped != 0) { + if (grp_ptr->nextid > (uintn) ID_MASK || grp_ptr->wrapped != 0) { if (grp_ptr->wrapped == 0) { /* set the "wrapped around" flag if it isn't already */ grp_ptr->wrapped = 1; @@ -366,28 +358,28 @@ H5A_register(group_t grp, /* IN: Group to register the object in */ } do { - /* new atom to check for */ - hid_t next_atom = MAKE_ATOM(grp, grp_ptr->nextid); - atom_info_t *curr_atm; /* ptr to the current atom */ - hash_loc = ATOM_TO_LOC (grp_ptr->nextid, grp_ptr->hash_size); + /* new ID to check for */ + hid_t next_id = MAKE_ID(grp, grp_ptr->nextid); + H5I_id_info_t *curr_id; /* ptr to the current atom */ + hash_loc = ID_TO_LOC (grp_ptr->nextid, grp_ptr->hash_size); - curr_atm = grp_ptr->atom_list[hash_loc]; - if (curr_atm == NULL) break; /* Ha! this is not likely... */ + curr_id = grp_ptr->id_list[hash_loc]; + if (curr_id == NULL) break; /* Ha! this is not likely... */ - while (curr_atm != NULL) { - if (curr_atm->id == next_atom) break; - curr_atm = curr_atm->next; + while (curr_id != NULL) { + if (curr_id->id == next_id) break; + curr_id = curr_id->next; } - if (curr_atm == NULL) break; /* must not have found a match */ + if (curr_id == NULL) break; /* must not have found a match */ grp_ptr->nextid++; - } while (grp_ptr->nextid <= (uintn) ATOM_MASK); + } while (grp_ptr->nextid <= (uintn) ID_MASK); - if (grp_ptr->nextid > (uintn) ATOM_MASK) { - /* All the atoms are gone! */ + if (grp_ptr->nextid > (uintn) ID_MASK) { + /* All the IDs are gone! */ HGOTO_DONE(FAIL); } } - ret_value = atm_id; + ret_value = new_id; done: if (ret_value == FAIL) { @@ -400,35 +392,35 @@ H5A_register(group_t grp, /* IN: Group to register the object in */ /****************************************************************************** NAME - H5A_inc_ref - Adds a reference to a reference counted atom. - IN: Atom to increment reference count for + H5I_inc_ref - Adds a reference to a reference counted ID. + IN: ID to increment reference count for DESCRIPTION - Increments the number of references outstanding for an atom. This will + Increments the number of references outstanding for an ID. This will fail if the group is not a reference counted group. RETURNS - atm/FAIL + ID/FAIL *******************************************************************************/ hid_t -H5A_inc_ref(hid_t atm) +H5I_inc_ref(hid_t id) { - group_t grp = ATOM_TO_GROUP(atm); /* object's group */ - atom_group_t *grp_ptr = NULL; /* ptr to the atomic group*/ - atom_info_t *atm_ptr = NULL; /* ptr to the new atom */ + H5I_group_t grp = ID_TO_GROUP(id); /* object's group */ + H5I_id_group_t *grp_ptr = NULL; /* ptr to the ID group*/ + H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID */ hid_t ret_value = FAIL; - FUNC_ENTER(H5A_inc_ref, FAIL); + FUNC_ENTER(H5I_inc_ref, FAIL); - grp_ptr = atom_group_list[grp]; + grp_ptr = id_group_list[grp]; if (grp_ptr == NULL || grp_ptr->count <= 0 || grp_ptr->free_func == NULL) { HRETURN(FAIL); } /* General lookup of the atom */ - if (NULL!=(atm_ptr = H5A_find_atom(atm))) { - atm_ptr->count++; - ret_value = atm; + if (NULL!=(id_ptr = H5I_find_id(id))) { + id_ptr->count++; + ret_value = id; } FUNC_LEAVE(ret_value); @@ -436,29 +428,29 @@ H5A_inc_ref(hid_t atm) /****************************************************************************** NAME - H5A_object - Returns to the object ptr for the atom + H5I_object - Returns to the object ptr for the ID DESCRIPTION - Retrieves the object ptr which is associated with the atom. + Retrieves the object ptr which is associated with the ID. RETURNS Returns object ptr if successful and NULL otherwise *******************************************************************************/ void * -H5A_object(hid_t atm) +H5I_object(hid_t id) { -#ifdef ATOMS_ARE_CACHED +#ifdef IDS_ARE_CACHED uintn i; /* local counter */ -#endif /* ATOMS_ARE_CACHED */ - atom_info_t *atm_ptr = NULL; /* ptr to the new atom */ +#endif /* IDS_ARE_CACHED */ + H5I_id_info_t *id_ptr = NULL; /* ptr to the new atom */ void *ret_value = NULL; - FUNC_ENTER(H5A_object, NULL); + FUNC_ENTER(H5I_object, NULL); -#ifdef ATOMS_ARE_CACHED +#ifdef IDS_ARE_CACHED /* - * Look for the atom in the cache first. Implement a simple "move + * Look for the ID in the cache first. Implement a simple "move * forward" caching scheme by swapping the found cache item with the * previous cache item. This gradually migrates used cache items toward * the front of the cache and unused items toward the end. For instance, @@ -468,26 +460,26 @@ H5A_object(hid_t atm) * | | | X | | | | | * After: a b c e d f g h i j */ - for (i=0; i<ATOM_CACHE_SIZE; i++) - if (atom_id_cache[i] == atm) { - ret_value = atom_obj_cache[i]; + for (i=0; i<ID_CACHE_SIZE; i++) + if (H5I_id_cache[i] == id) { + ret_value = H5I_obj_cache[i]; if (i > 0) { - hid_t t_atom = atom_id_cache[i-1]; - void *t_obj = atom_obj_cache[i-1]; - atom_id_cache[i-1] = atom_id_cache[i]; - atom_obj_cache[i-1] = atom_obj_cache[i]; - atom_id_cache[i] = t_atom; - atom_obj_cache[i] = t_obj; + hid_t t_id = H5I_id_cache[i-1]; + void *t_obj = H5I_obj_cache[i-1]; + H5I_id_cache[i-1] = H5I_id_cache[i]; + H5I_obj_cache[i-1] = H5I_obj_cache[i]; + H5I_id_cache[i] = t_id; + H5I_obj_cache[i] = t_obj; } HGOTO_DONE(ret_value); } -#endif /* ATOMS_ARE_CACHED */ +#endif /* IDS_ARE_CACHED */ - /* General lookup of the atom */ - if ((atm_ptr = H5A_find_atom(atm)) == NULL) HGOTO_DONE(NULL); + /* General lookup of the ID */ + if ((id_ptr = H5I_find_id(id)) == NULL) HGOTO_DONE(NULL); - /* Check if we've found the correct atom */ - if (atm_ptr != NULL) ret_value = atm_ptr->obj_ptr; + /* Check if we've found the correct ID */ + if (id_ptr != NULL) ret_value = id_ptr->obj_ptr; done: FUNC_LEAVE(ret_value); @@ -495,23 +487,23 @@ H5A_object(hid_t atm) /****************************************************************************** NAME - H5A_group - Returns to the group for the atom + H5I_group - Returns to the group for the ID DESCRIPTION - Retrieves the group which is associated with the atom. + Retrieves the group which is associated with the ID. RETURNS Returns group if successful and BADGROUP otherwise *******************************************************************************/ -group_t -H5A_group(hid_t atm) +H5I_group_t +H5I_group(hid_t id) { - group_t ret_value = BADGROUP; + H5I_group_t ret_value = BADGROUP; - FUNC_ENTER(H5A_group, BADGROUP); + FUNC_ENTER(H5I_group, BADGROUP); - ret_value = ATOM_TO_GROUP(atm); + ret_value = ID_TO_GROUP(id); if (ret_value <= BADGROUP || ret_value >= MAXGROUP) { HGOTO_DONE(BADGROUP); } @@ -523,74 +515,74 @@ H5A_group(hid_t atm) /****************************************************************************** NAME - H5A_remove - Removes an atom from a group + H5I_remove - Removes an ID from a group DESCRIPTION - Removes an atom from a group. + Removes an ID from a group. RETURNS - Returns atom's object if successful and NULL otherwise + Returns ID's object if successful and NULL otherwise *******************************************************************************/ void * -H5A_remove(hid_t atm) +H5I_remove(hid_t id) { - atom_group_t *grp_ptr = NULL;/* ptr to the atomic group */ - atom_info_t *curr_atm, /* ptr to the current atom */ - *last_atm; /* ptr to the last atom */ - group_t grp; /* atom's atomic group */ + H5I_id_group_t *grp_ptr = NULL;/* ptr to the atomic group */ + H5I_id_info_t *curr_id, /* ptr to the current atom */ + *last_id; /* ptr to the last atom */ + H5I_group_t grp; /* atom's atomic group */ uintn hash_loc; /* atom's hash table location */ -#ifdef ATOMS_ARE_CACHED +#ifdef IDS_ARE_CACHED uintn i; /* local counting variable */ #endif void * ret_value = NULL; - FUNC_ENTER(H5A_remove, NULL); + FUNC_ENTER(H5I_remove, NULL); - grp = ATOM_TO_GROUP(atm); + grp = ID_TO_GROUP(id); if (grp <= BADGROUP || grp >= MAXGROUP) HGOTO_DONE(NULL); - grp_ptr = atom_group_list[grp]; + grp_ptr = id_group_list[grp]; if (grp_ptr == NULL || grp_ptr->count <= 0) HGOTO_DONE(NULL); - /* Get the location in which the atom is located */ - hash_loc = (uintn) ATOM_TO_LOC(atm, grp_ptr->hash_size); - curr_atm = grp_ptr->atom_list[hash_loc]; - if (curr_atm == NULL) HGOTO_DONE(NULL); + /* Get the location in which the ID is located */ + hash_loc = (uintn) ID_TO_LOC(id, grp_ptr->hash_size); + curr_id = grp_ptr->id_list[hash_loc]; + if (curr_id == NULL) HGOTO_DONE(NULL); - last_atm = NULL; - while (curr_atm != NULL) { - if (curr_atm->id == atm) break; - last_atm = curr_atm; - curr_atm = curr_atm->next; + last_id = NULL; + while (curr_id != NULL) { + if (curr_id->id == id) break; + last_id = curr_id; + curr_id = curr_id->next; } - if (curr_atm != NULL) { - if (last_atm == NULL) { - /* atom is the first the chain */ - grp_ptr->atom_list[hash_loc] = curr_atm->next; + if (curr_id != NULL) { + if (last_id == NULL) { + /* ID is the first the chain */ + grp_ptr->id_list[hash_loc] = curr_id->next; } else { - last_atm->next = curr_atm->next; + last_id->next = curr_id->next; } - ret_value = curr_atm->obj_ptr; - H5A_release_atom_node(curr_atm); + ret_value = curr_id->obj_ptr; + H5I_release_id_node(curr_id); } else { - /* couldn't find the atom in the proper place */ + /* couldn't find the ID in the proper place */ HGOTO_DONE(NULL); } -#ifdef ATOMS_ARE_CACHED +#ifdef IDS_ARE_CACHED /* Delete object from cache */ - for (i = 0; i < ATOM_CACHE_SIZE; i++) - if (atom_id_cache[i] == atm) { - atom_id_cache[i] = (-1); - atom_obj_cache[i] = NULL; + for (i = 0; i < ID_CACHE_SIZE; i++) + if (H5I_id_cache[i] == id) { + H5I_id_cache[i] = (-1); + H5I_obj_cache[i] = NULL; break; /* we assume there is only one instance in the cache */ } -#endif /* ATOMS_ARE_CACHED */ +#endif /* IDS_ARE_CACHED */ - /* Decrement the number of atoms in the group */ - (grp_ptr->atoms)--; + /* Decrement the number of IDs in the group */ + (grp_ptr->ids)--; done: FUNC_LEAVE(ret_value); @@ -598,12 +590,12 @@ H5A_remove(hid_t atm) /*------------------------------------------------------------------------- - * Function: H5A_dec_ref + * Function: H5I_dec_ref * - * Purpose: Decrements the number of references outstanding for an atom. + * Purpose: Decrements the number of references outstanding for an ID. * This will fail if the group is not a reference counted group. - * The atom group's 'free' function will be called for the atom - * if the reference count for the atom reaches 0 and a free + * The ID group's 'free' function will be called for the ID + * if the reference count for the ID reaches 0 and a free * function has been defined at group creation time. * * Return: Success: New reference count. @@ -622,28 +614,28 @@ H5A_remove(hid_t atm) *------------------------------------------------------------------------- */ intn -H5A_dec_ref(hid_t atm) +H5I_dec_ref(hid_t id) { - group_t grp = ATOM_TO_GROUP(atm); /* Group the object is in */ - atom_group_t *grp_ptr = NULL; /* ptr to the atomic group */ - atom_info_t *atm_ptr = NULL; /* ptr to the new atom */ + H5I_group_t grp = ID_TO_GROUP(id); /* Group the object is in */ + H5I_id_group_t *grp_ptr = NULL; /* ptr to the group */ + H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID */ void * obj; /* object to call 'free' function with */ intn ret_value = FAIL; - FUNC_ENTER(H5A_dec_ref, FAIL); + FUNC_ENTER(H5I_dec_ref, FAIL); - grp_ptr = atom_group_list[grp]; + grp_ptr = id_group_list[grp]; if (grp_ptr == NULL || grp_ptr->count <= 0) { HRETURN(FAIL); } - /* General lookup of the atom */ - if ((atm_ptr = H5A_find_atom(atm)) != NULL) { + /* General lookup of the ID */ + if ((id_ptr = H5I_find_id(id)) != NULL) { /* Decrement the reference count */ - ret_value = --(atm_ptr->count); + ret_value = --(id_ptr->count); /* If the reference count is zero, remove the object from the group */ - if (0 == atm_ptr->count && (obj = H5A_remove(atm)) != NULL) { + if (0 == id_ptr->count && (obj = H5I_remove(id)) != NULL) { /* * call the user's 'free' function for the atom's information, * otherwise just leak memory. @@ -657,7 +649,7 @@ H5A_dec_ref(hid_t atm) /****************************************************************************** NAME - H5A_search - Search for an object in a group and get it's pointer. + H5I_search - Search for an object in a group and get it's pointer. DESCRIPTION Searchs for an object in a group and returns the pointer to it. @@ -666,36 +658,36 @@ H5A_dec_ref(hid_t atm) search. RETURNS - Returns pointer an atom's object if successful and NULL otherwise + Returns pointer an ID's object if successful and NULL otherwise *******************************************************************************/ void * -H5A_search(group_t grp, /* IN: Group to search for the object in */ - H5A_search_func_t func, /* IN: Ptr to the comparison function */ +H5I_search(H5I_group_t grp, /* IN: Group to search for the object in */ + H5I_search_func_t func, /* IN: Ptr to the comparison function */ const void *key /* IN: pointer to key to compare against */ ) { - atom_group_t *grp_ptr = NULL; /* ptr to the atomic group */ - atom_info_t *atm_ptr = NULL; /* ptr to the new atom */ + H5I_id_group_t *grp_ptr = NULL; /* ptr to the group */ + H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID */ intn i; /* local counting variable */ void * ret_value = NULL; - FUNC_ENTER(H5A_search, NULL); + FUNC_ENTER(H5I_search, NULL); if (grp <= BADGROUP || grp >= MAXGROUP) HGOTO_DONE(NULL); - grp_ptr = atom_group_list[grp]; + grp_ptr = id_group_list[grp]; if (grp_ptr == NULL || grp_ptr->count <= 0) HGOTO_DONE(NULL); /* Start at the beginning of the array */ for (i = 0; i < grp_ptr->hash_size; i++) { - atm_ptr = grp_ptr->atom_list[i]; - while (atm_ptr != NULL) { - if ((*func) (atm_ptr->obj_ptr, key)) - HGOTO_DONE(atm_ptr->obj_ptr); /* found the item we are looking for */ - atm_ptr = atm_ptr->next; + id_ptr = grp_ptr->id_list[i]; + while (id_ptr != NULL) { + if ((*func) (id_ptr->obj_ptr, key)) + HGOTO_DONE(id_ptr->obj_ptr); /* found the item we are looking for */ + id_ptr = id_ptr->next; } } @@ -705,50 +697,50 @@ H5A_search(group_t grp, /* IN: Group to search for the object in */ /****************************************************************************** NAME - H5A_find_atom - Finds a atom in a group + H5I_find_id - Finds a ID in a group DESCRIPTION - Retrieves the atom ptr which is associated with the atom. + Retrieves the ID ptr which is associated with the ID. RETURNS - Returns atom ptr if successful and NULL otherwise + Returns ID ptr if successful and NULL otherwise *******************************************************************************/ -static atom_info_t * -H5A_find_atom(hid_t atm) +static H5I_id_info_t * +H5I_find_id(hid_t id) { - atom_group_t *grp_ptr = NULL; /* ptr to the atomic group */ - atom_info_t *atm_ptr = NULL; /* ptr to the new atom */ - group_t grp; /* atom's atomic group */ - uintn hash_loc; /* atom's hash table location */ - atom_info_t *ret_value = NULL; + H5I_id_group_t *grp_ptr = NULL; /* ptr to the group */ + H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID */ + H5I_group_t grp; /* ID's group */ + uintn hash_loc; /* ID's hash table location */ + H5I_id_info_t *ret_value = NULL; - FUNC_ENTER(H5A_find_atom, NULL); + FUNC_ENTER(H5I_find_id, NULL); - grp = ATOM_TO_GROUP(atm); + grp = ID_TO_GROUP(id); if (grp <= BADGROUP || grp >= MAXGROUP) HGOTO_DONE(NULL); - grp_ptr = atom_group_list[grp]; + grp_ptr = id_group_list[grp]; if (grp_ptr == NULL || grp_ptr->count <= 0) HGOTO_DONE(NULL); - /* Get the location in which the atom is located */ - hash_loc = (uintn) ATOM_TO_LOC(atm, grp_ptr->hash_size); - atm_ptr = grp_ptr->atom_list[hash_loc]; - if (atm_ptr == NULL) + /* Get the location in which the ID is located */ + hash_loc = (uintn) ID_TO_LOC(id, grp_ptr->hash_size); + id_ptr = grp_ptr->id_list[hash_loc]; + if (id_ptr == NULL) HGOTO_DONE(NULL); - while (atm_ptr != NULL) { - if (atm_ptr->id == atm) break; - atm_ptr = atm_ptr->next; + while (id_ptr != NULL) { + if (id_ptr->id == id) break; + id_ptr = id_ptr->next; } - ret_value = atm_ptr; + ret_value = id_ptr; -#ifdef ATOMS_ARE_CACHED - atom_id_cache[ATOM_CACHE_SIZE-1] = atm; - atom_obj_cache[ATOM_CACHE_SIZE-1] = atm_ptr->obj_ptr; -#endif /* ATOMS_ARE_CACHED */ +#ifdef IDS_ARE_CACHED + H5I_id_cache[ID_CACHE_SIZE-1] = id; + H5I_obj_cache[ID_CACHE_SIZE-1] = id_ptr->obj_ptr; +#endif /* IDS_ARE_CACHED */ done: FUNC_LEAVE(ret_value); @@ -756,28 +748,28 @@ H5A_find_atom(hid_t atm) /****************************************************************************** NAME - H5A_get_atom_node - Gets an atom node + H5I_get_idm_node - Gets an ID node DESCRIPTION - Either gets an atom node from the free list (if there is one available) + Either gets an ID node from the free list (if there is one available) or allocate a node. RETURNS - Returns atom ptr if successful and NULL otherwise + Returns ID ptr if successful and NULL otherwise *******************************************************************************/ -static atom_info_t * -H5A_get_atom_node(void) +static H5I_id_info_t * +H5I_get_id_node(void) { - atom_info_t *ret_value = NULL; + H5I_id_info_t *ret_value = NULL; - FUNC_ENTER(H5A_get_atom_node, NULL); + FUNC_ENTER(H5I_get_id_node, NULL); - if (atom_free_list != NULL) { - ret_value = atom_free_list; - atom_free_list = atom_free_list->next; + if (id_free_list != NULL) { + ret_value = id_free_list; + id_free_list = id_free_list->next; } else { - ret_value = H5MM_xmalloc(sizeof(atom_info_t)); + ret_value = H5MM_xmalloc(sizeof(H5I_id_info_t)); } FUNC_LEAVE(ret_value); @@ -785,38 +777,38 @@ H5A_get_atom_node(void) /****************************************************************************** NAME - H5A_release_atom_node - Releases an atom node + H5I_release_id_node - Releases an ID node DESCRIPTION - Puts an atom node into the free list + Puts an ID node into the free list RETURNS SUCCEED *******************************************************************************/ static herr_t -H5A_release_atom_node(atom_info_t *atm) +H5I_release_id_node(H5I_id_info_t *id) { - FUNC_ENTER(H5A_release_atom_node, FAIL); + FUNC_ENTER(H5I_release_id_node, FAIL); - /* Insert the atom at the beginning of the free list */ - atm->next = atom_free_list; - atom_free_list = atm; + /* Insert the ID at the beginning of the free list */ + id->next = id_free_list; + id_free_list = id; FUNC_LEAVE(SUCCEED); } /*-------------------------------------------------------------------------- NAME - H5A_term_interface + H5I_term_interface PURPOSE Terminate various static buffers. USAGE - intn H5A_term_interface() + intn H5I_term_interface() RETURNS Returns SUCCEED/FAIL DESCRIPTION - Free various buffers allocated in the H5A routines. + Free various buffers allocated in the H5I routines. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Should only ever be called by the "atexit" function HDFend @@ -824,25 +816,25 @@ H5A_release_atom_node(atom_info_t *atm) REVISION LOG --------------------------------------------------------------------------*/ void -H5A_term_interface(void) +H5I_term_interface(void) { - atom_info_t *curr; + H5I_id_info_t *curr; intn i; /* Release the free-list if it exists */ - if (atom_free_list != NULL) { - while (atom_free_list != NULL) { - curr = atom_free_list; - atom_free_list = atom_free_list->next; + if (id_free_list != NULL) { + while (id_free_list != NULL) { + curr = id_free_list; + id_free_list = id_free_list->next; HDfree(curr); } } /* Release all groups */ for (i = 0; i < (intn) MAXGROUP; i++) { - if (atom_group_list[i] != NULL) { - HDfree(atom_group_list[i]); - atom_group_list[i] = NULL; + if (id_group_list[i] != NULL) { + HDfree(id_group_list[i]); + id_group_list[i] = NULL; } } } diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h new file mode 100644 index 0000000..c339390 --- /dev/null +++ b/src/H5Iprivate.h @@ -0,0 +1,107 @@ +/**************************************************************************** + * 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. * + * * + ****************************************************************************/ + +/*----------------------------------------------------------------------------- + * File: H5Iprivate.h + * Purpose: header file for ID API + *---------------------------------------------------------------------------*/ + +/* avoid re-inclusion */ +#ifndef _H5Iprivate_H +#define _H5Iprivate_H + +#include <H5Ipublic.h> /*include Public Definitions */ + +/* Private headers needed by this file */ +#include <H5private.h> + +/* ID Feature controls */ + +/* + * Define the following macro for fast hash calculations (but limited + * hash sizes) + */ +#define HASH_SIZE_POWER_2 + +/* Define the following macro for atom caching over all the atoms */ +#define IDS_ARE_CACHED + +#ifdef IDS_ARE_CACHED +# define ID_CACHE_SIZE 4 /*# of previous atoms cached */ +#endif + +/* Map an atom to a Group number */ +#define ID_TO_GROUP(a) ((H5I_group_t)((((hid_t)(a))>> \ + ((sizeof(hid_t)*8)-GROUP_BITS))&GROUP_MASK)) + +#ifdef HASH_SIZE_POWER_2 + +/* + * Map an ID to a hash location (assumes s is a power of 2 and smaller + * than the ID_MASK constant). + */ +# define ID_TO_LOC(a,s) ((hid_t)(a)&((s)-1)) +#else + +/* + * Map an ID to a hash location. + */ +# define ID_TO_LOC(a,s) (((hid_t)(a)&ID_MASK)%(s)) +#endif + +/* Default sizes of the hash-tables for various atom groups */ +#define H5I_ERRSTACK_HASHSIZE 64 +#define H5I_FILEID_HASHSIZE 64 +#define H5I_TEMPID_HASHSIZE 64 +#define H5I_DATATYPEID_HASHSIZE 64 +#define H5I_DATASPACEID_HASHSIZE 64 +#define H5I_DATASETID_HASHSIZE 64 +#define H5I_OID_HASHSIZE 64 +#define H5I_GROUPID_HASHSIZE 64 + +/* Atom information structure used */ +typedef struct H5I_id_info_t { + hid_t id; /* ID for this info */ + uintn count; /* ref. count for this atom */ + void *obj_ptr; /* pointer associated with the atom */ + struct H5I_id_info_t *next; /* link to next atom (in case of hash-clash)*/ +} H5I_id_info_t; + +/* ID group structure used */ +typedef struct { + uintn count; /*# of times this group has been initialized */ + uintn reserved; /*# of IDs to reserve for constant IDs */ + uintn wrapped; /*whether the id count has wrapped around */ + intn hash_size; /*sizeof the hash table to store the IDs in*/ + uintn ids; /*current number of IDs held */ + uintn nextid; /*ID to use for the next atom */ + herr_t (*free_func)(void*);/*func to call to release object */ + H5I_id_info_t **id_list; /*pointer to an array of ptrs to IDs */ +} H5I_id_group_t; + +/* Type of the function to compare objects & keys */ +typedef intn (*H5I_search_func_t) (const void * obj, const void * key); + +/* Private Functions in H5I.c */ +intn H5I_init_group (H5I_group_t grp, intn hash_size, uintn reserved, + herr_t (*free_func)(void *)); +herr_t H5I_destroy_group (H5I_group_t grp); +hid_t H5I_register (H5I_group_t grp, void *object); +void *H5I_object (hid_t id); +H5I_group_t H5I_group (hid_t id); +void *H5I_remove (hid_t id); +void *H5I_search (H5I_group_t grp, H5I_search_func_t func, const void *key); +void H5I_term_interface (void); +intn H5I_dec_ref (hid_t id); +hid_t H5I_inc_ref (hid_t id); + +#endif diff --git a/src/H5Apublic.h b/src/H5Ipublic.h index 648e852..bb1dfc4 100644 --- a/src/H5Apublic.h +++ b/src/H5Ipublic.h @@ -12,10 +12,10 @@ /* * This file contains function prototypes for each exported function in - * the H5A module. + * the H5I module. */ -#ifndef _H5Apublic_H -#define _H5Apublic_H +#ifndef _H5Ipublic_H +#define _H5Ipublic_H /* Public headers needed by this file */ #include <H5public.h> @@ -41,7 +41,7 @@ typedef enum { H5_DATASET, /*group ID for Dataset objects */ H5_DIRECTORY, /*group ID for Directory objects */ MAXGROUP /*highest group in group_t (Invalid as true group)*/ -} group_t; +} H5I_group_t; /* Type of atoms to return to users */ typedef int hid_t; @@ -51,12 +51,12 @@ typedef int hid_t; #define GROUP_MASK 0xFF /* # of bits to use for the Atom index in each atom (assumes 8-bit bytes) */ -#define ATOM_BITS ((sizeof(hid_t)*8)-GROUP_BITS) -#define ATOM_MASK 0x0FFFFFFF +#define ID_BITS ((sizeof(hid_t)*8)-GROUP_BITS) +#define ID_MASK 0x0FFFFFFF /* Combine a Group number and an atom index into an atom */ -#define MAKE_ATOM(g,i) ((((hid_t)(g)&GROUP_MASK)<<ATOM_BITS)| \ - ((hid_t)(i)&ATOM_MASK)) +#define MAKE_ID(g,i) ((((hid_t)(g)&GROUP_MASK)<<ID_BITS)| \ + ((hid_t)(i)&ID_MASK)) #ifdef __cplusplus extern "C" { @@ -20,7 +20,7 @@ static char RcsId[] = "@(#)$Revision$"; /* Private header files */ #include <H5private.h> /* Generic Functions */ -#include <H5Aprivate.h> /* Atoms */ +#include <H5Iprivate.h> /* IDs */ #include <H5Bprivate.h> /* B-tree subclass names */ #include <H5Dprivate.h> /* Datasets */ #include <H5Eprivate.h> /* Error handling */ @@ -76,8 +76,8 @@ H5P_init_interface(void) * atom groups aren't. */ for (i = 0; i < H5P_NCLASSES; i++) { - status = H5A_init_group((group_t)(H5_TEMPLATE_0 +i), - H5A_TEMPID_HASHSIZE, 0, NULL); + status = H5I_init_group((H5I_group_t)(H5_TEMPLATE_0 +i), + H5I_TEMPID_HASHSIZE, 0, NULL); if (status < 0) ret_value = FAIL; } if (ret_value < 0) { @@ -119,7 +119,7 @@ H5P_term_interface(void) intn i; for (i = 0; i < H5P_NCLASSES; i++) { - H5A_destroy_group((group_t)(H5_TEMPLATE_0 + i)); + H5I_destroy_group((H5I_group_t)(H5_TEMPLATE_0 + i)); } } @@ -215,7 +215,7 @@ H5P_create(H5P_class_t type, void *tmpl) assert(tmpl); /* Atomize the new template */ - if ((ret_value=H5A_register((group_t)(H5_TEMPLATE_0+type), tmpl)) < 0) { + if ((ret_value=H5I_register((H5I_group_t)(H5_TEMPLATE_0+type), tmpl)) < 0) { HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "can't register template"); } @@ -246,17 +246,17 @@ H5Pclose(hid_t tid) /* Check arguments */ if ((type=H5Pget_class (tid))<0 || - NULL==(tmpl=H5A_object (tid))) { + NULL==(tmpl=H5I_object (tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); } /* * Chuck the object! When the reference count reaches zero then - * H5A_dec_ref() removes it from the group and we should free it. The + * H5I_dec_ref() removes it from the group and we should free it. The * free function is not registered as part of the group because it takes * an extra argument. */ - if (0==H5A_dec_ref(tid)) H5P_close (type, tmpl); + if (0==H5I_dec_ref(tid)) H5P_close (type, tmpl); FUNC_LEAVE (SUCCEED); } @@ -365,12 +365,12 @@ H5P_close (H5P_class_t type, void *tmpl) H5P_class_t H5Pget_class(hid_t tid) { - group_t group; + H5I_group_t group; H5P_class_t ret_value = H5P_NO_CLASS; FUNC_ENTER(H5Pget_class, H5P_NO_CLASS); - if ((group = H5A_group(tid)) < 0 || + if ((group = H5I_group(tid)) < 0 || #ifndef NDEBUG group >= H5_TEMPLATE_MAX || #endif @@ -417,7 +417,7 @@ H5Pget_version(hid_t tid, int *boot /*out */ , int *heap /*out */ , /* Check arguments */ if (H5P_FILE_CREATE != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file creation template"); } @@ -462,7 +462,7 @@ H5Pset_userblock(hid_t tid, size_t size) /* Check arguments */ if (H5P_FILE_CREATE != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file creation template"); } @@ -506,7 +506,7 @@ H5Pget_userblock(hid_t tid, size_t *size) /* Check args */ if (H5P_FILE_CREATE != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file creation template"); } @@ -544,7 +544,7 @@ H5Pset_sizes(hid_t tid, size_t sizeof_addr, size_t sizeof_size) /* Check arguments */ if (H5P_FILE_CREATE != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file creation template"); } @@ -599,7 +599,7 @@ H5Pget_sizes(hid_t tid, /* Check args */ if (H5P_FILE_CREATE != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file creation template"); } @@ -650,7 +650,7 @@ H5Pset_sym_k(hid_t tid, int ik, int lk) /* Check arguments */ if (H5P_FILE_CREATE != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file creation template"); } @@ -692,7 +692,7 @@ H5Pget_sym_k(hid_t tid, int *ik /*out */ , int *lk /*out */ ) /* Check arguments */ if (H5P_FILE_CREATE != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file creation template"); } @@ -732,7 +732,7 @@ H5Pset_istore_k(hid_t tid, int ik) /* Check arguments */ if (H5P_FILE_CREATE != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file creation template"); } @@ -773,7 +773,7 @@ H5Pget_istore_k(hid_t tid, int *ik /*out */ ) /* Check arguments */ if (H5P_FILE_CREATE != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file creation template"); } @@ -809,7 +809,7 @@ H5Pset_layout(hid_t tid, H5D_layout_t layout) /* Check arguments */ if (H5P_DATASET_CREATE != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation template"); } @@ -848,7 +848,7 @@ H5Pget_layout(hid_t tid) /* Check arguments */ if (H5P_DATASET_CREATE != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5D_LAYOUT_ERROR, "not a dataset creation template"); } @@ -886,7 +886,7 @@ H5Pset_chunk(hid_t tid, int ndims, const size_t dim[]) /* Check arguments */ if (H5P_DATASET_CREATE != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation template"); } @@ -947,7 +947,7 @@ H5Pget_chunk(hid_t tid, int max_ndims, size_t dim[] /*out */ ) /* Check arguments */ if (H5P_DATASET_CREATE != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation template"); } @@ -1001,7 +1001,7 @@ H5Pset_external (hid_t plist_id, const char *name, size_t offset, size_t size) /* Check arguments */ if (H5P_DATASET_CREATE != H5Pget_class(plist_id) || - NULL == (plist = H5A_object(plist_id))) { + NULL == (plist = H5I_object(plist_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); } @@ -1071,7 +1071,7 @@ H5Pget_external_count (hid_t plist_id) /* Check arguments */ if (H5P_DATASET_CREATE != H5Pget_class(plist_id) || - NULL == (plist = H5A_object(plist_id))) { + NULL == (plist = H5I_object(plist_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); } @@ -1119,7 +1119,7 @@ H5Pget_external (hid_t plist_id, int idx, size_t name_size, char *name/*out*/, /* Check arguments */ if (H5P_DATASET_CREATE != H5Pget_class(plist_id) || - NULL == (plist = H5A_object(plist_id))) { + NULL == (plist = H5I_object(plist_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); } @@ -1165,7 +1165,7 @@ H5Pget_driver (hid_t tid) /* Check arguments */ if (H5P_FILE_ACCESS != H5Pget_class (tid) || - NULL == (tmpl = H5A_object (tid))) { + NULL == (tmpl = H5I_object (tid))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, H5F_LOW_ERROR, "not a file access property list"); } @@ -1201,7 +1201,7 @@ H5Pset_stdio (hid_t tid) /* Check arguments */ if (H5P_FILE_ACCESS != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access template"); } @@ -1241,7 +1241,7 @@ H5Pget_stdio (hid_t tid) /* Check arguments */ if (H5P_FILE_ACCESS != H5Pget_class (tid) || - NULL == (tmpl = H5A_object (tid))) { + NULL == (tmpl = H5I_object (tid))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); } @@ -1281,7 +1281,7 @@ H5Pset_sec2 (hid_t tid) /* Check arguments */ if (H5P_FILE_ACCESS != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access template"); } @@ -1321,7 +1321,7 @@ H5Pget_sec2 (hid_t tid) /* Check arguments */ if (H5P_FILE_ACCESS != H5Pget_class (tid) || - NULL == (tmpl = H5A_object (tid))) { + NULL == (tmpl = H5I_object (tid))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); } @@ -1365,7 +1365,7 @@ H5Pset_core (hid_t tid, size_t increment) /* Check arguments */ if (H5P_FILE_ACCESS != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access template"); } @@ -1412,7 +1412,7 @@ H5Pget_core (hid_t tid, size_t *increment/*out*/) /* Check arguments */ if (H5P_FILE_ACCESS != H5Pget_class (tid) || - NULL == (tmpl = H5A_object (tid))) { + NULL == (tmpl = H5I_object (tid))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); } @@ -1459,19 +1459,19 @@ H5Pset_split (hid_t tid, const char *meta_ext, hid_t meta_tid, /* Check arguments */ if (H5P_FILE_ACCESS != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access template"); } if (H5P_DEFAULT!=meta_tid && (H5P_FILE_ACCESS != H5Pget_class(meta_tid) || - NULL == (tmpl = H5A_object(meta_tid)))) { + NULL == (tmpl = H5I_object(meta_tid)))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access template"); } if (H5P_DEFAULT!=raw_tid && (H5P_FILE_ACCESS != H5Pget_class(raw_tid) || - NULL == (tmpl = H5A_object(raw_tid)))) { + NULL == (tmpl = H5I_object(raw_tid)))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access template"); } @@ -1529,7 +1529,7 @@ H5Pget_split (hid_t tid, size_t meta_ext_size, char *meta_ext/*out*/, /* Check arguments */ if (H5P_FILE_ACCESS != H5Pget_class (tid) || - NULL == (tmpl = H5A_object (tid))) { + NULL == (tmpl = H5I_object (tid))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); } @@ -1603,13 +1603,13 @@ H5Pset_family (hid_t tid, hid_t memb_tid) /* Check arguments */ if (H5P_FILE_ACCESS != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access template"); } if (H5P_DEFAULT!=memb_tid && (H5P_FILE_ACCESS != H5Pget_class(memb_tid) || - NULL == (tmpl = H5A_object(memb_tid)))) { + NULL == (tmpl = H5I_object(memb_tid)))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access template"); } @@ -1656,7 +1656,7 @@ H5Pget_family (hid_t tid, hid_t *memb_tid) /* Check arguments */ if (H5P_FILE_ACCESS != H5Pget_class (tid) || - NULL == (tmpl = H5A_object (tid))) { + NULL == (tmpl = H5I_object (tid))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); } @@ -1716,7 +1716,7 @@ H5Pset_buffer (hid_t plist_id, size_t size, void *tconv, void *bkg) /* Check arguments */ if (H5P_DATASET_XFER != H5Pget_class (plist_id) || - NULL == (plist = H5A_object (plist_id))) { + NULL == (plist = H5I_object (plist_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); } @@ -1759,7 +1759,7 @@ H5Pget_buffer (hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/) /* Check arguments */ if (H5P_DATASET_XFER != H5Pget_class (plist_id) || - NULL == (plist = H5A_object (plist_id))) { + NULL == (plist = H5I_object (plist_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, 0, "not a dataset transfer property list"); } @@ -1801,7 +1801,7 @@ H5Pset_preserve (hid_t plist_id, hbool_t status) /* Check arguments */ if (H5P_DATASET_XFER != H5Pget_class (plist_id) || - NULL == (plist = H5A_object (plist_id))) { + NULL == (plist = H5I_object (plist_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); } @@ -1838,7 +1838,7 @@ H5Pget_preserve (hid_t plist_id) /* Check arguments */ if (H5P_DATASET_XFER != H5Pget_class (plist_id) || - NULL == (plist = H5A_object (plist_id))) { + NULL == (plist = H5I_object (plist_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); } @@ -1913,7 +1913,7 @@ H5Pset_mpi (hid_t tid, MPI_Comm comm, MPI_Info info, unsigned access_mode) /* Check arguments */ if (H5P_FILE_ACCESS != H5Pget_class(tid) || - NULL == (tmpl = H5A_object(tid))) { + NULL == (tmpl = H5I_object(tid))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access template"); } @@ -1991,7 +1991,7 @@ H5Pget_mpi (hid_t tid, MPI_Comm *comm, MPI_Info *info, unsigned *access_mode) /* Check arguments */ if (H5P_FILE_ACCESS != H5Pget_class (tid) || - NULL == (tmpl = H5A_object (tid))) { + NULL == (tmpl = H5I_object (tid))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); } @@ -2040,14 +2040,14 @@ H5Pcopy(hid_t tid) void *new_tmpl = NULL; H5P_class_t type; hid_t ret_value = FAIL; - group_t group; + H5I_group_t group; FUNC_ENTER(H5Pcopy, FAIL); /* Check args */ - if (NULL == (tmpl = H5A_object(tid)) || + if (NULL == (tmpl = H5I_object(tid)) || (type = H5Pget_class(tid)) < 0 || - (group = H5A_group(tid)) < 0) { + (group = H5I_group(tid)) < 0) { HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't unatomize template"); } @@ -2059,7 +2059,7 @@ H5Pcopy(hid_t tid) } /* Register the atom for the new template */ - if ((ret_value = H5A_register(group, new_tmpl)) < 0) { + if ((ret_value = H5I_register(group, new_tmpl)) < 0) { HRETURN_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize template pointer"); } diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index f5a84ee..ea3c0d2 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -22,7 +22,7 @@ /* Public headers needed by this file */ #include <H5public.h> -#include <H5Apublic.h> +#include <H5Ipublic.h> #include <H5Dpublic.h> #include <H5Fpublic.h> @@ -17,7 +17,7 @@ static char RcsId[] = "@(#)$Revision$"; /* $Id$ */ #include <H5private.h> /* Generic Functions */ -#include <H5Aprivate.h> /* Atom Functions */ +#include <H5Iprivate.h> /* ID Functions */ #include <H5Eprivate.h> /* Error handling */ #include <H5MMprivate.h> /* Memory Management functions */ #include <H5Oprivate.h> /*object headers */ @@ -50,7 +50,7 @@ H5S_init_interface(void) FUNC_ENTER(H5S_init_interface, FAIL); /* Initialize the atom group for the file IDs */ - if ((ret_value = H5A_init_group(H5_DATASPACE, H5A_DATASPACEID_HASHSIZE, + if ((ret_value = H5I_init_group(H5_DATASPACE, H5I_DATASPACEID_HASHSIZE, H5S_RESERVED_ATOMS, (herr_t (*)(void *)) H5S_close)) != FAIL) { ret_value = H5_add_exit(&H5S_term_interface); @@ -79,7 +79,7 @@ H5S_init_interface(void) static void H5S_term_interface(void) { - H5A_destroy_group(H5_DATASPACE); + H5I_destroy_group(H5_DATASPACE); } /*------------------------------------------------------------------------- @@ -162,7 +162,7 @@ H5Screate_simple(int rank, const size_t *dims, const size_t *maxdims) #endif /* LATER */ /* Register the new data space and get an ID for it */ - if ((ret_value = H5A_register(H5_DATASPACE, ds)) < 0) { + if ((ret_value = H5I_register(H5_DATASPACE, ds)) < 0) { HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register data space for ID"); } @@ -198,12 +198,12 @@ H5Sclose(hid_t space_id) FUNC_ENTER(H5Sclose, FAIL); /* Check args */ - if (H5_DATASPACE != H5A_group(space_id) || - NULL == H5A_object(space_id)) { + if (H5_DATASPACE != H5I_group(space_id) || + NULL == H5I_object(space_id)) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } /* When the reference count reaches zero the resources are freed */ - if (H5A_dec_ref(space_id) < 0) { + if (H5I_dec_ref(space_id) < 0) { HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id"); } FUNC_LEAVE(SUCCEED); @@ -287,8 +287,8 @@ H5Scopy (hid_t space_id) FUNC_ENTER (H5Scopy, FAIL); /* Check args */ - if (H5_DATASPACE!=H5A_group (space_id) || - NULL==(src=H5A_object (space_id))) { + if (H5_DATASPACE!=H5I_group (space_id) || + NULL==(src=H5I_object (space_id))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } @@ -299,7 +299,7 @@ H5Scopy (hid_t space_id) } /* Atomize */ - if ((ret_value=H5A_register (H5_DATASPACE, dst))<0) { + if ((ret_value=H5I_register (H5_DATASPACE, dst))<0) { HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register data space atom"); } @@ -401,8 +401,8 @@ H5Sget_npoints(hid_t space_id) FUNC_ENTER(H5Sget_npoints, 0); /* Check args */ - if (H5_DATASPACE != H5A_group(space_id) || - NULL == (ds = H5A_object(space_id))) { + if (H5_DATASPACE != H5I_group(space_id) || + NULL == (ds = H5I_object(space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a data space"); } ret_value = H5S_get_npoints(ds); @@ -565,8 +565,8 @@ H5Sget_ndims(hid_t space_id) FUNC_ENTER(H5Sget_ndims, FAIL); /* Check args */ - if (H5_DATASPACE != H5A_group(space_id) || - NULL == (ds = H5A_object(space_id))) { + if (H5_DATASPACE != H5I_group(space_id) || + NULL == (ds = H5I_object(space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } ret_value = H5S_get_ndims(ds); @@ -651,8 +651,8 @@ H5Sget_dims(hid_t space_id, size_t dims[]/*out*/) FUNC_ENTER(H5Sget_dims, FAIL); /* Check args */ - if (H5_DATASPACE != H5A_group(space_id) || - NULL == (ds = H5A_object(space_id))) { + if (H5_DATASPACE != H5I_group(space_id) || + NULL == (ds = H5I_object(space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } if (!dims) { @@ -955,7 +955,7 @@ H5Sis_simple(hid_t sid) FUNC_ENTER(H5Sis_simple, FAIL); /* Check args and all the boring stuff. */ - if ((space = H5A_object(sid)) == NULL) + if ((space = H5I_object(sid)) == NULL) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); ret_value = H5S_is_simple(space); @@ -1000,7 +1000,7 @@ H5Sset_space(hid_t sid, int rank, const size_t *dims) FUNC_ENTER(H5Sset_space, FAIL); /* Check args */ - if ((space = H5A_object(sid)) == NULL) + if ((space = H5I_object(sid)) == NULL) HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); if (rank > 0 && dims == NULL) HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified"); @@ -1103,7 +1103,7 @@ H5Sset_hyperslab(hid_t sid, const int *start, const size_t *count, const size_t FUNC_ENTER(H5Sset_hyperslab, FAIL); /* Get the object */ - if (H5_DATASPACE != H5A_group(sid) || (space = H5A_object(sid)) == NULL) + if (H5_DATASPACE != H5I_group(sid) || (space = H5I_object(sid)) == NULL) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); if (start == NULL || count==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, @@ -1186,7 +1186,7 @@ H5Sget_hyperslab (hid_t sid, int offset[]/*out*/, size_t size[]/*out*/, FUNC_ENTER (H5Sget_hyperslab, FAIL); /* Check args */ - if (H5_DATASPACE!=H5A_group (sid) || NULL==(ds=H5A_object (sid))) { + if (H5_DATASPACE!=H5I_group (sid) || NULL==(ds=H5I_object (sid))) { HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 784ca53..f69b623 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -18,7 +18,7 @@ /* Public headers needed by this file */ #include <H5public.h> -#include <H5Apublic.h> +#include <H5Ipublic.h> /* Define atomic datatypes */ #define H5S_ALL (-2) @@ -18,7 +18,7 @@ static char RcsId[] = "@(#)$Revision$"; #define H5T_PACKAGE /*suppress error about including H5Tpkg */ #include <H5private.h> /*generic functions */ -#include <H5Aprivate.h> /*atom functions */ +#include <H5Iprivate.h> /*ID functions */ #include <H5Eprivate.h> /*error handling */ #include <H5MMprivate.h> /*memory management */ #include <H5Sprivate.h> /*data space */ @@ -93,7 +93,7 @@ H5T_init_interface(void) FUNC_ENTER(H5T_init_interface, FAIL); /* Initialize the atom group for the file IDs */ - if ((ret_value = H5A_init_group(H5_DATATYPE, H5A_DATATYPEID_HASHSIZE, + if ((ret_value = H5I_init_group(H5_DATATYPE, H5I_DATATYPEID_HASHSIZE, H5T_RESERVED_ATOMS, (herr_t (*)(void *)) H5T_close)) != FAIL) { ret_value = H5_add_exit(&H5T_term_interface); @@ -170,7 +170,7 @@ H5T_init_interface(void) dt->u.atomic.prec = 8 * dt->size; dt->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->u.atomic.msb_pad = H5T_PAD_ZERO; - if ((H5T_NATIVE_TIME_g = H5A_register(H5_DATATYPE, dt)) < 0) { + if ((H5T_NATIVE_TIME_g = H5I_register(H5_DATATYPE, dt)) < 0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't initialize H5T layer"); } @@ -187,7 +187,7 @@ H5T_init_interface(void) dt->u.atomic.msb_pad = H5T_PAD_ZERO; dt->u.atomic.u.s.cset = H5T_CSET_ASCII; dt->u.atomic.u.s.pad = H5T_STR_NULL; - if ((H5T_NATIVE_STRING_g = H5A_register(H5_DATATYPE, dt)) < 0) { + if ((H5T_NATIVE_STRING_g = H5I_register(H5_DATATYPE, dt)) < 0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't initialize H5T layer"); } @@ -202,7 +202,7 @@ H5T_init_interface(void) dt->u.atomic.prec = 8 * dt->size; dt->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->u.atomic.msb_pad = H5T_PAD_ZERO; - if ((H5T_NATIVE_BITFIELD_g = H5A_register(H5_DATATYPE, dt)) < 0) { + if ((H5T_NATIVE_BITFIELD_g = H5I_register(H5_DATATYPE, dt)) < 0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize H5T layer"); } @@ -217,7 +217,7 @@ H5T_init_interface(void) dt->u.atomic.prec = 8 * dt->size; dt->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->u.atomic.msb_pad = H5T_PAD_ZERO; - if ((H5T_NATIVE_OPAQUE_g = H5A_register(H5_DATATYPE, dt)) < 0) { + if ((H5T_NATIVE_OPAQUE_g = H5I_register(H5_DATATYPE, dt)) < 0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize H5T layer"); } @@ -308,7 +308,7 @@ H5T_term_interface(void) (cfunc)(FAIL, FAIL, pcdata, 0, NULL, NULL); } - H5A_destroy_group(H5_DATATYPE); + H5I_destroy_group(H5_DATATYPE); H5T_NATIVE_CHAR_g = FAIL; H5T_NATIVE_UCHAR_g = FAIL; H5T_NATIVE_SHORT_g = FAIL; @@ -376,7 +376,7 @@ H5Tcreate(H5T_class_t type, size_t size) HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't create type"); } /* Make it an atom */ - if ((ret_value = H5A_register(H5_DATATYPE, dt)) < 0) { + if ((ret_value = H5I_register(H5_DATATYPE, dt)) < 0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "can't register data type atom"); } @@ -411,8 +411,8 @@ H5Tcopy(hid_t type_id) FUNC_ENTER(H5Tcopy, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id))) { + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } @@ -421,7 +421,7 @@ H5Tcopy(hid_t type_id) HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't copy"); } /* atomize result */ - if ((ret_value = H5A_register(H5_DATATYPE, new_dt)) < 0) { + if ((ret_value = H5I_register(H5_DATATYPE, new_dt)) < 0) { H5T_close(new_dt); HRETURN_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "can't register data type atom"); @@ -453,15 +453,15 @@ H5Tclose(hid_t type_id) FUNC_ENTER(H5Tclose, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id))) { + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } if (dt->locked) { HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "predefined data type"); } /* When the reference count reaches zero the resources are freed */ - if (H5A_dec_ref(type_id) < 0) { + if (H5I_dec_ref(type_id) < 0) { HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id"); } FUNC_LEAVE(SUCCEED); @@ -495,10 +495,10 @@ H5Tequal(hid_t type1_id, hid_t type2_id) FUNC_ENTER(H5Tequal, FAIL); /* check args */ - if (H5_DATATYPE != H5A_group(type1_id) || - NULL == (dt1 = H5A_object(type1_id)) || - H5_DATATYPE != H5A_group(type2_id) || - NULL == (dt2 = H5A_object(type2_id))) { + if (H5_DATATYPE != H5I_group(type1_id) || + NULL == (dt1 = H5I_object(type1_id)) || + H5_DATATYPE != H5I_group(type2_id) || + NULL == (dt2 = H5I_object(type2_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } ret_value = (0 == H5T_cmp(dt1, dt2)) ? TRUE : FALSE; @@ -535,8 +535,8 @@ H5Tlock(hid_t type_id) FUNC_ENTER(H5Tlock, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id))) { + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } dt->locked = TRUE; @@ -568,8 +568,8 @@ H5Tget_class(hid_t type_id) FUNC_ENTER(H5Tget_class, H5T_NO_CLASS); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id))) { + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a data type"); } FUNC_LEAVE(dt->type); @@ -602,8 +602,8 @@ H5Tget_size(hid_t type_id) FUNC_ENTER(H5Tget_size, 0); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id))) { + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a data type"); } /* size */ @@ -649,8 +649,8 @@ H5Tset_size(hid_t type_id, size_t size) FUNC_ENTER(H5Tset_size, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || !H5T_is_atomic(dt)) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type"); } @@ -745,8 +745,8 @@ H5Tget_order(hid_t type_id) FUNC_ENTER(H5Tget_order, H5T_ORDER_ERROR); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || !H5T_is_atomic(dt)) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_ORDER_ERROR, "not an atomic data type"); @@ -781,8 +781,8 @@ H5Tset_order(hid_t type_id, H5T_order_t order) FUNC_ENTER(H5Tset_order, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || !H5T_is_atomic(dt)) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type"); } @@ -826,8 +826,8 @@ H5Tget_precision(hid_t type_id) FUNC_ENTER(H5Tget_precision, 0); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || !H5T_is_atomic(dt)) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an atomic data type"); } @@ -876,8 +876,8 @@ H5Tset_precision(hid_t type_id, size_t prec) FUNC_ENTER(H5Tset_prec, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || !H5T_is_atomic(dt)) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type"); } @@ -982,8 +982,8 @@ H5Tget_offset(hid_t type_id) FUNC_ENTER(H5Tget_offset, 0); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || !H5T_is_atomic(dt)) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an atomic data type"); } @@ -1040,8 +1040,8 @@ H5Tset_offset(hid_t type_id, size_t offset) FUNC_ENTER(H5Tset_offset, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || !H5T_is_atomic(dt)) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type"); } @@ -1088,8 +1088,8 @@ H5Tget_pad(hid_t type_id, H5T_pad_t *lsb /*out */ , H5T_pad_t *msb /*out */ ) FUNC_ENTER(H5Tget_pad, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || !H5T_is_atomic(dt)) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type"); } @@ -1126,8 +1126,8 @@ H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb) FUNC_ENTER(H5Tset_pad, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || !H5T_is_atomic(dt)) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type"); } @@ -1168,8 +1168,8 @@ H5Tget_sign(hid_t type_id) FUNC_ENTER(H5Tget_sign, H5T_SGN_ERROR); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_INTEGER != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_SGN_ERROR, "not an integer data type"); @@ -1204,8 +1204,8 @@ H5Tset_sign(hid_t type_id, H5T_sign_t sign) FUNC_ENTER(H5Tset_sign, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_INTEGER != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an integer data type"); } @@ -1252,8 +1252,8 @@ H5Tget_fields(hid_t type_id, size_t *spos /*out */ , FUNC_ENTER(H5Tget_fields, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_FLOAT != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a floating-point data type"); @@ -1304,8 +1304,8 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize, FUNC_ENTER(H5Tset_fields, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_FLOAT != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a floating-point data type"); @@ -1374,8 +1374,8 @@ H5Tget_ebias(hid_t type_id) FUNC_ENTER(H5Tget_ebias, 0); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_FLOAT != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a floating-point data type"); @@ -1410,8 +1410,8 @@ H5Tset_ebias(hid_t type_id, size_t ebias) FUNC_ENTER(H5Tset_ebias, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_FLOAT != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a floating-point data type"); @@ -1450,8 +1450,8 @@ H5Tget_norm(hid_t type_id) FUNC_ENTER(H5Tget_norm, H5T_NORM_ERROR); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_FLOAT != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NORM_ERROR, "not a floating-point data type"); @@ -1487,8 +1487,8 @@ H5Tset_norm(hid_t type_id, H5T_norm_t norm) FUNC_ENTER(H5Tset_norm, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_FLOAT != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a floating-point data type"); @@ -1532,8 +1532,8 @@ H5Tget_inpad(hid_t type_id) FUNC_ENTER(H5Tget_inpad, H5T_PAD_ERROR); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_FLOAT != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_PAD_ERROR, "not a floating-point data type"); @@ -1571,8 +1571,8 @@ H5Tset_inpad(hid_t type_id, H5T_pad_t pad) FUNC_ENTER(H5Tset_inpad, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_FLOAT != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a floating-point data type"); @@ -1616,8 +1616,8 @@ H5Tget_cset(hid_t type_id) FUNC_ENTER(H5Tget_cset, H5T_CSET_ERROR); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_STRING != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_CSET_ERROR, "not a string data type"); @@ -1654,8 +1654,8 @@ H5Tset_cset(hid_t type_id, H5T_cset_t cset) FUNC_ENTER(H5Tset_cset, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_STRING != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a string data type"); } @@ -1699,8 +1699,8 @@ H5Tget_strpad(hid_t type_id) FUNC_ENTER(H5Tget_strpad, H5T_STR_ERROR); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_STRING != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_STR_ERROR, "not a string data type"); @@ -1738,8 +1738,8 @@ H5Tset_strpad(hid_t type_id, H5T_str_t strpad) FUNC_ENTER(H5Tset_strpad, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_STRING != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a string data type"); } @@ -1782,8 +1782,8 @@ H5Tget_nmembers(hid_t type_id) FUNC_ENTER(H5Tget_num_members, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_COMPOUND != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound data type"); } @@ -1819,8 +1819,8 @@ H5Tget_member_name(hid_t type_id, int membno) FUNC_ENTER(H5Tget_member_name, NULL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_COMPOUND != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a compound data type"); } @@ -1860,8 +1860,8 @@ H5Tget_member_offset(hid_t type_id, int membno) FUNC_ENTER(H5Tget_member_offset, 0); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_COMPOUND != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a compound data type"); } @@ -1901,8 +1901,8 @@ H5Tget_member_dims(hid_t type_id, int membno, FUNC_ENTER(H5Tget_member_dims, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_COMPOUND != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound data type"); } @@ -1949,8 +1949,8 @@ H5Tget_member_type(hid_t type_id, int membno) FUNC_ENTER(H5Tget_member_type, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_COMPOUND != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound data type"); } @@ -1962,7 +1962,7 @@ H5Tget_member_type(hid_t type_id, int membno) HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy member data type"); } - if ((memb_type_id = H5A_register(H5_DATATYPE, memb_dt)) < 0) { + if ((memb_type_id = H5I_register(H5_DATATYPE, memb_dt)) < 0) { H5T_close(memb_dt); HRETURN_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "can't register data type atom"); @@ -2007,8 +2007,8 @@ H5Tinsert(hid_t parent_id, const char *name, off_t offset, hid_t member_id) FUNC_ENTER(H5Tinsert, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(parent_id) || - NULL == (parent = H5A_object(parent_id)) || + if (H5_DATATYPE != H5I_group(parent_id) || + NULL == (parent = H5I_object(parent_id)) || H5T_COMPOUND != parent->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound data type"); } @@ -2018,8 +2018,8 @@ H5Tinsert(hid_t parent_id, const char *name, off_t offset, hid_t member_id) if (!name || !*name) { HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no member name"); } - if (H5_DATATYPE != H5A_group(member_id) || - NULL == (member = H5A_object(member_id))) { + if (H5_DATATYPE != H5I_group(member_id) || + NULL == (member = H5I_object(member_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } if (H5T_insert(parent, name, offset, member) < 0) { @@ -2054,8 +2054,8 @@ H5Tpack(hid_t type_id) FUNC_ENTER(H5Tpack, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(type_id) || - NULL == (dt = H5A_object(type_id)) || + if (H5_DATATYPE != H5I_group(type_id) || + NULL == (dt = H5I_object(type_id)) || H5T_COMPOUND != dt->type) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound data type"); } @@ -2105,10 +2105,10 @@ H5Tregister_hard(hid_t src_id, hid_t dst_id, H5T_conv_t func) FUNC_ENTER(H5Tregister_hard, FAIL); /* Check args */ - if (H5_DATATYPE != H5A_group(src_id) || - NULL == (src = H5A_object(src_id)) || - H5_DATATYPE != H5A_group(dst_id) || - NULL == (dst = H5A_object(dst_id))) { + if (H5_DATATYPE != H5I_group(src_id) || + NULL == (src = H5I_object(src_id)) || + H5_DATATYPE != H5I_group(dst_id) || + NULL == (dst = H5I_object(dst_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } @@ -2198,8 +2198,8 @@ H5Tregister_soft(H5T_class_t src_cls, H5T_class_t dst_cls, H5T_conv_t func) * data type temporarily to an object id before we query the functions * capabilities. */ - if ((src_id = H5A_register(H5_DATATYPE, H5T_copy(path->src))) < 0 || - (dst_id = H5A_register(H5_DATATYPE, H5T_copy(path->dst))) < 0) { + if ((src_id = H5I_register(H5_DATATYPE, H5T_copy(path->src))) < 0 || + (dst_id = H5I_register(H5_DATATYPE, H5T_copy(path->dst))) < 0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data types for conv query"); } @@ -2228,8 +2228,8 @@ H5Tregister_soft(H5T_class_t src_cls, H5T_class_t dst_cls, H5T_conv_t func) } /* Release temporary atoms */ - H5A_dec_ref(src_id); - H5A_dec_ref(dst_id); + H5I_dec_ref(src_id); + H5I_dec_ref(dst_id); H5E_clear(); } @@ -2310,9 +2310,9 @@ H5Tunregister(H5T_conv_t func) * Conversion functions are app-level, so temporarily create * object id's for the data types. */ - if ((src_id = H5A_register(H5_DATATYPE, + if ((src_id = H5I_register(H5_DATATYPE, H5T_copy(path->src))) < 0 || - (dst_id = H5A_register(H5_DATATYPE, + (dst_id = H5I_register(H5_DATATYPE, H5T_copy(path->dst))) < 0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register conv types for query"); @@ -2326,8 +2326,8 @@ H5Tunregister(H5T_conv_t func) H5E_clear(); HDmemset (&(path->cdata), 0, sizeof(H5T_cdata_t)); } - H5A_dec_ref(src_id); - H5A_dec_ref(dst_id); + H5I_dec_ref(src_id); + H5I_dec_ref(dst_id); } } else { /* @@ -2370,10 +2370,10 @@ H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata) FUNC_ENTER(H5Tfind, NULL); /* Check args */ - if (H5_DATATYPE != H5A_group(src_id) || - NULL == (src = H5A_object(src_id)) || - H5_DATATYPE != H5A_group(dst_id) || - NULL == (dst = H5A_object(dst_id))) { + if (H5_DATATYPE != H5I_group(src_id) || + NULL == (src = H5I_object(src_id)) || + H5_DATATYPE != H5I_group(dst_id) || + NULL == (dst = H5I_object(dst_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); } if (!pcdata) { @@ -3150,8 +3150,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, hbool_t create, path->func = func; path->is_hard = TRUE; path->cdata.command = H5T_CONV_INIT; - if ((src_id=H5A_register(H5_DATATYPE, H5T_copy(path->src))) < 0 || - (dst_id=H5A_register(H5_DATATYPE, H5T_copy(path->dst))) < 0) { + if ((src_id=H5I_register(H5_DATATYPE, H5T_copy(path->src))) < 0 || + (dst_id=H5I_register(H5_DATATYPE, H5T_copy(path->dst))) < 0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register conv types for query"); } @@ -3162,8 +3162,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, hbool_t create, #endif H5E_clear(); /*ignore the failure*/ } - H5A_dec_ref(src_id); - H5A_dec_ref(dst_id); + H5I_dec_ref(src_id); + H5I_dec_ref(dst_id); } else { /* Locate a soft function */ for (i=H5T_nsoft_g-1; i>=0 && !path->func; --i) { @@ -3171,9 +3171,9 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, hbool_t create, dst->type!=H5T_soft_g[i].dst) { continue; } - if ((src_id=H5A_register(H5_DATATYPE, + if ((src_id=H5I_register(H5_DATATYPE, H5T_copy(path->src))) < 0 || - (dst_id=H5A_register(H5_DATATYPE, + (dst_id=H5I_register(H5_DATATYPE, H5T_copy(path->dst))) < 0) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register conv types for query"); @@ -3186,8 +3186,8 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, hbool_t create, } else { path->func = H5T_soft_g[i].func; } - H5A_dec_ref(src_id); - H5A_dec_ref(dst_id); + H5I_dec_ref(src_id); + H5I_dec_ref(dst_id); } } } diff --git a/src/H5Tconv.c b/src/H5Tconv.c index beae526..02b7db3 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -9,7 +9,7 @@ */ #define H5T_PACKAGE /*suppress error about including H5Tpkg */ -#include <H5Aprivate.h> +#include <H5Iprivate.h> #include <H5Eprivate.h> #include <H5MMprivate.h> #include <H5Tpkg.h> @@ -111,10 +111,10 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, switch (cdata->command) { case H5T_CONV_INIT: /* Capability query */ - if (H5_DATATYPE != H5A_group(src_id) || - NULL == (src = H5A_object(src_id)) || - H5_DATATYPE != H5A_group(dst_id) || - NULL == (dst = H5A_object(dst_id))) { + if (H5_DATATYPE != H5I_group(src_id) || + NULL == (src = H5I_object(src_id)) || + H5_DATATYPE != H5I_group(dst_id) || + NULL == (dst = H5I_object(dst_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } if (src->size != dst->size || @@ -154,10 +154,10 @@ H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, case H5T_CONV_CONV: /* The conversion */ - if (H5_DATATYPE != H5A_group(src_id) || - NULL == (src = H5A_object(src_id)) || - H5_DATATYPE != H5A_group(dst_id) || - NULL == (dst = H5A_object(dst_id))) { + if (H5_DATATYPE != H5I_group(src_id) || + NULL == (src = H5I_object(src_id)) || + H5_DATATYPE != H5I_group(dst_id) || + NULL == (dst = H5I_object(dst_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } md = src->size / 2; @@ -255,12 +255,12 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) } if (priv->src2dst[i]>=0) { type = H5T_copy (src->u.compnd.memb[i].type); - tid = H5A_register (H5_DATATYPE, type); + tid = H5I_register (H5_DATATYPE, type); assert (tid>=0); priv->src_memb_id[priv->src2dst[i]] = tid; type = H5T_copy (dst->u.compnd.memb[priv->src2dst[i]].type); - tid = H5A_register (H5_DATATYPE, type); + tid = H5I_register (H5_DATATYPE, type); assert (tid>=0); priv->dst_memb_id[priv->src2dst[i]] = tid; } @@ -357,10 +357,10 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * otherwise initialize the `priv' field of `cdata' with information * that remains (almost) constant for this conversion path. */ - if (H5_DATATYPE != H5A_group(src_id) || - NULL == (src = H5A_object(src_id)) || - H5_DATATYPE != H5A_group(dst_id) || - NULL == (dst = H5A_object(dst_id))) { + if (H5_DATATYPE != H5I_group(src_id) || + NULL == (src = H5I_object(src_id)) || + H5_DATATYPE != H5I_group(dst_id) || + NULL == (dst = H5I_object(dst_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } assert (H5T_COMPOUND==src->type); @@ -412,10 +412,10 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* * Conversion. */ - if (H5_DATATYPE != H5A_group(src_id) || - NULL == (src = H5A_object(src_id)) || - H5_DATATYPE != H5A_group(dst_id) || - NULL == (dst = H5A_object(dst_id))) { + if (H5_DATATYPE != H5I_group(src_id) || + NULL == (src = H5I_object(src_id)) || + H5_DATATYPE != H5I_group(dst_id) || + NULL == (dst = H5I_object(dst_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } assert (priv); diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index 8e0f8e8..f546200 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -18,7 +18,7 @@ /* Public headers needed by this file */ #include <H5public.h> -#include <H5Apublic.h> +#include <H5Ipublic.h> #define HOFFSET(S,M) ((const char*)&S.M-(const char*)&S) #define HPOFFSET(P,M) ((const char*)&(P->M)-(const char*)P) diff --git a/src/H5detect.c b/src/H5detect.c index a66dbad..3d56c39 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -274,7 +274,7 @@ print_results(int nd, detected_t *d) #define H5T_PACKAGE /*suppress error about including H5Tpkg.h*/\n\ \n\ #include <H5private.h>\n\ -#include <H5Aprivate.h>\n\ +#include <H5Iprivate.h>\n\ #include <H5Eprivate.h>\n\ #include <H5MMprivate.h>\n\ #include <H5Tpkg.h>\n\ @@ -346,7 +346,7 @@ H5T_init (void)\n\ /* Atomize the type */ printf("\ - if ((H5T_NATIVE_%s_g = H5A_register (H5_DATATYPE, dt))<0) {\n\ + if ((H5T_NATIVE_%s_g = H5I_register (H5_DATATYPE, dt))<0) {\n\ HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,\n\ \"can't initialize type system (atom registration \"\n\ \"failure\");\n\ diff --git a/src/Makefile.in b/src/Makefile.in index be831b0..cf1a963 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -16,9 +16,9 @@ PROGS=debug # Source and object files for the library (lexicographically)... PARALLEL_SRC=H5Fmpio.c -LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5D.c H5E.c H5F.c H5Farray.c H5Fcore.c \ +LIB_SRC=H5.c H5AC.c H5B.c H5D.c H5E.c H5F.c H5Farray.c H5Fcore.c \ H5Ffamily.c H5Fistore.c H5Flow.c H5Fsec2.c H5Fsplit.c H5Fstdio.c \ - H5G.c H5Gent.c H5Gnode.c H5Gstab.c H5H.c H5MF.c H5MM.c H5O.c \ + H5G.c H5Gent.c H5Gnode.c H5Gstab.c H5H.c H5I.c H5MF.c H5MM.c H5O.c \ H5Ocont.c H5Odtype.c H5Oefl.c H5Olayout.c H5Oname.c H5Onull.c \ H5Osdspace.c H5Ostab.c H5P.c H5S.c H5Ssimp.c H5T.c H5Tconv.c \ H5Tinit.c H5V.c @PARALLEL_SRC@ @@ -33,15 +33,15 @@ PROG_SRC=debug.c PROG_OBJ=$(PROG_SRC:.c=.o) # Public header files (to be installed)... -PUB_HDR=H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5Ppublic.h \ +PUB_HDR=H5public.h H5ACpublic.h H5Bpublic.h H5Ppublic.h \ H5Dpublic.h H5Epublic.h H5Fpublic.h H5Gpublic.h H5Hpublic.h \ - H5MFpublic.h H5MMpublic.h H5Opublic.h H5Spublic.h \ + H5Ipublic.h H5MFpublic.h H5MMpublic.h H5Opublic.h H5Spublic.h \ H5Tpublic.h H5config.h hdf5.h # Other header files (not to be installed)... -PRIVATE_HDR=H5private.h H5Aprivate.h H5ACprivate.h H5Bprivate.h \ +PRIVATE_HDR=H5private.h H5ACprivate.h H5Bprivate.h \ H5Pprivate.h H5Dprivate.h H5Eprivate.h H5Fprivate.h H5Gprivate.h \ - H5Gpkg.h H5Hprivate.h H5MFprivate.h H5MMprivate.h \ + H5Gpkg.h H5Hprivate.h H5Iprivate.h H5MFprivate.h H5MMprivate.h \ H5Oprivate.h H5Sprivate.h H5Tprivate.h H5Tpkg.h H5Vprivate.h # Number format detection diff --git a/src/debug.c b/src/debug.c index 2e7e1c4..7757afd 100644 --- a/src/debug.c +++ b/src/debug.c @@ -15,7 +15,7 @@ *------------------------------------------------------------------------- */ #include <H5private.h> -#include <H5Aprivate.h> +#include <H5Iprivate.h> #include <H5Bprivate.h> #include <H5Pprivate.h> #include <H5Fprivate.h> @@ -61,7 +61,7 @@ main(int argc, char *argv[]) fprintf(stderr, "cannot open file\n"); HDexit(1); } - if (NULL == (f = H5A_object(fid))) { + if (NULL == (f = H5I_object(fid))) { fprintf(stderr, "cannot obtain H5F_t pointer\n"); HDexit(2); } @@ -19,7 +19,6 @@ #define _HDF5_H #include <H5public.h> -#include <H5Apublic.h> /* Atoms */ #include <H5ACpublic.h> /* Metadata cache */ #include <H5Bpublic.h> /* B-trees */ #include <H5Dpublic.h> /* Datasets */ @@ -27,6 +26,7 @@ #include <H5Fpublic.h> /* Files */ #include <H5Gpublic.h> /* Groups */ #include <H5Hpublic.h> +#include <H5Ipublic.h> /* IDs */ #include <H5MFpublic.h> #include <H5MMpublic.h> #include <H5Opublic.h> /* Object headers */ |