mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-12 17:31:09 +08:00
[svn-r139] ./src/*.[ch]
Removed the interface initialization argument from FUNC_ENTER() and made it a locally-defined preprocessor symbol, INTERFACE_INIT. Changed `offset' to `address' and `length' to `size' in documentation so it's more consistent. `Offset' still appears occassionally when it refers to a byte offset within some other data structure. Moved interface termination function prototypes from public header files to .c files and made them static. ./src/H5.c ./src/H5public.h Added H5init() because it's possible that the predefined data types are not initialized. This happens only if the first call to the hdf5 library passes a predefined data type symbol as an argument. There should be some way to fix this... ./src/H5A.c ./src/H5Aprivate.h ./src/H5Apublic.h The free_func returns SUCCEED or FAIL, although the return value is ignored by H5A. This is so we can use the various H5*_close() functions to free things. H5Ainc_ref() and H5Adec_ref() are no longer public. Many of the other atom functions should also be made private, but I'll save that for later... Added additional template groups called H5_TEMPLATE_0 through H5_TEMPLATE_7 that are used by the various template subclasses. Increased the number of bits used for atom groups to prevent negative atoms. ./src/H5AC.c ./src/H5ACprivate.h Changed H5AC_new() to H5AC_create() to make names more consistent. ./src/H5B.c ./src/H5Bprivate.h Changed H5B_new() to H5B_create() to make names more consistent. ./src/H5C.c ./src/H5Cprivate.h ./src/H5Cpublic.h Now supports multiple subclasses of templates, although it's done with big switch statements. The default values for templates are defined in the source file to which that template belongs. This got rid of lots of needless preprocessor constants. Added H5Ccreate() to create a new template. Changed H5C_release() to H5Cclose() to make the naming more consistent. ./src/H5D.c ./src/H5Dprivate.h ./src/H5Dpublic.h Enhanced to use the new dataset interface, and uses the enhanced data type and data space interfaces, which haven't been completely implemented. The dataset interface doesn't handle non-contiguous storage, compression, or data type and space conversions yet. ./src/H5F.c ./src/H5Fprivate.h ./src/H5Fpublic.h Removed H5Fflush() since just calls H5F_flush(), which doesn't do what the user would probably think it does, namely, flush everything. It only flushes those things sitting in the H5AC cache and the boot block. Changed the `file_create_parms' field of H5F_low_t to just `create_parms' since the `file' part is obvious. ./src/H5Fistore.c Added some support for external files. Mostly just in the file format and not supported much by the library yet. I need to finish some dataset functions first. Changed H5F_istore_new() to H5F_istore_create() to make names more uniform across packages. ./src/H5Flow.c Flushing a file causes the file to be physically extended to the logical eof. This prevents H5F_open() from thinking a file has been truncated. Most of the time the file will already be that large, and when it isn't Unix will often just allocate the final block anyway. ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gpkg.h ./src/H5Gprivate.h ./src/H5Gstab.c Removed H5G_basename() Removed (temporarily) data type information from symbol table entries and renamed H5G_CACHED_SDATA to H5G_CACHED_SDSPACE to reflect that it's a simple data space and has nothing to do with raw data. Changed H5G_node_new() to H5G_node_create() and H5G_stab_new() to H5G_stab_create() to make names more uniform across packages. Fixed an undefined address bug that happens when H5G_node_debug() program doesn't pass enough info to H5G_node_load(). ./src/H5H.c ./src/H5Hprivate.h Changed H5H_new() to H5H_create() to make the names more uniform across packages. ./src/H5M.c ./src/H5Mprivate.h ./src/H5Mpublic.h Nulled all the create functions. Most of the other callbacks are to public functions. Removed H5Mcreate(). Changed hobjtype_t to group_t since it has to be the same thing anyway. ./src/H5O.c ./src/H5Oprivate.h ./src/H5Osdim.c ./src/H5Osdtyp.c Changed H5O_SIM_DIM to H5O_SDSPACE (simple data space) since `simple data space' is its official name, not `simple dimensions'. Will eventually add H5O_CDSPACE for comples data spaces. Changed _sim_dim_ to _dspace_. Replaced H5O_SIM_DTYPE and the compound data type messages with a single H5O_DTYPE message. Changed _sim_dtype_ to _dtype_. Changed H5O_STD_STORE to H5O_CSTORE (contiguous storage) since contiguous storage is not necessarily standard. Changed _std_store_ to _cstore_ in H5Ocstore.c Added the H5O_EFL (external file list) message. Changed H5O_new() to H5O_create() to make names more uniform across packages. ./src/H5Oefl.c NEW External file list message for specifying which non-hdf5 files contain raw data for a dataset. ./src/H5P.c ./src/H5Pprivate.h ./src/H5Ppublic.h Renamed and moved data structures to make the names conform to our naming scheme. ./src/H5T.c ./src/H5Tprivate.h ./src/H5Tpublic.h ./src/H5Tpkg.h NEW Data structures redesigned to be more flexible. The interface was redesigned to make it more regular and to make some names more uniform across packages. ./src/H5detect.c Output was changed to produce a file that conforms to the hdf5 coding standard. ./src/Makefile.in Generates H5Tinit.c by running H5detect. ./src/debug.c Moved command argument processing.
This commit is contained in:
parent
3aee91269b
commit
082dd8cda9
80
src/H5.c
80
src/H5.c
@ -41,27 +41,28 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
#include <H5ACprivate.h> /*cache */
|
||||
#include <H5Bprivate.h> /*B-link trees */
|
||||
#include <H5Eprivate.h> /*error handling */
|
||||
#include <H5Tprivate.h> /*data types */
|
||||
|
||||
#define PABLO_MASK H5_mask
|
||||
|
||||
/*--------------------- Locally scoped variables -----------------------------*/
|
||||
|
||||
/* Whether we've installed the library termination function yet for this interface */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
|
||||
hbool_t library_initialize_g = FALSE;
|
||||
hbool_t thread_initialize_g = FALSE;
|
||||
hbool_t install_atexit_g = TRUE;
|
||||
|
||||
typedef struct H5_exit {
|
||||
void (*func)(void); /* Interface function to call during exit */
|
||||
struct H5_exit *next; /* Pointer to next node with exit function */
|
||||
} H5_exit_t;
|
||||
void (*func)(void); /* Interface function to call during exit */
|
||||
struct H5_exit *next; /* Pointer to next node with exit function */
|
||||
} H5_exit_t;
|
||||
|
||||
H5_exit_t *lib_exit_head; /* Pointer to the head of the list of 'atexit' functions */
|
||||
|
||||
/*------------------_-- Local function prototypes ----------------------------*/
|
||||
static herr_t H5_init_interface(void);
|
||||
/* Interface initialization */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT H5_init_interface
|
||||
static herr_t H5_init_interface (void);
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
@ -77,15 +78,24 @@ DESCRIPTION
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t H5_init_library(void)
|
||||
{
|
||||
FUNC_ENTER (H5_init_library, NULL, FAIL);
|
||||
FUNC_ENTER_INIT (H5_init_library, NULL, FAIL);
|
||||
|
||||
/* Install atexit() library cleanup routine */
|
||||
if(install_atexit_g==TRUE)
|
||||
if (HDatexit(&H5_term_library) != 0)
|
||||
HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL);
|
||||
/* Install atexit() library cleanup routine */
|
||||
if(install_atexit_g==TRUE)
|
||||
if (HDatexit(&H5_term_library) != 0)
|
||||
HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL);
|
||||
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
} /* H5_init_library */
|
||||
/*
|
||||
* Initialize interfaces that might not be able to initialize themselves
|
||||
* soon enough.
|
||||
*/
|
||||
if (H5T_init_interface ()<0) {
|
||||
HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, FAIL);
|
||||
}
|
||||
|
||||
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
@ -113,7 +123,7 @@ H5_add_exit (void (*func)(void))
|
||||
herr_t ret_value = SUCCEED;
|
||||
H5_exit_t *new;
|
||||
|
||||
FUNC_ENTER (H5_add_exit, NULL, FAIL);
|
||||
FUNC_ENTER_INIT (H5_add_exit, NULL, FAIL);
|
||||
|
||||
assert(func);
|
||||
|
||||
@ -174,7 +184,7 @@ DESCRIPTION
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t H5_init_thread(void)
|
||||
{
|
||||
FUNC_ENTER (H5_init_thread, NULL, FAIL);
|
||||
FUNC_ENTER_INIT (H5_init_thread, NULL, FAIL);
|
||||
|
||||
/* Create/initialize this thread's error stack */
|
||||
if((thrderrid=H5Enew_err_stack(16))==FAIL)
|
||||
@ -225,7 +235,7 @@ DESCRIPTION
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t H5_init_interface(void)
|
||||
{
|
||||
FUNC_ENTER (H5_init_interface, NULL, FAIL);
|
||||
FUNC_ENTER (H5_init_interface, FAIL);
|
||||
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
} /* H5_init_interface */
|
||||
@ -258,7 +268,7 @@ static herr_t H5_init_interface(void)
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t H5dont_atexit(void)
|
||||
{
|
||||
FUNC_ENTER (H5dont_atexit, NULL, FAIL);
|
||||
FUNC_ENTER_INIT (H5dont_atexit, NULL, FAIL);
|
||||
|
||||
if(install_atexit_g == TRUE)
|
||||
install_atexit_g=FALSE;
|
||||
@ -286,7 +296,7 @@ herr_t H5version(uintn *majnum, uintn *minnum, uintn *relnum, uintn *patnum)
|
||||
{
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5version, H5_init_interface, FAIL);
|
||||
FUNC_ENTER (H5version, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
@ -308,5 +318,35 @@ done:
|
||||
/* Normal function cleanup */
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* H5version */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5init
|
||||
*
|
||||
* Purpose: Initialize the library. This is normally called
|
||||
* automatically, but if you find that an HDF5 library function
|
||||
* is failing inexplicably, then try calling this function
|
||||
* first.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, December 9, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5init (void)
|
||||
{
|
||||
FUNC_ENTER (H5init, FAIL);
|
||||
/* all work is done by FUNC_ENTER() */
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
}
|
||||
|
||||
|
||||
|
145
src/H5A.c
145
src/H5A.c
@ -69,9 +69,6 @@ MODIFICATION HISTORY
|
||||
|
||||
/*-------------------- Locally scoped variables -----------------------------*/
|
||||
|
||||
/* Is the interface initialized? */
|
||||
static int interface_initialize_g = FALSE;
|
||||
|
||||
#ifdef ATOMS_ARE_CACHED
|
||||
/* Array of pointers to atomic groups */
|
||||
static hid_t atom_id_cache[ATOM_CACHE_SIZE]={-1,-1,-1,-1};
|
||||
@ -84,11 +81,15 @@ static atom_group_t *atom_group_list[MAXGROUP]={NULL};
|
||||
/* Pointer to the atom node free list */
|
||||
static atom_info_t *atom_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);
|
||||
|
||||
/*--------------------- 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 herr_t H5A_init_interface(void);
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
@ -103,7 +104,7 @@ DESCRIPTION
|
||||
static herr_t H5A_init_interface(void)
|
||||
{
|
||||
herr_t ret_value = SUCCEED;
|
||||
FUNC_ENTER (H5A_init_interface, H5A_init_interface, FAIL);
|
||||
FUNC_ENTER (H5A_init_interface, FAIL);
|
||||
|
||||
/* Registers the cleanup routine with the exit chain */
|
||||
ret_value=H5_add_exit(&H5A_term_interface);
|
||||
@ -131,13 +132,13 @@ static herr_t H5A_init_interface(void)
|
||||
intn H5Ainit_group(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 */
|
||||
void (*free_func)(void *) /* IN: Function to call when releasing ref counted objects */
|
||||
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 */
|
||||
intn ret_value=SUCCEED;
|
||||
|
||||
FUNC_ENTER (H5Ainit_group, H5A_init_interface, FAIL);
|
||||
FUNC_ENTER (H5Ainit_group, FAIL);
|
||||
|
||||
if((grp<=BADGROUP || grp>=MAXGROUP) && hash_size>0)
|
||||
HGOTO_DONE(FAIL);
|
||||
@ -219,7 +220,7 @@ intn H5Adestroy_group(group_t grp /* IN: Group to destroy */
|
||||
atom_group_t *grp_ptr=NULL; /* ptr to the atomic group */
|
||||
intn ret_value=SUCCEED;
|
||||
|
||||
FUNC_ENTER (H5Adestroy_group, H5A_init_interface, FAIL);
|
||||
FUNC_ENTER (H5Adestroy_group, FAIL);
|
||||
|
||||
if(grp<=BADGROUP || grp>=MAXGROUP)
|
||||
HGOTO_DONE(FAIL);
|
||||
@ -285,7 +286,7 @@ hid_t H5Aregister_atom(group_t grp, /* IN: Group to register the object in *
|
||||
uintn hash_loc; /* new item's hash table location */
|
||||
hid_t ret_value=SUCCEED;
|
||||
|
||||
FUNC_ENTER (H5Aregister_atom, H5A_init_interface, FAIL);
|
||||
FUNC_ENTER (H5Aregister_atom, FAIL);
|
||||
|
||||
if(grp<=BADGROUP || grp>=MAXGROUP)
|
||||
HGOTO_DONE(FAIL);
|
||||
@ -362,46 +363,39 @@ done:
|
||||
|
||||
/******************************************************************************
|
||||
NAME
|
||||
H5Ainc_ref - Adds a reference to a reference counted atom.
|
||||
|
||||
H5A_inc_ref - Adds a reference to a reference counted atom.
|
||||
IN: Atom to increment reference count for
|
||||
DESCRIPTION
|
||||
Increments the number of references outstanding for an atom. This will
|
||||
fail if the group is not a reference counted group.
|
||||
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
atm/FAIL
|
||||
|
||||
*******************************************************************************/
|
||||
intn H5Ainc_ref(hid_t atm /* IN: Atom to increment reference count for */
|
||||
)
|
||||
hid_t
|
||||
H5A_inc_ref (hid_t atm)
|
||||
{
|
||||
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 */
|
||||
intn ret_value=FAIL;
|
||||
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 */
|
||||
hid_t ret_value=FAIL;
|
||||
|
||||
FUNC_ENTER (H5Ainc_ref, H5A_init_interface, FAIL);
|
||||
FUNC_ENTER (H5A_inc_ref, FAIL);
|
||||
|
||||
grp_ptr=atom_group_list[grp];
|
||||
if(grp_ptr==NULL || grp_ptr->count<=0 || grp_ptr->free_func==NULL)
|
||||
HGOTO_DONE(FAIL);
|
||||
grp_ptr = atom_group_list[grp];
|
||||
if (grp_ptr==NULL || grp_ptr->count<=0 || grp_ptr->free_func==NULL) {
|
||||
HRETURN (FAIL);
|
||||
}
|
||||
|
||||
/* General lookup of the atom */
|
||||
if((atm_ptr=H5A_find_atom(atm))!=NULL)
|
||||
{
|
||||
atm_ptr->count++;
|
||||
ret_value=SUCCEED;
|
||||
} /* end if */
|
||||
/* General lookup of the atom */
|
||||
if ((atm_ptr=H5A_find_atom(atm))!=NULL) {
|
||||
atm_ptr->count++;
|
||||
ret_value=atm;
|
||||
}
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
|
||||
/* Normal function cleanup */
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5Ainc_ref() */
|
||||
FUNC_LEAVE (ret_value);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
NAME
|
||||
@ -423,7 +417,7 @@ VOIDP H5Aatom_object(hid_t atm /* IN: Atom to retrieve object for */
|
||||
atom_info_t *atm_ptr=NULL; /* ptr to the new atom */
|
||||
VOIDP ret_value=NULL;
|
||||
|
||||
FUNC_ENTER (H5Aatom_object, H5A_init_interface, NULL);
|
||||
FUNC_ENTER (H5Aatom_object, NULL);
|
||||
|
||||
#ifdef ATOMS_ARE_CACHED
|
||||
/* Look for the atom in the cache first */
|
||||
@ -479,7 +473,7 @@ group_t H5Aatom_group(hid_t atm /* IN: Atom to retrieve group for */
|
||||
{
|
||||
group_t ret_value=BADGROUP;
|
||||
|
||||
FUNC_ENTER (H5Aatom_group, H5A_init_interface, FAIL);
|
||||
FUNC_ENTER (H5Aatom_group, FAIL);
|
||||
|
||||
ret_value=ATOM_TO_GROUP(atm);
|
||||
if(ret_value<=BADGROUP || ret_value>=MAXGROUP)
|
||||
@ -519,7 +513,7 @@ VOIDP H5Aremove_atom(hid_t atm /* IN: Atom to remove */
|
||||
#endif /* ATOMS_ARE_CACHED */
|
||||
VOIDP ret_value=NULL;
|
||||
|
||||
FUNC_ENTER (H5Aremove_atom, H5A_init_interface, NULL);
|
||||
FUNC_ENTER (H5Aremove_atom, NULL);
|
||||
|
||||
grp=ATOM_TO_GROUP(atm);
|
||||
if(grp<=BADGROUP || grp>=MAXGROUP)
|
||||
@ -582,8 +576,8 @@ done:
|
||||
|
||||
/******************************************************************************
|
||||
NAME
|
||||
H5Adec_ref - Decrements a reference to a reference counted atom.
|
||||
|
||||
H5A_dec_ref - Decrements a reference to a reference counted atom.
|
||||
IN: Atom to decrement reference count for
|
||||
DESCRIPTION
|
||||
Decrements the number of references outstanding for an atom. This will
|
||||
fail if the group is not a reference counted group. The atom group's
|
||||
@ -594,42 +588,37 @@ done:
|
||||
SUCCEED/FAIL
|
||||
|
||||
*******************************************************************************/
|
||||
intn H5Adec_ref(hid_t atm /* IN: Atom to decrement reference count for */
|
||||
)
|
||||
intn
|
||||
H5A_dec_ref (hid_t atm)
|
||||
{
|
||||
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 */
|
||||
VOIDP obj; /* object to call 'free' function with */
|
||||
intn ret_value=FAIL;
|
||||
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 */
|
||||
VOIDP obj; /* object to call 'free' function with */
|
||||
intn ret_value=FAIL;
|
||||
|
||||
FUNC_ENTER (H5Adec_ref, H5A_init_interface, FAIL);
|
||||
FUNC_ENTER (H5A_dec_ref, FAIL);
|
||||
|
||||
grp_ptr=atom_group_list[grp];
|
||||
if(grp_ptr==NULL || grp_ptr->count<=0 || grp_ptr->free_func==NULL)
|
||||
HGOTO_DONE(FAIL);
|
||||
grp_ptr = atom_group_list[grp];
|
||||
if (grp_ptr==NULL || grp_ptr->count<=0 || grp_ptr->free_func==NULL) {
|
||||
HRETURN (FAIL);
|
||||
}
|
||||
|
||||
/* General lookup of the atom */
|
||||
if ((atm_ptr=H5A_find_atom(atm))!=NULL) {
|
||||
/* Decrement the reference count */
|
||||
atm_ptr->count--;
|
||||
|
||||
/* General lookup of the atom */
|
||||
if((atm_ptr=H5A_find_atom(atm))!=NULL)
|
||||
{
|
||||
/* Decrement the reference count */
|
||||
atm_ptr->count--;
|
||||
/* If the reference count is zero, remove the object from the group */
|
||||
if (0==atm_ptr->count && (obj=H5Aremove_atom(atm))!=NULL) {
|
||||
/* call the user's 'free' function for the atom's information */
|
||||
(*grp_ptr->free_func)(obj);
|
||||
}
|
||||
ret_value=SUCCEED;
|
||||
}
|
||||
|
||||
/* If the reference count is zero, remove the object from the group */
|
||||
if(atm_ptr->count==0 && (obj=H5Aremove_atom(atm))!=NULL)
|
||||
(*grp_ptr->free_func)(obj); /* call the user's 'free' function for the atom's information */
|
||||
ret_value=SUCCEED;
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
|
||||
/* Normal function cleanup */
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5Adec_ref() */
|
||||
FUNC_LEAVE (ret_value);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
NAME
|
||||
@ -655,7 +644,7 @@ VOIDP H5Asearch_atom(group_t grp, /* IN: Group to search for the object i
|
||||
intn i; /* local counting variable */
|
||||
VOIDP ret_value=NULL;
|
||||
|
||||
FUNC_ENTER (H5Asearch_atom, H5A_init_interface, NULL);
|
||||
FUNC_ENTER (H5Asearch_atom, NULL);
|
||||
|
||||
if(grp<=BADGROUP || grp>=MAXGROUP)
|
||||
HGOTO_DONE(NULL);
|
||||
@ -705,7 +694,7 @@ intn H5Ais_reserved(hid_t atm /* IN: Group to search for the object in */
|
||||
group_t grp; /* atom's atomic group */
|
||||
hbool_t ret_value=BFAIL;
|
||||
|
||||
FUNC_ENTER (H5Ais_reserved, H5A_init_interface, FAIL);
|
||||
FUNC_ENTER (H5Ais_reserved, FAIL);
|
||||
|
||||
grp=ATOM_TO_GROUP(atm);
|
||||
if(grp<=BADGROUP || grp>=MAXGROUP)
|
||||
@ -751,7 +740,7 @@ static atom_info_t *H5A_find_atom(hid_t atm /* IN: Atom to retrieve atom for *
|
||||
uintn hash_loc; /* atom's hash table location */
|
||||
atom_info_t *ret_value=NULL;
|
||||
|
||||
FUNC_ENTER (H5A_find_atom, H5A_init_interface, NULL);
|
||||
FUNC_ENTER (H5A_find_atom, NULL);
|
||||
|
||||
grp=ATOM_TO_GROUP(atm);
|
||||
if(grp<=BADGROUP || grp>=MAXGROUP)
|
||||
@ -807,7 +796,7 @@ static atom_info_t *H5A_get_atom_node(void)
|
||||
{
|
||||
atom_info_t *ret_value=NULL;
|
||||
|
||||
FUNC_ENTER (H5A_get_atom_node, H5A_init_interface, NULL);
|
||||
FUNC_ENTER (H5A_get_atom_node, NULL);
|
||||
|
||||
if(atom_free_list!=NULL)
|
||||
{
|
||||
@ -845,7 +834,7 @@ done:
|
||||
static herr_t
|
||||
H5A_release_atom_node(atom_info_t *atm)
|
||||
{
|
||||
FUNC_ENTER (H5A_release_atom_node, H5A_init_interface, FAIL);
|
||||
FUNC_ENTER (H5A_release_atom_node, FAIL);
|
||||
|
||||
/* Insert the atom at the beginning of the free list */
|
||||
atm->next=atom_free_list;
|
||||
|
24
src/H5AC.c
24
src/H5AC.c
@ -35,15 +35,17 @@
|
||||
* Private file-scope variables.
|
||||
*/
|
||||
#define PABLO_MASK H5AC_mask
|
||||
#define INTERFACE_INIT NULL
|
||||
static int interface_initialize_g = FALSE; /*initialized?*/
|
||||
|
||||
|
||||
#ifdef H5AC_SORT_BY_ADDR
|
||||
static H5AC_t *current_cache_g = NULL; /*for sorting */
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5AC_new
|
||||
* Function: H5AC_create
|
||||
*
|
||||
* Purpose: Initialize the cache just after a file is opened. The
|
||||
* SIZE_HINT is the number of cache slots desired. If you
|
||||
@ -63,10 +65,10 @@ static H5AC_t *current_cache_g = NULL; /*for sorting */
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5AC_new (H5F_t *f, intn size_hint)
|
||||
H5AC_create (H5F_t *f, intn size_hint)
|
||||
{
|
||||
H5AC_t *cache = NULL;
|
||||
FUNC_ENTER (H5AC_new, NULL, FAIL);
|
||||
FUNC_ENTER (H5AC_create, FAIL);
|
||||
|
||||
assert (f);
|
||||
assert (NULL==f->shared->cache);
|
||||
@ -103,7 +105,7 @@ herr_t
|
||||
H5AC_dest (H5F_t *f)
|
||||
{
|
||||
H5AC_t *cache = NULL;
|
||||
FUNC_ENTER (H5AC_dest, NULL, FAIL);
|
||||
FUNC_ENTER (H5AC_dest, FAIL);
|
||||
|
||||
assert (f);
|
||||
assert (f->shared->cache);
|
||||
@ -184,7 +186,7 @@ H5AC_find_f (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
|
||||
H5AC_slot_t *slot = NULL;
|
||||
H5AC_t *cache = NULL;
|
||||
|
||||
FUNC_ENTER (H5AC_find, NULL, NULL);
|
||||
FUNC_ENTER (H5AC_find, NULL);
|
||||
|
||||
assert (f);
|
||||
assert (f->shared->cache);
|
||||
@ -349,7 +351,7 @@ H5AC_flush (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
|
||||
intn nslots;
|
||||
H5AC_t *cache=NULL;
|
||||
|
||||
FUNC_ENTER (H5AC_flush, NULL, FAIL);
|
||||
FUNC_ENTER (H5AC_flush, FAIL);
|
||||
|
||||
assert (f);
|
||||
assert (f->shared->cache);
|
||||
@ -465,7 +467,7 @@ H5AC_set (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr, void *thing)
|
||||
H5AC_slot_t *slot = NULL;
|
||||
H5AC_t *cache=NULL;
|
||||
|
||||
FUNC_ENTER (H5AC_set, NULL, FAIL);
|
||||
FUNC_ENTER (H5AC_set, FAIL);
|
||||
|
||||
assert (f);
|
||||
assert (f->shared->cache);
|
||||
@ -535,7 +537,7 @@ H5AC_rename (H5F_t *f, const H5AC_class_t *type,
|
||||
herr_t status;
|
||||
H5AC_t *cache=NULL;
|
||||
|
||||
FUNC_ENTER (H5AC_rename, NULL, FAIL);
|
||||
FUNC_ENTER (H5AC_rename, FAIL);
|
||||
|
||||
assert (f);
|
||||
assert (f->shared->cache);
|
||||
@ -639,7 +641,7 @@ H5AC_protect (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
|
||||
}
|
||||
#endif
|
||||
|
||||
FUNC_ENTER (H5AC_protect, NULL, NULL);
|
||||
FUNC_ENTER (H5AC_protect, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -746,7 +748,7 @@ H5AC_unprotect (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
|
||||
H5AC_t *cache = NULL;
|
||||
H5AC_slot_t *slot = NULL;
|
||||
|
||||
FUNC_ENTER (H5AC_unprotect, NULL, FAIL);
|
||||
FUNC_ENTER (H5AC_unprotect, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -830,7 +832,7 @@ H5AC_debug (H5F_t *f)
|
||||
H5AC_t *cache = f->shared->cache;
|
||||
double miss_rate;
|
||||
|
||||
FUNC_ENTER (H5AC_debug, NULL, FAIL);
|
||||
FUNC_ENTER (H5AC_debug, FAIL);
|
||||
|
||||
fprintf (stderr, "HDF5-DIAG: cache diagnostics for %s\n", f->name);
|
||||
fprintf (stderr, " %18s %8s %8s %8s %8s+%-8s\n",
|
||||
|
@ -111,7 +111,7 @@ herr_t H5AC_unprotect (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
|
||||
void *thing);
|
||||
herr_t H5AC_flush (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
|
||||
hbool_t destroy);
|
||||
herr_t H5AC_new (H5F_t *f, intn size_hint);
|
||||
herr_t H5AC_create (H5F_t *f, intn size_hint);
|
||||
herr_t H5AC_rename (H5F_t *f, const H5AC_class_t *type,
|
||||
const haddr_t *old_addr, const haddr_t *new_addr);
|
||||
herr_t H5AC_set (H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
|
||||
|
@ -81,9 +81,12 @@ typedef struct atom_group_struct_tag {
|
||||
intn hash_size; /* size of 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 */
|
||||
void (*free_func)(void *); /* Pointer to function to call when releasing ref counted object */
|
||||
herr_t (*free_func)(void *); /* Pointer to function to call when releasing ref counted object */
|
||||
atom_info_t **atom_list;/* pointer to an array of ptrs to atoms */
|
||||
}atom_group_t;
|
||||
|
||||
intn H5A_dec_ref (hid_t atm);
|
||||
hid_t H5A_inc_ref (hid_t atm);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,17 @@ typedef enum {
|
||||
BADGROUP=(-1), /* Invalid Group */
|
||||
H5_ERR=0, /* Group ID for Error stack objects */
|
||||
H5_FILE, /* Group ID for File objects */
|
||||
H5_TEMPLATE, /* Group ID for Template objects */
|
||||
H5_TEMPLATE_0, /* Group ID for Template objects */
|
||||
H5_TEMPLATE_1, /* Group ID for Template objects */
|
||||
H5_TEMPLATE_2, /* Group ID for Template objects */
|
||||
H5_TEMPLATE_3, /* Group ID for Template objects */
|
||||
H5_TEMPLATE_4, /* Group ID for Template objects */
|
||||
H5_TEMPLATE_5, /* Group ID for Template objects */
|
||||
H5_TEMPLATE_6, /* Group ID for Template objects */
|
||||
H5_TEMPLATE_7, /* Group ID for Template objects */
|
||||
#ifndef NDEBUG
|
||||
H5_TEMPLATE_MAX, /* Not really a group ID */
|
||||
#endif
|
||||
H5_DATATYPE, /* Group ID for Datatype objects */
|
||||
H5_DATASPACE, /* Group ID for Dataspace objects */
|
||||
H5_DATASET, /* Group ID for Dataset objects */
|
||||
@ -42,15 +52,16 @@ typedef int32 hid_t;
|
||||
typedef intn (*H5Asearch_func_t)(const VOIDP obj, const VOIDP key);
|
||||
|
||||
/* # of bits to use for Group ID in each atom (change if MAXGROUP>16) */
|
||||
#define GROUP_BITS 4
|
||||
#define GROUP_MASK 0x0F
|
||||
#define GROUP_BITS 8
|
||||
#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
|
||||
|
||||
/* Combine a Group number and an atom index into an atom */
|
||||
#define MAKE_ATOM(g,i) ((((hid_t)(g)&GROUP_MASK)<<((sizeof(hid_t)*8)-GROUP_BITS))|((hid_t)(i)&ATOM_MASK))
|
||||
#define MAKE_ATOM(g,i) ((((hid_t)(g)&GROUP_MASK)<<ATOM_BITS)| \
|
||||
((hid_t)(i)&ATOM_MASK))
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -73,7 +84,7 @@ extern "C" {
|
||||
intn H5Ainit_group(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 */
|
||||
void (*free_func)(void *) /* IN: Function to call when releasing ref counted objects */
|
||||
herr_t (*free_func)(void *) /* IN: Function to call when releasing ref counted objects */
|
||||
);
|
||||
|
||||
/******************************************************************************
|
||||
@ -113,21 +124,6 @@ hid_t H5Aregister_atom(group_t grp, /* IN: Group to register the object in *
|
||||
const void *object /* IN: Object to attach to atom */
|
||||
);
|
||||
|
||||
/******************************************************************************
|
||||
NAME
|
||||
H5Ainc_ref - Adds a reference to a reference counted atom.
|
||||
|
||||
DESCRIPTION
|
||||
Increments the number of references outstanding for an atom. This will
|
||||
fail if the group is not a reference counted group.
|
||||
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
|
||||
*******************************************************************************/
|
||||
intn H5Ainc_ref(hid_t atm /* IN: Atom to increment reference count for */
|
||||
);
|
||||
|
||||
/******************************************************************************
|
||||
NAME
|
||||
H5Aatom_object - Returns to the object ptr for the atom
|
||||
@ -170,22 +166,6 @@ group_t H5Aatom_group(hid_t atm /* IN: Atom to retrieve group for */
|
||||
VOIDP H5Aremove_atom(hid_t atm /* IN: Atom to remove */
|
||||
);
|
||||
|
||||
/******************************************************************************
|
||||
NAME
|
||||
H5Adec_ref - Decrements a reference to a reference counted atom.
|
||||
|
||||
DESCRIPTION
|
||||
Decrements the number of references outstanding for an atom. 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.
|
||||
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
|
||||
*******************************************************************************/
|
||||
intn H5Adec_ref(hid_t atm /* IN: Atom to decrement reference count for */
|
||||
);
|
||||
|
||||
/******************************************************************************
|
||||
NAME
|
||||
|
49
src/H5B.c
49
src/H5B.c
@ -131,12 +131,13 @@ static const H5AC_class_t H5AC_BT[1] = {{
|
||||
(herr_t(*)(H5F_t*,hbool_t,const haddr_t*,void*))H5B_flush,
|
||||
}};
|
||||
|
||||
/* Is the H5B interface initialized? */
|
||||
/* Interface initialization? */
|
||||
#define INTERFACE_INIT NULL
|
||||
static interface_initialize_g = FALSE;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B_new
|
||||
* Function: H5B_create
|
||||
*
|
||||
* Purpose: Creates a new empty B-tree leaf node. The UDATA pointer is
|
||||
* passed as an argument to the sizeof_rkey() method for the
|
||||
@ -156,14 +157,14 @@ static interface_initialize_g = FALSE;
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5B_new (H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *retval)
|
||||
H5B_create (H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *retval)
|
||||
{
|
||||
H5B_t *bt=NULL;
|
||||
size_t size, sizeof_rkey;
|
||||
size_t total_native_keysize;
|
||||
intn offset, i;
|
||||
|
||||
FUNC_ENTER (H5B_new, NULL, FAIL);
|
||||
FUNC_ENTER (H5B_create, FAIL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -202,7 +203,7 @@ H5B_new (H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *retval)
|
||||
*/
|
||||
for (i=0,offset=H5B_SIZEOF_HDR(f);
|
||||
i<2*H5B_K(f,type);
|
||||
i++,offset+=bt->sizeof_rkey+H5F_SIZEOF_OFFSET(f)) {
|
||||
i++,offset+=bt->sizeof_rkey+H5F_SIZEOF_ADDR(f)) {
|
||||
|
||||
bt->key[i].dirty = FALSE;
|
||||
bt->key[i].rkey = bt->page + offset;
|
||||
@ -258,7 +259,7 @@ H5B_load (H5F_t *f, const haddr_t *addr, const void *_type, void *udata)
|
||||
uint8 *p;
|
||||
H5B_t *ret_value = NULL;
|
||||
|
||||
FUNC_ENTER (H5B_load, NULL, NULL);
|
||||
FUNC_ENTER (H5B_load, NULL);
|
||||
|
||||
/* Check arguments */
|
||||
assert (f);
|
||||
@ -312,7 +313,7 @@ H5B_load (H5F_t *f, const haddr_t *addr, const void *_type, void *udata)
|
||||
H5F_addr_decode (f, (const uint8**)&p, bt->child+i);
|
||||
} else {
|
||||
H5F_addr_undef (bt->child+i);
|
||||
p += H5F_SIZEOF_OFFSET(f);
|
||||
p += H5F_SIZEOF_ADDR(f);
|
||||
}
|
||||
}
|
||||
|
||||
@ -358,7 +359,7 @@ H5B_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5B_t *bt)
|
||||
size_t size = 0;
|
||||
uint8 *p = bt->page;
|
||||
|
||||
FUNC_ENTER (H5B_flush, NULL, FAIL);
|
||||
FUNC_ENTER (H5B_flush, FAIL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -408,7 +409,7 @@ H5B_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5B_t *bt)
|
||||
if (i<bt->ndirty) {
|
||||
H5F_addr_encode (f, &p, &(bt->child[i]));
|
||||
} else {
|
||||
p += H5F_SIZEOF_OFFSET(f);
|
||||
p += H5F_SIZEOF_ADDR(f);
|
||||
}
|
||||
}
|
||||
|
||||
@ -469,7 +470,7 @@ H5B_find (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata)
|
||||
intn idx=-1, lt=0, rt, cmp=1;
|
||||
int ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER (H5B_find, NULL, FAIL);
|
||||
FUNC_ENTER (H5B_find, FAIL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -567,7 +568,7 @@ H5B_split (H5F_t *f, const H5B_class_t *type, H5B_t *old_bt,
|
||||
intn i, k;
|
||||
size_t recsize = 0;
|
||||
|
||||
FUNC_ENTER (H5B_split, NULL, FAIL);
|
||||
FUNC_ENTER (H5B_split, FAIL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -580,13 +581,13 @@ H5B_split (H5F_t *f, const H5B_class_t *type, H5B_t *old_bt,
|
||||
* Initialize variables.
|
||||
*/
|
||||
assert (old_bt->nchildren == 2*H5B_K(f,type));
|
||||
recsize = old_bt->sizeof_rkey + H5F_SIZEOF_OFFSET(f);
|
||||
recsize = old_bt->sizeof_rkey + H5F_SIZEOF_ADDR(f);
|
||||
k = H5B_K(f,type);
|
||||
|
||||
/*
|
||||
* Create the new B-tree node.
|
||||
*/
|
||||
if (H5B_new (f, type, udata, new_addr/*out*/)<0) {
|
||||
if (H5B_create (f, type, udata, new_addr/*out*/)<0) {
|
||||
HGOTO_ERROR (H5E_BTREE, H5E_CANTINIT, FAIL);
|
||||
}
|
||||
if (NULL==(new_bt=H5AC_protect (f, H5AC_BT, new_addr, type, udata))) {
|
||||
@ -671,7 +672,7 @@ done:
|
||||
static herr_t
|
||||
H5B_decode_key (H5F_t *f, H5B_t *bt, intn idx)
|
||||
{
|
||||
FUNC_ENTER (H5B_decode_key, NULL, FAIL);
|
||||
FUNC_ENTER (H5B_decode_key, FAIL);
|
||||
|
||||
bt->key[idx].nkey = bt->native + idx * bt->type->sizeof_nkey;
|
||||
if ((bt->type->decode)(f, bt, bt->key[idx].rkey,
|
||||
@ -702,7 +703,7 @@ H5B_decode_key (H5F_t *f, H5B_t *bt, intn idx)
|
||||
static herr_t
|
||||
H5B_decode_keys (H5F_t *f, H5B_t *bt, intn idx)
|
||||
{
|
||||
FUNC_ENTER (H5B_decode_keys, NULL, FAIL);
|
||||
FUNC_ENTER (H5B_decode_keys, FAIL);
|
||||
|
||||
assert (f);
|
||||
assert (bt);
|
||||
@ -750,7 +751,7 @@ H5B_insert (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
|
||||
uint8 *buf;
|
||||
H5B_ins_t my_ins = H5B_INS_ERROR;
|
||||
|
||||
FUNC_ENTER (H5B_insert, NULL, FAIL);
|
||||
FUNC_ENTER (H5B_insert, FAIL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -891,12 +892,12 @@ H5B_insert_child (H5F_t *f, const H5B_class_t *type, H5B_t *bt,
|
||||
size_t recsize;
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER (H5B_insert_child, NULL, FAIL);
|
||||
FUNC_ENTER (H5B_insert_child, FAIL);
|
||||
assert (bt);
|
||||
assert (child);
|
||||
|
||||
bt->dirty = TRUE;
|
||||
recsize = bt->sizeof_rkey + H5F_SIZEOF_OFFSET(f);
|
||||
recsize = bt->sizeof_rkey + H5F_SIZEOF_ADDR(f);
|
||||
|
||||
if (H5B_INS_RIGHT==anchor) {
|
||||
/*
|
||||
@ -1005,7 +1006,7 @@ H5B_insert_helper (H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
|
||||
H5B_ins_t my_ins = H5B_INS_ERROR;
|
||||
H5B_ins_t ret_value = H5B_INS_ERROR;
|
||||
|
||||
FUNC_ENTER (H5B_insert_helper, NULL, H5B_INS_ERROR);
|
||||
FUNC_ENTER (H5B_insert_helper, H5B_INS_ERROR);
|
||||
|
||||
/*
|
||||
* Check arguments
|
||||
@ -1362,7 +1363,7 @@ H5B_list (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata)
|
||||
intn i;
|
||||
herr_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER (H5B_list, NULL, FAIL);
|
||||
FUNC_ENTER (H5B_list, FAIL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -1442,7 +1443,7 @@ H5B_nodesize (H5F_t *f, const H5B_class_t *type,
|
||||
{
|
||||
size_t size;
|
||||
|
||||
FUNC_ENTER (H5B_nodesize, NULL, (size_t)0);
|
||||
FUNC_ENTER (H5B_nodesize, (size_t)0);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -1463,7 +1464,7 @@ H5B_nodesize (H5F_t *f, const H5B_class_t *type,
|
||||
* Total node size.
|
||||
*/
|
||||
size = (H5B_SIZEOF_HDR(f) + /*node header */
|
||||
2 * H5B_K(f,type) * H5F_SIZEOF_OFFSET(f) + /*child pointers*/
|
||||
2 * H5B_K(f,type) * H5F_SIZEOF_ADDR(f) + /*child pointers*/
|
||||
(2*H5B_K(f,type)+1) * sizeof_rkey); /*keys */
|
||||
|
||||
FUNC_LEAVE (size);
|
||||
@ -1494,7 +1495,7 @@ H5B_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
|
||||
H5B_t *bt = NULL;
|
||||
int i;
|
||||
|
||||
FUNC_ENTER (H5B_debug, NULL, FAIL);
|
||||
FUNC_ENTER (H5B_debug, FAIL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -1596,7 +1597,7 @@ H5B_assert (H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
|
||||
struct child_t *next;
|
||||
} *head=NULL, *tail=NULL, *prev=NULL, *cur=NULL, *tmp=NULL;
|
||||
|
||||
FUNC_ENTER (H5B_assert, NULL, FAIL);
|
||||
FUNC_ENTER (H5B_assert, FAIL);
|
||||
if (0==ncalls++) {
|
||||
fprintf (stderr, "HDF5-DIAG: debugging B-trees (expensive)\n");
|
||||
}
|
||||
|
@ -39,10 +39,10 @@
|
||||
#define H5B_SIZEOF_HDR(F) \
|
||||
(H5B_SIZEOF_MAGIC + /*magic number */ \
|
||||
4 + /*type, level, num entries */ \
|
||||
2*H5F_SIZEOF_OFFSET(F)) /*left and right sibling addresses */
|
||||
2*H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */
|
||||
|
||||
#define H5B_K(F,TYPE) /*K value given file and Btree subclass */ \
|
||||
((F)->shared->file_create_parms.btree_k[(TYPE)->id])
|
||||
((F)->shared->create_parms.btree_k[(TYPE)->id])
|
||||
|
||||
typedef enum H5B_ins_t {
|
||||
H5B_INS_ERROR =-1, /*error return value */
|
||||
@ -114,7 +114,7 @@ typedef struct H5B_t {
|
||||
*/
|
||||
herr_t H5B_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
|
||||
intn fwidth, const H5B_class_t *type, void *udata);
|
||||
herr_t H5B_new (H5F_t *f, const H5B_class_t *type, void *udata, haddr_t*);
|
||||
herr_t H5B_create (H5F_t *f, const H5B_class_t *type, void *udata, haddr_t*);
|
||||
herr_t H5B_find (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
|
||||
void *udata);
|
||||
herr_t H5B_insert (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
|
||||
|
849
src/H5C.c
849
src/H5C.c
@ -37,33 +37,20 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
#include <H5Aprivate.h> /* Atoms */
|
||||
#include <H5Bprivate.h> /* B-tree subclass names */
|
||||
#include <H5Cprivate.h> /* Template information */
|
||||
#include <H5Dprivate.h> /* Datasets */
|
||||
#include <H5Eprivate.h> /* Error handling */
|
||||
#include <H5MMprivate.h> /* Memory management */
|
||||
|
||||
#define PABLO_MASK H5C_mask
|
||||
|
||||
/*--------------------- Locally scoped variables -----------------------------*/
|
||||
|
||||
/* Whether we've installed the library termination function yet for this interface */
|
||||
static intn interface_initialize_g = FALSE;
|
||||
|
||||
/* Define the library's default file creation template (constants in hdf5lims.h) */
|
||||
const file_create_temp_t default_file_create={
|
||||
H5C_USERBLOCK_DEFAULT, /* Default user-block size */
|
||||
H5C_SYM_LEAF_K_DEFAULT, /* Default 1/2 rank for symtab leaf nodes */
|
||||
H5C_BTREE_K_DEFAULT, /* Default 1/2 rank for btree internal nodes */
|
||||
H5C_OFFSETSIZE_DEFAULT, /* Default offset size */
|
||||
H5C_LENGTHSIZE_DEFAULT, /* Default length size */
|
||||
HDF5_BOOTBLOCK_VERSION, /* Current Boot-Block version # */
|
||||
HDF5_SMALLOBJECT_VERSION, /* Current Small-Object heap version # */
|
||||
HDF5_FREESPACE_VERSION, /* Current Free-Space info version # */
|
||||
HDF5_OBJECTDIR_VERSION, /* Current Object Directory info version # */
|
||||
HDF5_SHAREDHEADER_VERSION /* Current Shared-Header format version # */
|
||||
};
|
||||
static hid_t default_file_id=FAIL; /* Atom for the default file-creation template */
|
||||
|
||||
/*--------------------- Local function prototypes ----------------------------*/
|
||||
/* Is the interface initialized? */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT H5C_init_interface
|
||||
static herr_t H5C_init_interface(void);
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void H5C_term_interface (void);
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5C_init_interface -- Initialize interface-specific information
|
||||
@ -76,18 +63,37 @@ DESCRIPTION
|
||||
Initializes any interface-specific data or routines.
|
||||
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t H5C_init_interface(void)
|
||||
static herr_t
|
||||
H5C_init_interface (void)
|
||||
{
|
||||
herr_t ret_value = SUCCEED;
|
||||
herr_t ret_value = SUCCEED;
|
||||
intn i;
|
||||
herr_t status;
|
||||
|
||||
FUNC_ENTER (H5C_init_interface, FAIL);
|
||||
|
||||
assert (H5C_NCLASSES <= H5_TEMPLATE_MAX-H5_TEMPLATE_0);
|
||||
|
||||
FUNC_ENTER (H5C_init_interface, NULL, FAIL);
|
||||
/*
|
||||
* Initialize the mappings between template classes and atom groups. We
|
||||
* keep the two separate because template classes are publicly visible but
|
||||
* atom groups aren't.
|
||||
*/
|
||||
for (i=0; i<H5C_NCLASSES; i++) {
|
||||
status = H5Ainit_group (H5_TEMPLATE_0+i, H5A_TEMPID_HASHSIZE, 0, NULL);
|
||||
if (status<0) ret_value = FAIL;
|
||||
}
|
||||
if (ret_value<0) HRETURN_ERROR (H5E_ATOM, H5E_CANTINIT, FAIL);
|
||||
|
||||
/* Initialize the atom group for the file IDs */
|
||||
if((ret_value=H5Ainit_group(H5_TEMPLATE,H5A_TEMPID_HASHSIZE,0,NULL))!=FAIL)
|
||||
ret_value=H5_add_exit(&H5C_term_interface);
|
||||
/*
|
||||
* Register cleanup function.
|
||||
*/
|
||||
if (H5_add_exit (H5C_term_interface)<0) {
|
||||
HRETURN_ERROR (H5E_INTERNAL, H5E_CANTINIT, FAIL);
|
||||
}
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* H5C_init_interface */
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
@ -106,209 +112,185 @@ static herr_t H5C_init_interface(void)
|
||||
EXAMPLES
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
void H5C_term_interface (void)
|
||||
static void
|
||||
H5C_term_interface (void)
|
||||
{
|
||||
H5Aremove_atom(default_file_id);
|
||||
H5Adestroy_group(H5_TEMPLATE);
|
||||
} /* end H5C_term_interface() */
|
||||
intn i;
|
||||
|
||||
for (i=0; i<H5C_NCLASSES; i++) {
|
||||
H5Adestroy_group (H5_TEMPLATE_0+i);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5C_get_default_atom
|
||||
H5Ccreate
|
||||
PURPOSE
|
||||
Retrive an atom for a default HDF5 template.
|
||||
Returns a copy of the default template for some class of templates.
|
||||
USAGE
|
||||
hid_t H5C_create(type)
|
||||
hobjtype_t type; IN: Type of object to retrieve default template of
|
||||
herr_t H5Ccreate (type)
|
||||
H5C_class_t type; IN: Template class whose default is desired.
|
||||
RETURNS
|
||||
Returns template ID (atom) of the default object for a template type on
|
||||
success, FAIL on failure
|
||||
Template ID or FAIL
|
||||
|
||||
ERRORS
|
||||
ARGS BADVALUE Unknown template class.
|
||||
ATOM CANTINIT Can't register template.
|
||||
INTERNAL UNSUPPORTED Not implemented yet.
|
||||
|
||||
DESCRIPTION
|
||||
This is function retrieves atoms for the default templates for the
|
||||
different types of HDF5 templates.
|
||||
|
||||
MODIFICATIONS
|
||||
Robb Matzke, 4 Aug 1997
|
||||
The `FUNC' auto variable was changed from `H5C_create' to
|
||||
`H5C_get_default_atom'.
|
||||
Returns a copy of the default template for some class of templates.
|
||||
--------------------------------------------------------------------------*/
|
||||
hid_t H5C_get_default_atom(hobjtype_t type)
|
||||
hid_t
|
||||
H5Ccreate (H5C_class_t type)
|
||||
{
|
||||
hid_t ret_value = FAIL;
|
||||
hid_t ret_value = FAIL;
|
||||
void *tmpl = NULL;
|
||||
|
||||
FUNC_ENTER(H5C_get_default_atom, H5C_init_interface, FAIL);
|
||||
FUNC_ENTER (H5Ccreate, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
/* Allocate a new template and initialize it with default values */
|
||||
switch (type) {
|
||||
case H5C_FILE_CREATE:
|
||||
tmpl = H5MM_xmalloc (sizeof(H5F_create_t));
|
||||
memcpy (tmpl, &H5F_create_dflt, sizeof(H5F_create_t));
|
||||
break;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case H5_TEMPLATE:
|
||||
if(default_file_id==FAIL)
|
||||
{
|
||||
if((default_file_id=H5Aregister_atom(H5_TEMPLATE, (const void *)&default_file_create))==FAIL)
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL);
|
||||
} /* end else */
|
||||
HGOTO_DONE(default_file_id);
|
||||
break;
|
||||
case H5C_FILE_ACCESS:
|
||||
/* Not implemented yet */
|
||||
HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
|
||||
default:
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
} /* end switch */
|
||||
case H5C_DATASET_CREATE:
|
||||
tmpl = H5MM_xmalloc (sizeof(H5D_create_t));
|
||||
memcpy (tmpl, &H5D_create_dflt, sizeof(H5D_create_t));
|
||||
break;
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
case H5C_DATASET_XFER:
|
||||
tmpl = H5MM_xmalloc (sizeof(H5D_xfer_t));
|
||||
memcpy (tmpl, &H5D_xfer_dflt, sizeof(H5D_xfer_t));
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Unknown template class */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL);
|
||||
}
|
||||
|
||||
} /* end if */
|
||||
/* Atomize the new template */
|
||||
if ((ret_value = H5C_create (type, tmpl))<0) {
|
||||
HRETURN_ERROR (H5E_ATOM, H5E_CANTINIT, FAIL); /*can't register template*/
|
||||
}
|
||||
|
||||
/* Normal function cleanup */
|
||||
FUNC_LEAVE (ret_value);
|
||||
}
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5C_get_default_atom() */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5C_create
|
||||
*
|
||||
* Purpose: Given a pointer to some template struct, atomize the template
|
||||
* and return its ID. The template memory is not copied, so the
|
||||
* caller should not free it; it will be freed by H5C_release().
|
||||
*
|
||||
* Return: Success: A new template ID.
|
||||
*
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, December 3, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
hid_t
|
||||
H5C_create (H5C_class_t type, void *tmpl)
|
||||
{
|
||||
hid_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER (H5C_create, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (type>=0 && type<H5C_NCLASSES);
|
||||
assert (tmpl);
|
||||
|
||||
/* Atomize the new template */
|
||||
if ((ret_value = H5Aregister_atom (H5_TEMPLATE_0+type, tmpl))<0) {
|
||||
HRETURN_ERROR (H5E_ATOM, H5E_CANTINIT, FAIL); /*can't register template*/
|
||||
}
|
||||
|
||||
FUNC_LEAVE (ret_value);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5C_init
|
||||
PURPOSE
|
||||
Initialize a new HDF5 template with a copy of an existing template.
|
||||
USAGE
|
||||
herr_t H5C_init(dst_atm, src)
|
||||
hid_t dst_atm; IN: Atom for the template to initialize
|
||||
file_create_temp_t *src; IN: Template to use to initialize with
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function copies the contents of the source template into the
|
||||
newly created destination template.
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t H5C_init(hid_t dst_atm, const file_create_temp_t *src)
|
||||
{
|
||||
file_create_temp_t *dst; /* destination template */
|
||||
herr_t ret_value = SUCCEED; /* return value */
|
||||
|
||||
FUNC_ENTER(H5C_init, H5C_init_interface, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(src==NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
/* Get the template to initialize */
|
||||
if((dst=H5Aatom_object(dst_atm))==NULL)
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL);
|
||||
|
||||
/* Copy in the source template */
|
||||
HDmemcpy(dst,src,sizeof(file_create_temp_t));
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
|
||||
/* Normal function cleanup */
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5C_init() */
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5C_create
|
||||
PURPOSE
|
||||
Create a new HDF5 template.
|
||||
USAGE
|
||||
hid_t H5C_create(owner_id, type, name)
|
||||
hid_t owner_id; IN: Group/file which owns this template
|
||||
hobjtype_t type; IN: Type of template to create
|
||||
const char *name; IN: Name of the template to create
|
||||
RETURNS
|
||||
Returns template ID (atom) on success, FAIL on failure
|
||||
DESCRIPTION
|
||||
This is the primary function for creating different HDF5 templates.
|
||||
Currently the name of template is not used and may be NULL.
|
||||
--------------------------------------------------------------------------*/
|
||||
hid_t H5C_create(hid_t owner_id, hobjtype_t type, const char *name)
|
||||
{
|
||||
hid_t ret_value = FAIL; /* atom for template object to return */
|
||||
|
||||
FUNC_ENTER(H5C_create, H5C_init_interface, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case H5_TEMPLATE:
|
||||
{
|
||||
file_create_temp_t *new_create_temp; /* new template object to create */
|
||||
|
||||
if((new_create_temp=HDmalloc(sizeof(file_create_temp_t)))==NULL)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL);
|
||||
if((ret_value=H5Aregister_atom(H5_TEMPLATE, (const VOIDP)new_create_temp))==FAIL)
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL);
|
||||
} /* end case/block */
|
||||
break;
|
||||
|
||||
default:
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
} /* end switch */
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
|
||||
/* Normal function cleanup */
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5C_create() */
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5C_release
|
||||
H5Cclose
|
||||
PURPOSE
|
||||
Release access to a template object.
|
||||
USAGE
|
||||
herr_t H5C_release(oid)
|
||||
herr_t H5Cclose(oid)
|
||||
hid_t oid; IN: Template object to release access to
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function releases access to a template object
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t H5C_release(hid_t oid)
|
||||
herr_t
|
||||
H5Cclose (hid_t template)
|
||||
{
|
||||
file_create_temp_t *template; /* template to destroy */
|
||||
herr_t ret_value = SUCCEED;
|
||||
void *tmpl=NULL;
|
||||
|
||||
FUNC_ENTER(H5C_release, H5C_init_interface, FAIL);
|
||||
FUNC_ENTER (H5Cclose, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
/* Chuck the object! :-) */
|
||||
if (NULL==(tmpl=H5Aremove_atom (template))) {
|
||||
HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL);
|
||||
}
|
||||
H5MM_xfree (tmpl);
|
||||
|
||||
/* Chuck the object! :-) */
|
||||
if((template=H5Aremove_atom(oid))==NULL)
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL);
|
||||
HDfree(template);
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
}
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5C_class
|
||||
*
|
||||
* Purpose: Returns the class identifier for a template.
|
||||
*
|
||||
* Return: Success: A template class
|
||||
*
|
||||
* Failure: H5C_NO_CLASS (-1)
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, December 3, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5C_class_t
|
||||
H5C_class (hid_t template)
|
||||
{
|
||||
group_t group;
|
||||
H5C_class_t ret_value = H5C_NO_CLASS;
|
||||
|
||||
FUNC_ENTER (H5C_class, H5C_NO_CLASS);
|
||||
|
||||
if ((group = H5Aatom_group (template))<0 ||
|
||||
group<H5_TEMPLATE_0 || group>=H5_TEMPLATE_MAX) {
|
||||
/* not a template */
|
||||
HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, H5C_NO_CLASS);
|
||||
}
|
||||
|
||||
/* Normal function cleanup */
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5C_release() */
|
||||
ret_value = group - H5_TEMPLATE_0;
|
||||
FUNC_LEAVE (ret_value);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5Cgetparm
|
||||
PURPOSE
|
||||
Get a parameter from a template
|
||||
Get a property value from a template
|
||||
USAGE
|
||||
herr_t H5Cgetparm(tid, parm, buf)
|
||||
hid_t tid; IN: Template object to retrieve parameter from
|
||||
@ -316,6 +298,16 @@ done:
|
||||
VOIDP buf; OUT: Pointer to buffer to store parameter in
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
|
||||
ERRORS
|
||||
ARGS BADRANGE No result buffer argument supplied.
|
||||
ARGS BADRANGE Unknown property for dataset create template.
|
||||
ARGS BADRANGE Unknown property for dataset transfer template.
|
||||
ARGS BADRANGE Unknown property for file access template.
|
||||
ARGS BADRANGE Unknown property for file create template.
|
||||
ARGS BADRANGE Unknown template class.
|
||||
ATOM BADTYPE Can't unatomize template.
|
||||
|
||||
DESCRIPTION
|
||||
This function retrieves the value of a specific parameter from a
|
||||
template
|
||||
@ -328,85 +320,119 @@ done:
|
||||
Robb Matzke, 17 Oct 1997
|
||||
Added H5_ISTORE_K.
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t H5Cgetparm(hid_t tid, file_create_param_t parm, VOIDP buf)
|
||||
herr_t
|
||||
H5Cgetparm (hid_t template, H5C_prop_t prop, void *buf)
|
||||
{
|
||||
file_create_temp_t *template; /* template to query */
|
||||
herr_t ret_value = SUCCEED;
|
||||
H5C_class_t type;
|
||||
|
||||
const void *tmpl=NULL;
|
||||
const H5F_create_t *file_create=NULL;
|
||||
const H5D_create_t *dset_create=NULL;
|
||||
|
||||
FUNC_ENTER(H5Cgetparm, H5C_init_interface, FAIL);
|
||||
FUNC_ENTER (H5Cgetparm, FAIL);
|
||||
H5ECLEAR;
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(H5Aatom_group(tid)!=H5_TEMPLATE)
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, FAIL);
|
||||
if(buf==NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
/* check args */
|
||||
if (NULL==(tmpl = H5Aatom_object (template)) ||
|
||||
(type=H5C_class (template))<0) {
|
||||
/* Can't unatomize template */
|
||||
HRETURN_ERROR (H5E_ATOM, H5E_BADTYPE, FAIL);
|
||||
}
|
||||
if (!buf) {
|
||||
/* No result buffer argument supplied */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
|
||||
/* Get a pointer the template to query */
|
||||
if((template=H5Aatom_object(tid))==NULL)
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL);
|
||||
/* Handle each class of template */
|
||||
switch (type) {
|
||||
case H5C_FILE_CREATE:
|
||||
file_create = (const H5F_create_t *)tmpl;
|
||||
switch (prop) {
|
||||
case H5F_USERBLOCK_SIZE:
|
||||
*(uintn *)buf=file_create->userblock_size;
|
||||
break;
|
||||
|
||||
switch(parm)
|
||||
{
|
||||
case H5_USERBLOCK_SIZE:
|
||||
*(uintn *)buf=template->userblock_size;
|
||||
break;
|
||||
case H5F_OFFSET_SIZE:
|
||||
*(uint8 *)buf=file_create->sizeof_addr;
|
||||
break;
|
||||
|
||||
case H5_OFFSET_SIZE:
|
||||
*(uint8 *)buf=template->sizeof_addr;
|
||||
break;
|
||||
case H5F_LENGTH_SIZE:
|
||||
*(uint8 *)buf=file_create->sizeof_size;
|
||||
break;
|
||||
|
||||
case H5_LENGTH_SIZE:
|
||||
*(uint8 *)buf=template->sizeof_size;
|
||||
break;
|
||||
case H5F_SYM_LEAF_K:
|
||||
*(uintn *)buf=file_create->sym_leaf_k;
|
||||
break;
|
||||
|
||||
case H5_SYM_LEAF_K:
|
||||
*(uintn *)buf=template->sym_leaf_k;
|
||||
break;
|
||||
case H5F_SYM_INTERN_K:
|
||||
*(uintn *)buf = file_create->btree_k[H5B_SNODE_ID];
|
||||
break;
|
||||
|
||||
case H5_SYM_INTERN_K:
|
||||
*(uintn *)buf = template->btree_k[H5B_SNODE_ID];
|
||||
break;
|
||||
case H5F_ISTORE_K:
|
||||
*(uintn *)buf = file_create->btree_k[H5B_ISTORE_ID];
|
||||
break;
|
||||
|
||||
case H5_ISTORE_K:
|
||||
*(uintn *)buf = template->btree_k[H5B_ISTORE_ID];
|
||||
break;
|
||||
case H5F_BOOTBLOCK_VER:
|
||||
*(uint8 *)buf=file_create->bootblock_ver;
|
||||
break;
|
||||
|
||||
case H5_BOOTBLOCK_VER:
|
||||
*(uint8 *)buf=template->bootblock_ver;
|
||||
break;
|
||||
case H5F_SMALLOBJECT_VER:
|
||||
*(uint8 *)buf=file_create->smallobject_ver;
|
||||
break;
|
||||
|
||||
case H5_SMALLOBJECT_VER:
|
||||
*(uint8 *)buf=template->smallobject_ver;
|
||||
break;
|
||||
case H5F_FREESPACE_VER:
|
||||
*(uint8 *)buf=file_create->freespace_ver;
|
||||
break;
|
||||
|
||||
case H5_FREESPACE_VER:
|
||||
*(uint8 *)buf=template->freespace_ver;
|
||||
break;
|
||||
case H5F_OBJECTDIR_VER:
|
||||
*(uint8 *)buf=file_create->objectdir_ver;
|
||||
break;
|
||||
|
||||
case H5_OBJECTDIR_VER:
|
||||
*(uint8 *)buf=template->objectdir_ver;
|
||||
break;
|
||||
case H5F_SHAREDHEADER_VER:
|
||||
*(uint8 *)buf=file_create->sharedheader_ver;
|
||||
break;
|
||||
|
||||
case H5_SHAREDHEADER_VER:
|
||||
*(uint8 *)buf=template->sharedheader_ver;
|
||||
break;
|
||||
default:
|
||||
/* Unknown property for file create template */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
} /* end switch */
|
||||
case H5C_FILE_ACCESS:
|
||||
/* Unknown property for file access template */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
case H5C_DATASET_CREATE:
|
||||
dset_create = (const H5D_create_t *)tmpl;
|
||||
switch (prop) {
|
||||
case H5D_LAYOUT:
|
||||
*(H5D_layout_t*)buf = dset_create->layout;
|
||||
break;
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
/* none */
|
||||
} /* end if */
|
||||
case H5D_CHUNK_NDIMS:
|
||||
case H5D_CHUNK_SIZE:
|
||||
case H5D_COMPRESS:
|
||||
case H5D_PRE_OFFSET:
|
||||
case H5D_PRE_SCALE:
|
||||
/* Not implemented yet */
|
||||
HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
|
||||
/* Normal function cleanup */
|
||||
/* none */
|
||||
default:
|
||||
/* Unknown property for dataset create template */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
break;
|
||||
|
||||
case H5C_DATASET_XFER:
|
||||
/* Unknown property for dataset transfer template */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5Cgetparm() */
|
||||
default:
|
||||
/* Unknown template class */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
@ -420,6 +446,24 @@ done:
|
||||
const VOIDP buf; IN: Pointer to parameter buffer
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
|
||||
ERRORS
|
||||
ARGS BADRANGE Indexed storage internal node 1/2 rank is not
|
||||
valid.
|
||||
ARGS BADRANGE No buffer argument specified.
|
||||
ARGS BADRANGE Symbol internal node 1/2 rank is not valid.
|
||||
ARGS BADRANGE Symbol leaf node 1/2 rank is not valid.
|
||||
ARGS BADRANGE This is a read-only property.
|
||||
ARGS BADRANGE Unknown file creation property.
|
||||
ARGS BADRANGE Unknown property for dataset create template.
|
||||
ARGS BADRANGE Unknown property for dataset transfer template.
|
||||
ARGS BADRANGE Unknown property for file access template.
|
||||
ARGS BADRANGE Unknown template class.
|
||||
ARGS BADVALUE File haddr_t size is not valid.
|
||||
ARGS BADVALUE File size_t size is not valid.
|
||||
ARGS BADVALUE Userblock size is not valid.
|
||||
ATOM BADTYPE Can't unatomize template.
|
||||
|
||||
DESCRIPTION
|
||||
This function stores the value of a specific parameter for a template
|
||||
|
||||
@ -441,117 +485,154 @@ done:
|
||||
Robb Matzke, 17 Oct 1997
|
||||
Added H5_ISTORE_K.
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t H5Csetparm(hid_t tid, file_create_param_t parm, const VOIDP buf)
|
||||
herr_t
|
||||
H5Csetparm (hid_t template, H5C_prop_t prop, const void *buf)
|
||||
{
|
||||
file_create_temp_t *template; /* template to query */
|
||||
herr_t ret_value = SUCCEED;
|
||||
uintn val;
|
||||
intn i;
|
||||
void *tmpl = NULL;
|
||||
H5F_create_t *file_create = NULL;
|
||||
H5D_create_t *dset_create = NULL;
|
||||
H5C_class_t type;
|
||||
H5D_layout_t layout;
|
||||
uintn val;
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER(H5Csetparm, H5C_init_interface, FAIL);
|
||||
FUNC_ENTER (H5Csetparm, FAIL);
|
||||
H5ECLEAR;
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(H5Aatom_group(tid)!=H5_TEMPLATE)
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, FAIL);
|
||||
if(buf==NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
/* check args */
|
||||
if (NULL==(tmpl = H5Aatom_object (template)) ||
|
||||
(type = H5C_class (template))<0) {
|
||||
/* Can't unatomize template */
|
||||
HRETURN_ERROR (H5E_ATOM, H5E_BADTYPE, FAIL);
|
||||
}
|
||||
if (!buf) {
|
||||
/* No buffer argument specified */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
|
||||
/* Get a pointer the template to query */
|
||||
if((template=H5Aatom_object(tid))==NULL)
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL);
|
||||
/* Handle each class of template */
|
||||
switch (type) {
|
||||
case H5C_FILE_CREATE:
|
||||
file_create = (H5F_create_t *)tmpl;
|
||||
|
||||
switch (prop) {
|
||||
case H5F_USERBLOCK_SIZE:
|
||||
val = *(const uintn *)buf;
|
||||
for (i=8; i<8*sizeof(int); i++) {
|
||||
uintn p2 = 8==i ? 0 :1<<i;
|
||||
if (val==p2) break;
|
||||
}
|
||||
if (i>=8*sizeof(int)) {
|
||||
/* Userblock size is not valid */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL);
|
||||
}
|
||||
file_create->userblock_size=val;
|
||||
break;
|
||||
|
||||
switch(parm)
|
||||
{
|
||||
case H5_USERBLOCK_SIZE:
|
||||
val = *(const uintn *)buf;
|
||||
for (i=8; i<8*sizeof(int); i++) {
|
||||
uintn p2 = 8==i ? 0 :1<<i;
|
||||
if (val==p2) break;
|
||||
}
|
||||
if (i>=8*sizeof(int)) {
|
||||
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL);
|
||||
}
|
||||
template->userblock_size=val;
|
||||
break;
|
||||
case H5F_OFFSET_SIZE:
|
||||
val = *(const uint8 *)buf;
|
||||
if (val!=2 && val!=4 && val!=8 && val!=16) {
|
||||
/* file haddr_t size is not valid */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL);
|
||||
}
|
||||
file_create->sizeof_addr=val;
|
||||
break;
|
||||
|
||||
case H5_OFFSET_SIZE:
|
||||
val = *(const uint8 *)buf;
|
||||
if(!(val==2 || val==4 || val==8 || val==16 || val==32 || val==64 || val==128 || val==256))
|
||||
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL);
|
||||
template->sizeof_addr=val;
|
||||
break;
|
||||
case H5F_LENGTH_SIZE:
|
||||
val = *(const uint8 *)buf;
|
||||
if(val!=2 && val!=4 && val!=8 && val!=16) {
|
||||
/* file size_t size is not valid */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL);
|
||||
}
|
||||
file_create->sizeof_size=val;
|
||||
break;
|
||||
|
||||
case H5_LENGTH_SIZE:
|
||||
val = *(const uint8 *)buf;
|
||||
if(!(val==2 || val==4 || val==8 || val==16 || val==32 || val==64 || val==128 || val==256))
|
||||
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL);
|
||||
template->sizeof_size=val;
|
||||
break;
|
||||
case H5F_SYM_LEAF_K:
|
||||
val = *(const uintn *)buf;
|
||||
if (val<2) {
|
||||
/* Symbol leaf node 1/2 rank is not valid */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
file_create->sym_leaf_k = val;
|
||||
break;
|
||||
|
||||
case H5_SYM_LEAF_K:
|
||||
val = *(const uintn *)buf;
|
||||
if (val<2) {
|
||||
HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
template->sym_leaf_k = val;
|
||||
break;
|
||||
case H5F_SYM_INTERN_K:
|
||||
val = *(const uintn *)buf;
|
||||
if (val<2) {
|
||||
/* Symbol internal node 1/2 rank is not valid */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
file_create->btree_k[H5B_SNODE_ID] = val;
|
||||
break;
|
||||
|
||||
case H5_SYM_INTERN_K:
|
||||
val = *(const uintn *)buf;
|
||||
if (val<2) {
|
||||
HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
template->btree_k[H5B_SNODE_ID] = val;
|
||||
break;
|
||||
|
||||
case H5_ISTORE_K:
|
||||
val = *(const uintn *)buf;
|
||||
if (val<2) {
|
||||
HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
template->btree_k[H5B_ISTORE_ID] = val;
|
||||
break;
|
||||
case H5F_ISTORE_K:
|
||||
val = *(const uintn *)buf;
|
||||
if (val<2) {
|
||||
/* Indexed storage internal node 1/2 rank is not valid */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
file_create->btree_k[H5B_ISTORE_ID] = val;
|
||||
break;
|
||||
|
||||
case H5_BOOTBLOCK_VER: /* this should be range checked */
|
||||
template->bootblock_ver=*(const uint8 *)buf;
|
||||
break;
|
||||
case H5F_BOOTBLOCK_VER:
|
||||
case H5F_SMALLOBJECT_VER:
|
||||
case H5F_FREESPACE_VER:
|
||||
case H5F_OBJECTDIR_VER:
|
||||
case H5F_SHAREDHEADER_VER:
|
||||
/* This is a read-only property */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
case H5_SMALLOBJECT_VER: /* this should be range checked */
|
||||
template->smallobject_ver=*(const uint8 *)buf;
|
||||
break;
|
||||
default:
|
||||
/* Unknown file creation property */
|
||||
HRETURN_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
break;
|
||||
|
||||
case H5_FREESPACE_VER: /* this should be range checked */
|
||||
template->freespace_ver=*(const uint8 *)buf;
|
||||
break;
|
||||
case H5C_FILE_ACCESS:
|
||||
/* Unknown property for file access template */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
case H5C_DATASET_CREATE:
|
||||
dset_create = (H5D_create_t *)tmpl;
|
||||
switch (prop) {
|
||||
case H5D_LAYOUT:
|
||||
layout = *(const H5D_layout_t*)buf;
|
||||
if (layout<0 || layout>=H5D_NLAYOUTS) {
|
||||
/* Raw data layout method is not valid */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
dset_create->layout = layout;
|
||||
break;
|
||||
|
||||
case H5D_CHUNK_NDIMS:
|
||||
case H5D_CHUNK_SIZE:
|
||||
case H5D_COMPRESS:
|
||||
case H5D_PRE_OFFSET:
|
||||
case H5D_PRE_SCALE:
|
||||
/* Not implemented yet */
|
||||
HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
|
||||
case H5_OBJECTDIR_VER: /* this should be range checked */
|
||||
template->objectdir_ver=*(const uint8 *)buf;
|
||||
break;
|
||||
default:
|
||||
/* Unknown property for dataset create template */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
break;
|
||||
|
||||
case H5C_DATASET_XFER:
|
||||
/* Unknown property for dataset transfer template */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
case H5_SHAREDHEADER_VER: /* this should be range checked */
|
||||
template->sharedheader_ver=*(const uint8 *)buf;
|
||||
break;
|
||||
|
||||
default:
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
} /* end switch */
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
/* none */
|
||||
} /* end if */
|
||||
|
||||
/* Normal function cleanup */
|
||||
/* none */
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5Csetparm() */
|
||||
default:
|
||||
/* Unknown template class */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5C_copy
|
||||
H5Ccopy
|
||||
PURPOSE
|
||||
Copy a template
|
||||
USAGE
|
||||
@ -559,43 +640,71 @@ done:
|
||||
hid_t tid; IN: Template object to copy
|
||||
RETURNS
|
||||
Returns template ID (atom) on success, FAIL on failure
|
||||
|
||||
ERRORS
|
||||
ARGS BADRANGE Unknown template class.
|
||||
ATOM BADATOM Can't unatomize template.
|
||||
ATOM CANTREGISTER Register the atom for the new template.
|
||||
INTERNAL UNSUPPORTED Dataset transfer properties are not implemented
|
||||
yet.
|
||||
INTERNAL UNSUPPORTED File access properties are not implemented yet.
|
||||
|
||||
DESCRIPTION
|
||||
This function creates a new copy of a template with all the same parameter
|
||||
settings.
|
||||
--------------------------------------------------------------------------*/
|
||||
hid_t H5C_copy(hid_t tid)
|
||||
hid_t
|
||||
H5Ccopy (hid_t template)
|
||||
{
|
||||
file_create_temp_t *template, *new_template; /* template to query */
|
||||
herr_t ret_value = SUCCEED;
|
||||
const void *tmpl = NULL;
|
||||
void *new_tmpl = NULL;
|
||||
H5C_class_t type;
|
||||
size_t size;
|
||||
hid_t ret_value = FAIL;
|
||||
group_t group;
|
||||
|
||||
FUNC_ENTER(H5C_copy, H5C_init_interface, FAIL);
|
||||
FUNC_ENTER (H5Ccopy, FAIL);
|
||||
H5ECLEAR;
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
/* check args */
|
||||
if (NULL==(tmpl=H5Aatom_object (template)) ||
|
||||
(type=H5C_class (template))<0 ||
|
||||
(group=H5Aatom_group (template))<0) {
|
||||
/* Can't unatomize template */
|
||||
HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL);
|
||||
}
|
||||
|
||||
/* Get a pointer the template to query */
|
||||
if((template=H5Aatom_object(tid))==NULL)
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL);
|
||||
/* How big is the template */
|
||||
switch (type) {
|
||||
case H5C_FILE_CREATE:
|
||||
size = sizeof(H5F_create_t);
|
||||
break;
|
||||
|
||||
/* Allocate space for the new template */
|
||||
if((new_template=HDmalloc(sizeof(file_create_temp_t)))==NULL)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL);
|
||||
case H5C_FILE_ACCESS:
|
||||
/* File access properties are not implemented yet */
|
||||
HRETURN_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
|
||||
/* Copy over the information from the old template */
|
||||
HDmemcpy(new_template,template,sizeof(file_create_temp_t));
|
||||
case H5C_DATASET_CREATE:
|
||||
size = sizeof(H5D_create_t);
|
||||
break;
|
||||
|
||||
case H5C_DATASET_XFER:
|
||||
size = sizeof(H5D_xfer_t);
|
||||
break;
|
||||
|
||||
/* Register the atom for the new template */
|
||||
if((ret_value=H5Aregister_atom(H5_TEMPLATE, (const VOIDP)new_template))==FAIL)
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL);
|
||||
default:
|
||||
/* Unknown template class */
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
}
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
/* Create the new template */
|
||||
new_tmpl = H5MM_xmalloc (size);
|
||||
HDmemcpy (new_tmpl, tmpl, size);
|
||||
|
||||
} /* end if */
|
||||
|
||||
/* Normal function cleanup */
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5C_copy() */
|
||||
/* Register the atom for the new template */
|
||||
if ((ret_value=H5Aregister_atom (group, new_tmpl))<0) {
|
||||
HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL);
|
||||
}
|
||||
|
||||
FUNC_LEAVE (ret_value);
|
||||
}
|
||||
|
@ -24,29 +24,7 @@
|
||||
#include <H5private.h>
|
||||
#include <H5Fprivate.h>
|
||||
|
||||
/*
|
||||
* Default file-creation template values.
|
||||
*/
|
||||
#define H5C_USERBLOCK_DEFAULT 0 /* Default user blocks size in bytes */
|
||||
#define H5C_OFFSETSIZE_DEFAULT 4 /* Default file offset size in bytes */
|
||||
#define H5C_LENGTHSIZE_DEFAULT 4 /* Default file length size in bytes */
|
||||
#define H5C_SYM_LEAF_K_DEFAULT 4 /* Default K for tab leaf nodes */
|
||||
|
||||
#define H5C_BTREE_K_DEFAULT { \
|
||||
16, /* Symbol table internal nodes */ \
|
||||
32, /* Indexed storage intern nodes */ \
|
||||
0, /* unused */ \
|
||||
0, /* unused */ \
|
||||
0, /* unused */ \
|
||||
0, /* unused */ \
|
||||
0, /* unused */ \
|
||||
0 /* unused */ \
|
||||
}
|
||||
|
||||
hid_t H5C_create(hid_t owner_id, hobjtype_t type, const char *name);
|
||||
hid_t H5C_copy(hid_t tid);
|
||||
herr_t H5C_release(hid_t oid);
|
||||
hid_t H5C_get_default_atom(hobjtype_t type);
|
||||
herr_t H5C_init(hid_t dst_atm, const file_create_temp_t *src);
|
||||
hid_t H5C_create (H5C_class_t type, void *tmpl);
|
||||
H5C_class_t H5C_class (hid_t template);
|
||||
|
||||
#endif
|
||||
|
101
src/H5Cpublic.h
101
src/H5Cpublic.h
@ -1,57 +1,82 @@
|
||||
/****************************************************************************
|
||||
* 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. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file contains function prototypes for each exported function in the H5C module
|
||||
* This file contains function prototypes for each exported function in the
|
||||
* H5C module.
|
||||
*/
|
||||
|
||||
#ifndef _H5Cpublic_H
|
||||
#define _H5Cpublic_H
|
||||
|
||||
/* Default Template for creation, access, etc. templates */
|
||||
#define H5C_DEFAULT_TEMPLATE 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#define H5C_DEFAULT (-2)
|
||||
|
||||
/* Public headers needed by this file */
|
||||
#include <H5public.h>
|
||||
#include <H5Apublic.h>
|
||||
|
||||
/* Template classes */
|
||||
typedef enum H5C_class_t {
|
||||
H5C_NO_CLASS =-1, /* Error return value */
|
||||
H5C_FILE_CREATE =0, /* File creation template */
|
||||
H5C_FILE_ACCESS =1, /* File access template */
|
||||
H5C_DATASET_CREATE =2, /* Dataset creation template */
|
||||
H5C_DATASET_XFER =3, /* Dataset transfer template */
|
||||
|
||||
H5C_NCLASSES =4 /* This must be last! */
|
||||
} H5C_class_t;
|
||||
|
||||
/* Parameters to use when retrieving file-creation template information */
|
||||
typedef enum {
|
||||
H5_USERBLOCK_SIZE, /* (uintn) Size of the user block in the file in bytes */
|
||||
H5_OFFSET_SIZE, /* (uint8) Number of bytes for offsets */
|
||||
H5_LENGTH_SIZE, /* (uint8) Number of bytes for lengths */
|
||||
H5_SYM_LEAF_K, /* (uintn) 1/2 rank for symbol table leaf nodes */
|
||||
H5_SYM_INTERN_K, /* (uintn) 1/2 rank for symbol table internal nodes */
|
||||
H5_ISTORE_K, /* (uintn) 1/2 rank for indexed storage nodes */
|
||||
H5_BOOTBLOCK_VER, /* (uint8) Version # of the boot-block format */
|
||||
H5_SMALLOBJECT_VER, /* (uint8) Version # of the small-object heap format */
|
||||
H5_FREESPACE_VER, /* (uint8) Version # of the free-space info format */
|
||||
H5_OBJECTDIR_VER, /* (uint8) Version # of the object-directory format */
|
||||
H5_SHAREDHEADER_VER /* (uint8) Version # of the shared-header format */
|
||||
} file_create_param_t;
|
||||
/* Template properties, grouped by class */
|
||||
typedef enum H5C_prop_t {
|
||||
|
||||
/* File Creation Properties */
|
||||
H5F_USERBLOCK_SIZE, /* Size of the user block in the file in bytes */
|
||||
H5F_OFFSET_SIZE, /* Number of bytes for offsets */
|
||||
H5F_LENGTH_SIZE, /* Number of bytes for lengths */
|
||||
H5F_SYM_LEAF_K, /* 1/2 rank for symbol table leaf nodes */
|
||||
H5F_SYM_INTERN_K, /* 1/2 rank for symbol table internal nodes */
|
||||
H5F_ISTORE_K, /* 1/2 rank for indexed storage nodes */
|
||||
H5F_BOOTBLOCK_VER, /* Version # of the boot-block format */
|
||||
H5F_SMALLOBJECT_VER, /* Version # of the small-object heap format */
|
||||
H5F_FREESPACE_VER, /* Version # of the free-space info format */
|
||||
H5F_OBJECTDIR_VER, /* Version # of the object-directory format */
|
||||
H5F_SHAREDHEADER_VER,/* Version # of the shared-header format */
|
||||
|
||||
/* Object types for "meta" interface */
|
||||
typedef group_t hobjtype_t; /* Map the object in the "meta" interface to atom groups */
|
||||
/* File Access Properties */
|
||||
/* None defined yet */
|
||||
|
||||
/* Functions in H5C.c */
|
||||
herr_t H5Cgetparm(hid_t tid, file_create_param_t parm, VOIDP buf);
|
||||
herr_t H5Csetparm(hid_t tid, file_create_param_t parm, const VOIDP buf);
|
||||
void H5C_term_interface (void);
|
||||
/* Dataset Creation Properties */
|
||||
H5D_LAYOUT, /* Storage layout */
|
||||
H5D_CHUNK_NDIMS, /* Chunk dimensionality */
|
||||
H5D_CHUNK_SIZE, /* Chunk size vector */
|
||||
H5D_COMPRESS, /* Raw data compression */
|
||||
H5D_PRE_OFFSET, /* Precompression offset */
|
||||
H5D_PRE_SCALE, /* Precompression scale */
|
||||
|
||||
/* Dataset Transfer Properties */
|
||||
/* None defined yet */
|
||||
|
||||
} H5C_prop_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Public functions */
|
||||
hid_t H5Ccreate (H5C_class_t type);
|
||||
herr_t H5Cclose (hid_t template);
|
||||
hid_t H5Ccopy (hid_t template);
|
||||
herr_t H5Cgetparm (hid_t template, H5C_prop_t prop, void *buf);
|
||||
herr_t H5Csetparm (hid_t template, H5C_prop_t prop, const void *buf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -37,8 +37,9 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
|
||||
/*--------------------- Locally scoped variables -----------------------------*/
|
||||
|
||||
/* Whether we've installed the library termination function yet for this interface */
|
||||
/* Interface initialization */
|
||||
static intn interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
@ -62,7 +63,7 @@ herr_t H5D_convert_buf(void *dst, const void *src, uintn len, uintn size)
|
||||
char *d=(char *)dst;
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5D_convert_buf, NULL, FAIL);
|
||||
FUNC_ENTER(H5D_convert_buf, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
|
@ -24,8 +24,9 @@ typedef enum H5F_isop_t {
|
||||
|
||||
#define PABLO_MASK H5F_istore_mask
|
||||
|
||||
/* Is the interface initialized? */
|
||||
/* Interface initialization */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static size_t H5F_istore_sizeof_rkey (H5F_t *f, const void *_udata);
|
||||
@ -70,6 +71,7 @@ static herr_t H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore,
|
||||
* The storage file address is part of the B-tree and not part of the key.
|
||||
*/
|
||||
typedef struct H5F_istore_key_t {
|
||||
uintn file_number; /*external file number */
|
||||
size_t offset[H5O_ISTORE_NDIMS]; /*logical offset to start*/
|
||||
size_t size[H5O_ISTORE_NDIMS]; /*logical chunk size */
|
||||
} H5F_istore_key_t;
|
||||
@ -122,11 +124,16 @@ static size_t
|
||||
H5F_istore_sizeof_rkey (H5F_t *f, const void *_udata)
|
||||
{
|
||||
const H5F_istore_ud1_t *udata = (const H5F_istore_ud1_t *)_udata;
|
||||
size_t nbytes;
|
||||
|
||||
assert (udata);
|
||||
assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_ISTORE_NDIMS);
|
||||
|
||||
return udata->mesg.ndims * (4 + 4);
|
||||
nbytes = 4 + /*external file number */
|
||||
udata->mesg.ndims * 4 + /*dimension indices */
|
||||
udata->mesg.ndims * 4; /*dimension sizes */
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
|
||||
@ -154,16 +161,18 @@ H5F_istore_decode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
|
||||
int i;
|
||||
int ndims = bt->sizeof_rkey / 8;
|
||||
|
||||
FUNC_ENTER (H5F_istore_decode_key, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_decode_key, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (bt);
|
||||
assert (raw);
|
||||
assert (key);
|
||||
assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS && 8*ndims==bt->sizeof_rkey);
|
||||
assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS);
|
||||
|
||||
/* decode */
|
||||
UINT32DECODE (raw, key->file_number);
|
||||
assert (0==key->file_number);
|
||||
for (i=0; i<ndims; i++) {
|
||||
UINT32DECODE (raw, key->offset[i]);
|
||||
UINT32DECODE (raw, key->size[i]);
|
||||
@ -197,16 +206,18 @@ H5F_istore_encode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
|
||||
intn ndims = bt->sizeof_rkey / 8;
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER (H5F_istore_encode_key, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_encode_key, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (bt);
|
||||
assert (raw);
|
||||
assert (key);
|
||||
assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS && 8*ndims==bt->sizeof_rkey);
|
||||
assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS);
|
||||
|
||||
/* encode */
|
||||
UINT32ENCODE (raw, key->file_number);
|
||||
assert (0==key->file_number);
|
||||
for (i=0; i<ndims; i++) {
|
||||
UINT32ENCODE (raw, key->offset[i]);
|
||||
UINT32ENCODE (raw, key->size[i]);
|
||||
@ -221,7 +232,8 @@ H5F_istore_encode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
|
||||
*
|
||||
* Purpose: Compares two keys sort of like strcmp(). The UDATA pointer
|
||||
* is only to supply extra information not carried in the keys
|
||||
* (in this case, the dimensionality).
|
||||
* (in this case, the dimensionality) and is not compared
|
||||
* against the keys.
|
||||
*
|
||||
* Return: Success: -1 if LT_KEY is less than RT_KEY;
|
||||
* 1 if LT_KEY is greater than RT_KEY;
|
||||
@ -244,13 +256,14 @@ H5F_istore_cmp2 (H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
|
||||
H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *)_udata;
|
||||
intn cmp;
|
||||
|
||||
FUNC_ENTER (H5F_istore_cmp2, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_cmp2, FAIL);
|
||||
|
||||
assert (lt_key);
|
||||
assert (rt_key);
|
||||
assert (udata);
|
||||
assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_ISTORE_NDIMS);
|
||||
|
||||
|
||||
/* Compare the offsets but ignore the other fields */
|
||||
cmp = H5V_vector_cmp (udata->mesg.ndims, lt_key->offset, rt_key->offset);
|
||||
|
||||
FUNC_LEAVE (cmp);
|
||||
@ -294,7 +307,7 @@ H5F_istore_cmp3 (H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
|
||||
H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *)_udata;
|
||||
intn cmp = 0;
|
||||
|
||||
FUNC_ENTER (H5F_istore_cmp3, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_cmp3, FAIL);
|
||||
|
||||
assert (lt_key);
|
||||
assert (rt_key);
|
||||
@ -343,7 +356,7 @@ H5F_istore_new_node (H5F_t *f, H5B_ins_t op,
|
||||
size_t nbytes;
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER (H5F_istore_new_node, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_new_node, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -361,6 +374,9 @@ H5F_istore_new_node (H5F_t *f, H5B_ins_t op,
|
||||
HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL);
|
||||
}
|
||||
udata->addr = *addr;
|
||||
udata->key.file_number = 0;
|
||||
lt_key->file_number = udata->key.file_number;
|
||||
if (H5B_INS_LEFT!=op) rt_key->file_number = 0;
|
||||
|
||||
/* Initialize the key(s) */
|
||||
for (i=0; i<udata->mesg.ndims; i++) {
|
||||
@ -368,9 +384,9 @@ H5F_istore_new_node (H5F_t *f, H5B_ins_t op,
|
||||
* The left key describes the storage of the UDATA chunk being inserted
|
||||
* into the tree.
|
||||
*/
|
||||
assert (udata->key.size[i]>0);
|
||||
lt_key->offset[i] = udata->key.offset[i];
|
||||
lt_key->size[i] = udata->key.size[i];
|
||||
assert (udata->key.size[i]>0);
|
||||
|
||||
/*
|
||||
* The right key might already be present. If not, then add
|
||||
@ -416,7 +432,7 @@ H5F_istore_found (H5F_t *f, const haddr_t *addr, const void *_lt_key,
|
||||
const H5F_istore_key_t *lt_key = (const H5F_istore_key_t *)_lt_key;
|
||||
int i;
|
||||
|
||||
FUNC_ENTER (H5F_istore_found, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_found, FAIL);
|
||||
|
||||
/* Check arguments */
|
||||
assert (f);
|
||||
@ -426,6 +442,8 @@ H5F_istore_found (H5F_t *f, const haddr_t *addr, const void *_lt_key,
|
||||
|
||||
/* Initialize return values */
|
||||
udata->addr = *addr;
|
||||
udata->key.file_number = lt_key->file_number;
|
||||
assert (0==lt_key->file_number);
|
||||
for (i=0; i<udata->mesg.ndims; i++) {
|
||||
udata->key.offset[i] = lt_key->offset[i];
|
||||
udata->key.size[i] = lt_key->size[i];
|
||||
@ -435,7 +453,6 @@ H5F_istore_found (H5F_t *f, const haddr_t *addr, const void *_lt_key,
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_istore_insert
|
||||
@ -482,7 +499,7 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr,
|
||||
H5B_ins_t ret_value = H5B_INS_ERROR;
|
||||
size_t nbytes;
|
||||
|
||||
FUNC_ENTER (H5F_istore_insert, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_insert, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -510,6 +527,7 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr,
|
||||
* Already exists. Just return the info.
|
||||
*/
|
||||
udata->addr = *addr;
|
||||
udata->key.file_number = lt_key->file_number;
|
||||
ret_value = H5B_INS_NOOP;
|
||||
|
||||
} else if (H5V_hyper_disjointp (udata->mesg.ndims,
|
||||
@ -523,6 +541,7 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr,
|
||||
* Split this node, inserting the new new node to the right of the
|
||||
* current node. The MD_KEY is where the split occurs.
|
||||
*/
|
||||
md_key->file_number = udata->key.file_number;
|
||||
for (i=0, nbytes=1; i<udata->mesg.ndims; i++) {
|
||||
assert (0==udata->key.offset[i] % udata->mesg.alignment[i]);
|
||||
assert (udata->key.size[i] == udata->mesg.alignment[i]);
|
||||
@ -538,6 +557,7 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr,
|
||||
HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL);
|
||||
}
|
||||
udata->addr = *new_node;
|
||||
udata->key.file_number = 0;
|
||||
ret_value = H5B_INS_RIGHT;
|
||||
|
||||
} else {
|
||||
@ -600,7 +620,7 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op,
|
||||
herr_t status;
|
||||
herr_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER (H5F_istore_copy_hyperslab, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_copy_hyperslab, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -644,6 +664,9 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op,
|
||||
|
||||
/* Read/Write chunk or create it if it doesn't exist */
|
||||
udata.mesg.ndims = istore->ndims;
|
||||
H5F_addr_undef (&(udata.addr));
|
||||
udata.key.file_number = 0;
|
||||
|
||||
for (i=0; i<istore->ndims; i++) {
|
||||
|
||||
/* The location and size of the chunk being accessed */
|
||||
@ -679,6 +702,7 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op,
|
||||
!H5V_vector_zerop (istore->ndims, offset_wrt_chunk) ||
|
||||
!H5V_vector_eq (istore->ndims, sub_size, udata.key.size)) {
|
||||
if (status>=0 && H5F_addr_defined (&(udata.addr))) {
|
||||
assert (0==udata.key.file_number);
|
||||
if (H5F_block_read (f, &(udata.addr), chunk_size, chunk)<0) {
|
||||
HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL);
|
||||
}
|
||||
@ -692,6 +716,7 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op,
|
||||
H5V_hyper_copy (istore->ndims, sub_size,
|
||||
udata.key.size, offset_wrt_chunk, chunk,
|
||||
size_m, sub_offset_m, buf);
|
||||
assert (0==udata.key.file_number);
|
||||
if (H5F_block_write (f, &(udata.addr), chunk_size, chunk)<0) {
|
||||
HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL);
|
||||
}
|
||||
@ -738,7 +763,7 @@ herr_t
|
||||
H5F_istore_read (H5F_t *f, const H5O_istore_t *istore,
|
||||
const size_t offset[], const size_t size[], void *buf)
|
||||
{
|
||||
FUNC_ENTER (H5F_istore_read, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_read, FAIL);
|
||||
|
||||
/* Check args */
|
||||
assert (f);
|
||||
@ -778,7 +803,7 @@ herr_t
|
||||
H5F_istore_write (H5F_t *f, const H5O_istore_t *istore,
|
||||
const size_t offset[], const size_t size[], void *buf)
|
||||
{
|
||||
FUNC_ENTER (H5F_istore_write, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_write, FAIL);
|
||||
|
||||
/* Check args */
|
||||
assert (f);
|
||||
@ -799,7 +824,7 @@ H5F_istore_write (H5F_t *f, const H5O_istore_t *istore,
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_istore_new
|
||||
* Function: H5F_istore_create
|
||||
*
|
||||
* Purpose: Creates a new indexed-storage B-tree and initializes the
|
||||
* istore struct with information about the storage. The
|
||||
@ -821,13 +846,13 @@ H5F_istore_write (H5F_t *f, const H5O_istore_t *istore,
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5F_istore_new (H5F_t *f, struct H5O_istore_t *istore,
|
||||
uintn ndims, const size_t alignment[])
|
||||
H5F_istore_create (H5F_t *f, struct H5O_istore_t *istore,
|
||||
uintn ndims, const size_t alignment[])
|
||||
{
|
||||
H5F_istore_ud1_t udata;
|
||||
int i;
|
||||
|
||||
FUNC_ENTER (H5F_istore_new, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_create, FAIL);
|
||||
|
||||
/* Check args */
|
||||
assert (f);
|
||||
@ -841,7 +866,7 @@ H5F_istore_new (H5F_t *f, struct H5O_istore_t *istore,
|
||||
#endif
|
||||
|
||||
udata.mesg.ndims = istore->ndims = ndims;
|
||||
if (H5B_new (f, H5B_ISTORE, &udata, &(istore->btree_addr)/*out*/)<0) {
|
||||
if (H5B_create (f, H5B_ISTORE, &udata, &(istore->btree_addr)/*out*/)<0) {
|
||||
HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL); /* Can't create B-tree */
|
||||
}
|
||||
|
||||
|
@ -22,10 +22,10 @@
|
||||
|
||||
/* Private headers needed by this file */
|
||||
#include <H5private.h>
|
||||
#include <H5Cprivate.h> /* for the hobjtype_t type */
|
||||
#include <H5Fprivate.h> /* for the H5F_t type */
|
||||
#include <H5Gprivate.h> /* Symbol tables */
|
||||
#include <H5Tprivate.h> /* for the h5_datatype_t type */
|
||||
#include <H5Pprivate.h> /* for the H5P_sdim_t type */
|
||||
#include <H5Tprivate.h> /* for the H5T_t type */
|
||||
#include <H5Pprivate.h> /* for the H5P_t type */
|
||||
#include <H5Oprivate.h> /* Object Headers */
|
||||
|
||||
#define H5D_RESERVED_ATOMS 0
|
||||
@ -33,13 +33,34 @@
|
||||
/* Set the minimum object header size to create objects with */
|
||||
#define H5D_MINHDR_SIZE 512
|
||||
|
||||
/*-----------------_-- Local function prototypes ----------------------------*/
|
||||
hid_t H5D_create(hid_t owner_id, hobjtype_t type, const char *name);
|
||||
hid_t H5D_access_by_name (hid_t owner_id, const char *name);
|
||||
hid_t H5D_find_name(hid_t owner_id, hobjtype_t type, const char *name);
|
||||
herr_t H5D_flush(hid_t oid);
|
||||
herr_t H5D_release(hid_t oid);
|
||||
/* in H5Dconv.c */
|
||||
/* Dataset creation template */
|
||||
typedef struct H5D_create_t {
|
||||
H5D_layout_t layout;
|
||||
} H5D_create_t;
|
||||
|
||||
/* Dataset transfer template */
|
||||
typedef struct H5D_xfer_t {
|
||||
int _placeholder; /*unused--delete this later*/
|
||||
} H5D_xfer_t;
|
||||
|
||||
typedef struct H5D_t H5D_t;
|
||||
|
||||
extern const H5D_create_t H5D_create_dflt;
|
||||
extern const H5D_xfer_t H5D_xfer_dflt;
|
||||
|
||||
/* Functions defined in H5D.c */
|
||||
H5D_t *H5D_create (H5F_t *f, const char *name, const H5T_t *type,
|
||||
const H5P_t *space, const H5D_create_t *create_parms);
|
||||
H5D_t *H5D_open (H5F_t *f, const char *name);
|
||||
herr_t H5D_close (H5D_t *dataset);
|
||||
herr_t H5D_read (H5D_t *dataset, const H5T_t *type, const H5P_t *space,
|
||||
const H5D_xfer_t *xfer_parms, void *buf/*out*/);
|
||||
herr_t H5D_write (H5D_t *dataset, const H5T_t *type, const H5P_t *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);
|
||||
|
||||
|
||||
/* Functions defined in in H5Dconv.c */
|
||||
herr_t H5D_convert_buf(void *dst,const void *src,uintn len,uintn size);
|
||||
|
||||
#endif
|
||||
|
@ -23,16 +23,27 @@
|
||||
#include <H5public.h>
|
||||
#include <H5Apublic.h>
|
||||
|
||||
/* Values for the H5D_LAYOUT property */
|
||||
typedef enum H5D_layout_t {
|
||||
H5D_COMPACT =0, /*raw data is very small */
|
||||
H5D_CONTIGUOUS =1, /*the default */
|
||||
H5D_CHUNKED =2, /*slow and fancy */
|
||||
|
||||
H5D_NLAYOUTS =3 /*This one must be last! */
|
||||
} H5D_layout_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Functions in H5D.c */
|
||||
herr_t H5Dset_info(hid_t oid, hid_t tid, hid_t did);
|
||||
herr_t H5Dget_info(hid_t oid, hid_t *tid, hid_t *sid);
|
||||
herr_t H5Dwrite(hid_t oid, hid_t did, VOIDP buf);
|
||||
herr_t H5Dread(hid_t oid, hid_t did, VOIDP buf);
|
||||
void H5D_term_interface (void);
|
||||
hid_t H5Dcreate (hid_t file_id, const char *name, hid_t type_id,
|
||||
hid_t space_id, hid_t create_parms_id);
|
||||
hid_t H5Dopen (hid_t file_id, const char *name);
|
||||
herr_t H5Dclose (hid_t dataset_id);
|
||||
herr_t H5Dread (hid_t dataset_id, hid_t type_id, hid_t space_id,
|
||||
hid_t xfer_parms_id, void *buf/*out*/);
|
||||
herr_t H5Dwrite (hid_t dataset_id, hid_t type_id, hid_t space_id,
|
||||
hid_t xfer_parms_id, const void *buf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
26
src/H5E.c
26
src/H5E.c
@ -41,9 +41,6 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
|
||||
/*-------------------- Locally scoped variables -----------------------------*/
|
||||
|
||||
/* Is the interface initialized? */
|
||||
static intn interface_initialize_g = FALSE;
|
||||
|
||||
static const hdf_maj_error_messages_t hdf_maj_error_messages[] =
|
||||
{
|
||||
{H5E_NONE_MAJOR, "No error"},
|
||||
@ -110,11 +107,14 @@ static const hdf_min_error_messages_t hdf_min_error_messages[] =
|
||||
{H5E_LINK, "Link count failure"},
|
||||
};
|
||||
|
||||
/*--------------------- Globally scoped variables ---------------------------*/
|
||||
/* Interface initialization? */
|
||||
static intn interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT H5E_init_interface
|
||||
static herr_t H5E_init_interface(void);
|
||||
|
||||
|
||||
int32 thrderrid; /* Thread-specific "global" error-handler ID */
|
||||
|
||||
/*------------------_-- Local function prototypes ---------------------------*/
|
||||
static herr_t H5E_init_interface(void);
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
@ -135,7 +135,7 @@ Modifications:
|
||||
static herr_t H5E_init_interface(void)
|
||||
{
|
||||
herr_t ret_value = SUCCEED;
|
||||
FUNC_ENTER (H5E_init_interface, NULL, FAIL);
|
||||
FUNC_ENTER (H5E_init_interface, FAIL);
|
||||
|
||||
/* Initialize the atom group for the error stacks */
|
||||
if((ret_value=H5Ainit_group(H5_ERR,H5A_ERRSTACK_HASHSIZE,0,NULL))!=FAIL)
|
||||
@ -185,7 +185,7 @@ int32 H5Enew_err_stack(uintn initial_stack_size)
|
||||
H5E_errstack_t *new_stack=NULL; /* Pointer to the new error stack */
|
||||
int32 ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER(H5Enew_err_stack, H5E_init_interface,FAIL);
|
||||
FUNC_ENTER(H5Enew_err_stack, FAIL);
|
||||
|
||||
/* Allocate the stack header */
|
||||
if((new_stack=HDmalloc(sizeof(H5E_errstack_t)))==NULL)
|
||||
@ -234,7 +234,7 @@ intn H5Edelete_err_stack(int32 err_stack)
|
||||
H5E_errstack_t *old_stack=NULL; /* Pointer to the new error stack */
|
||||
intn ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Edelete_err_stack, H5E_init_interface,FAIL);
|
||||
FUNC_ENTER(H5Edelete_err_stack, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
if (H5Aatom_group(err_stack)!=H5_ERR)
|
||||
@ -287,7 +287,7 @@ H5Eclear (int32 err_hand)
|
||||
H5E_errstack_t *err_stack=NULL; /* Pointer to the error stack to put value on */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER (H5Eclear, H5E_init_interface, FAIL);
|
||||
FUNC_ENTER (H5Eclear, FAIL);
|
||||
|
||||
/* Get the error stack for this error handler, initialized earlier in H5Enew_err_stack */
|
||||
if (H5Aatom_group(err_hand)!=H5_ERR)
|
||||
@ -341,7 +341,7 @@ H5E_store(int32 errid, hdf_maj_err_code_t maj, hdf_min_err_code_t min, const cha
|
||||
H5E_errstack_t *err_stack=NULL; /* Pointer to the error stack to put value on */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5E_store, H5E_init_interface,FAIL);
|
||||
FUNC_ENTER(H5E_store, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5Eclear(errid);
|
||||
@ -407,7 +407,7 @@ H5Epush(hdf_maj_err_code_t maj, hdf_min_err_code_t min, const char *function_nam
|
||||
H5E_errstack_t *err_stack=NULL; /* Pointer to the error stack to put value on */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Epush, H5E_init_interface,FAIL);
|
||||
FUNC_ENTER(H5Epush, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
if (function_name==NULL || file_name==NULL || H5Aatom_group(thrderrid)!=H5_ERR)
|
||||
@ -453,7 +453,7 @@ H5E_push_func_t H5Eset_push(H5E_push_func_t func)
|
||||
H5E_errstack_t *err_stack=NULL; /* Pointer to the error stack to put value on */
|
||||
H5E_push_func_t ret_value = NULL;
|
||||
|
||||
FUNC_ENTER(H5Eset_push, H5E_init_interface,NULL);
|
||||
FUNC_ENTER(H5Eset_push, NULL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
|
308
src/H5F.c
308
src/H5F.c
@ -62,11 +62,38 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
|
||||
/*--------------------- Locally scoped variables -----------------------------*/
|
||||
|
||||
/* Whether we've installed the library termination function yet for this interface */
|
||||
static intn interface_initialize_g = FALSE;
|
||||
/*
|
||||
* Define the default file creation template.
|
||||
*/
|
||||
const H5F_create_t H5F_create_dflt = {
|
||||
0, /* Default user-block size */
|
||||
4, /* Default 1/2 rank for symtab leaf nodes */
|
||||
{ /* Default 1/2 rank for btree intern nodes*/
|
||||
16, /* Symbol table internal nodes */
|
||||
32, /* Indexed storage internal nodes */
|
||||
0, /* unused */
|
||||
0, /* unused */
|
||||
0, /* unused */
|
||||
0, /* unused */
|
||||
0, /* unused */
|
||||
0, /* unused */
|
||||
},
|
||||
4, /* Default offset size */
|
||||
4, /* Default length size */
|
||||
HDF5_BOOTBLOCK_VERSION, /* Current Boot-Block version # */
|
||||
HDF5_SMALLOBJECT_VERSION, /* Current Small-Object heap version # */
|
||||
HDF5_FREESPACE_VERSION, /* Current Free-Space info version # */
|
||||
HDF5_OBJECTDIR_VERSION, /* Current Object Directory info version # */
|
||||
HDF5_SHAREDHEADER_VERSION, /* Current Shared-Header format version # */
|
||||
};
|
||||
|
||||
/*--------------------- Local function prototypes ----------------------------*/
|
||||
/* Interface initialization */
|
||||
static intn interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT H5F_init_interface
|
||||
static herr_t H5F_init_interface(void);
|
||||
static void H5F_term_interface (void);
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static H5F_t *H5F_new (H5F_file_t *shared);
|
||||
static H5F_t *H5F_dest (H5F_t *f);
|
||||
static herr_t H5F_flush (H5F_t *f, hbool_t invalidate);
|
||||
@ -94,7 +121,7 @@ Modifications:
|
||||
static herr_t H5F_init_interface(void)
|
||||
{
|
||||
herr_t ret_value = SUCCEED;
|
||||
FUNC_ENTER (H5F_init_interface, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_init_interface, FAIL);
|
||||
|
||||
/* Initialize the atom group for the file IDs */
|
||||
if((ret_value=H5Ainit_group(H5_FILE,H5A_FILEID_HASHSIZE,0,NULL))!=FAIL)
|
||||
@ -120,10 +147,11 @@ static herr_t H5F_init_interface(void)
|
||||
EXAMPLES
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
void H5F_term_interface (void)
|
||||
static void
|
||||
H5F_term_interface (void)
|
||||
{
|
||||
H5Adestroy_group(H5_FILE);
|
||||
} /* end H5F_term_interface() */
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
@ -169,37 +197,6 @@ done:
|
||||
|
||||
} /* H5F_encode_length_unusual */
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5F_compare_files -- compare file objects for the atom API
|
||||
USAGE
|
||||
intn HPcompare_filename(obj, key)
|
||||
const VOIDP obj; IN: pointer to the file record
|
||||
const VOIDP key; IN: pointer to the search key
|
||||
|
||||
ERRORS
|
||||
|
||||
RETURNS
|
||||
TRUE if the key matches the obj, FALSE otherwise
|
||||
DESCRIPTION
|
||||
Look inside the file record for the atom API and compare the the
|
||||
keys.
|
||||
--------------------------------------------------------------------------*/
|
||||
static intn
|
||||
H5F_compare_files (const VOIDP _obj, const VOIDP _key)
|
||||
{
|
||||
const H5F_t *obj = (const H5F_t *)_obj;
|
||||
const H5F_search_t *key = (const H5F_search_t *)_key;
|
||||
int ret_value = FALSE;
|
||||
|
||||
FUNC_ENTER (H5F_compare_files, NULL, FALSE);
|
||||
|
||||
ret_value = (obj->shared->key.dev == key->dev &&
|
||||
obj->shared->key.ino == key->ino);
|
||||
|
||||
FUNC_LEAVE (ret_value);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5Fget_create_template
|
||||
@ -223,36 +220,64 @@ H5F_compare_files (const VOIDP _obj, const VOIDP _key)
|
||||
This function returns an atom with a copy of the template parameters
|
||||
used to create a file.
|
||||
--------------------------------------------------------------------------*/
|
||||
hid_t H5Fget_create_template(hid_t fid)
|
||||
hid_t
|
||||
H5Fget_create_template (hid_t fid)
|
||||
{
|
||||
H5F_t *file=NULL; /* file struct for file to close */
|
||||
hid_t ret_value = FAIL;
|
||||
H5F_t *file = NULL;
|
||||
hid_t ret_value = FAIL;
|
||||
H5F_create_t *tmpl = NULL;
|
||||
|
||||
FUNC_ENTER(H5Fget_create_template, H5F_init_interface, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
FUNC_ENTER (H5Fget_create_template, FAIL);
|
||||
H5ECLEAR;
|
||||
|
||||
/* Get the file structure */
|
||||
if((file=H5Aatom_object(fid))==NULL)
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL); /*can't get file struct*/
|
||||
/* check args */
|
||||
if (H5_FILE!=H5Aatom_group (fid)) {
|
||||
HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL); /*not a file*/
|
||||
}
|
||||
if (NULL==(file=H5Aatom_object (fid))) {
|
||||
HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL); /*can't get file struct*/
|
||||
}
|
||||
|
||||
/* Create the template object to return */
|
||||
if((ret_value=H5Mcreate(fid,H5_TEMPLATE,NULL))==FAIL)
|
||||
HGOTO_ERROR(H5E_FUNC, H5E_CANTCREATE, FAIL); /*can't create template*/
|
||||
tmpl = H5MM_xmalloc (sizeof(H5F_create_t));
|
||||
*tmpl = file->shared->create_parms;
|
||||
if ((ret_value=H5C_create (H5C_FILE_CREATE, tmpl))<0) {
|
||||
/* Can't register template */
|
||||
HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL);
|
||||
}
|
||||
|
||||
if(H5C_init(ret_value,&(file->shared->file_create_parms))==FAIL)
|
||||
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL); /*can't init template*/
|
||||
FUNC_LEAVE (ret_value);
|
||||
}
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5F_compare_files -- compare file objects for the atom API
|
||||
USAGE
|
||||
intn HPcompare_filename(obj, key)
|
||||
const VOIDP obj; IN: pointer to the file record
|
||||
const VOIDP key; IN: pointer to the search key
|
||||
|
||||
} /* end if */
|
||||
ERRORS
|
||||
|
||||
/* Normal function cleanup */
|
||||
RETURNS
|
||||
TRUE if the key matches the obj, FALSE otherwise
|
||||
DESCRIPTION
|
||||
Look inside the file record for the atom API and compare the the
|
||||
keys.
|
||||
--------------------------------------------------------------------------*/
|
||||
static intn
|
||||
H5F_compare_files (const VOIDP _obj, const VOIDP _key)
|
||||
{
|
||||
const H5F_t *obj = (const H5F_t *)_obj;
|
||||
const H5F_search_t *key = (const H5F_search_t *)_key;
|
||||
int ret_value = FALSE;
|
||||
|
||||
FUNC_ENTER (H5F_compare_files, FALSE);
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
ret_value = (obj->shared->key.dev == key->dev &&
|
||||
obj->shared->key.ino == key->ino);
|
||||
|
||||
FUNC_LEAVE (ret_value);
|
||||
}
|
||||
|
||||
|
||||
@ -282,7 +307,7 @@ H5F_locate_signature (H5F_low_t *f_handle, haddr_t *addr/*out*/)
|
||||
uint8 buf[H5F_SIGNATURE_LEN];
|
||||
uintn n=9;
|
||||
|
||||
FUNC_ENTER (H5F_locate_signature, H5F_init_interface, FAIL);
|
||||
FUNC_ENTER (H5F_locate_signature, FAIL);
|
||||
|
||||
H5F_low_size (f_handle, &max_addr);
|
||||
H5F_addr_reset (addr);
|
||||
@ -327,7 +352,7 @@ hbool_t H5Fis_hdf5(const char *filename)
|
||||
haddr_t addr; /* Address of file signature & header */
|
||||
hbool_t ret_value = BFALSE;
|
||||
|
||||
FUNC_ENTER(H5Fis_hdf5, H5F_init_interface, BFAIL);
|
||||
FUNC_ENTER(H5Fis_hdf5, BFAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
@ -377,7 +402,7 @@ static H5F_t *
|
||||
H5F_new (H5F_file_t *shared)
|
||||
{
|
||||
H5F_t *f = NULL;
|
||||
FUNC_ENTER (H5F_new, H5F_init_interface, NULL);
|
||||
FUNC_ENTER (H5F_new, NULL);
|
||||
|
||||
f = H5MM_xcalloc (1, sizeof(H5F_t));
|
||||
f->shared = shared;
|
||||
@ -391,7 +416,7 @@ H5F_new (H5F_file_t *shared)
|
||||
H5F_addr_undef (&(f->shared->hdf5_eof));
|
||||
|
||||
/* Create a main cache */
|
||||
H5AC_new (f, H5AC_NSLOTS);
|
||||
H5AC_create (f, H5AC_NSLOTS);
|
||||
|
||||
/* Create the shadow hash table */
|
||||
f->shared->nshadows = H5G_NSHADOWS;
|
||||
@ -433,7 +458,7 @@ H5F_new (H5F_file_t *shared)
|
||||
static H5F_t *
|
||||
H5F_dest (H5F_t *f)
|
||||
{
|
||||
FUNC_ENTER (H5F_dest, H5F_init_interface, NULL);
|
||||
FUNC_ENTER (H5F_dest, NULL);
|
||||
|
||||
if (f) {
|
||||
if (0 == --(f->shared->nrefs)) {
|
||||
@ -546,7 +571,7 @@ H5F_dest (H5F_t *f)
|
||||
*/
|
||||
H5F_t *
|
||||
H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
|
||||
const file_create_temp_t *create_parms)
|
||||
const H5F_create_t *create_parms)
|
||||
{
|
||||
H5F_t *f = NULL; /*return value */
|
||||
H5F_t *ret_value = NULL; /*a copy of `f' */
|
||||
@ -559,11 +584,11 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
|
||||
const uint8 *p=NULL; /* ..and pointer into it*/
|
||||
size_t fixed_size = 24; /*size of fixed part of boot blk*/
|
||||
size_t variable_size; /*variable part of boot block */
|
||||
file_create_temp_t *cp=NULL; /*file creation parameters */
|
||||
H5F_create_t *cp=NULL; /*file creation parameters */
|
||||
haddr_t addr1, addr2; /*temporary address */
|
||||
const char *s = name;
|
||||
|
||||
FUNC_ENTER (H5F_open, H5F_init_interface, NULL);
|
||||
FUNC_ENTER (H5F_open, NULL);
|
||||
|
||||
assert (name && *name);
|
||||
|
||||
@ -618,17 +643,7 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
|
||||
/*
|
||||
* If no file creation parameters are supplied then use defaults.
|
||||
*/
|
||||
if (!create_parms) {
|
||||
hid_t create_temp = H5C_get_default_atom (H5_TEMPLATE);
|
||||
if (create_temp<0) {
|
||||
/* Can't get default file create template id */
|
||||
HRETURN_ERROR (H5E_FILE, H5E_CANTINIT, NULL);
|
||||
}
|
||||
if (NULL==(create_parms=H5Aatom_object (create_temp))) {
|
||||
/* Can't unatomize default template id */
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL);
|
||||
}
|
||||
}
|
||||
if (!create_parms) create_parms = &H5F_create_dflt;
|
||||
|
||||
/*
|
||||
* Does the file exist? If so, get the device and i-node values so we can
|
||||
@ -742,11 +757,9 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
|
||||
* first time this file is opened.
|
||||
*/
|
||||
if (1==f->shared->nrefs) {
|
||||
HDmemcpy (&(f->shared->file_create_parms),
|
||||
create_parms,
|
||||
sizeof(file_create_temp_t));
|
||||
f->shared->create_parms = *create_parms;
|
||||
}
|
||||
cp = &(f->shared->file_create_parms);
|
||||
cp = &(f->shared->create_parms);
|
||||
|
||||
/*
|
||||
* Read or write the file boot block.
|
||||
@ -760,7 +773,7 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
|
||||
*/
|
||||
H5F_addr_reset (&(f->shared->boot_addr));
|
||||
H5F_addr_inc (&(f->shared->boot_addr),
|
||||
f->shared->file_create_parms.userblock_size);
|
||||
f->shared->create_parms.userblock_size);
|
||||
f->shared->base_addr = f->shared->boot_addr;
|
||||
|
||||
f->shared->consist_flags = 0x03;
|
||||
@ -786,7 +799,7 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
|
||||
* user-defined data.
|
||||
*/
|
||||
f->shared->base_addr = f->shared->boot_addr;
|
||||
f->shared->file_create_parms.userblock_size=f->shared->base_addr.offset;
|
||||
f->shared->create_parms.userblock_size=f->shared->base_addr.offset;
|
||||
|
||||
/*
|
||||
* Decode the fixed size part of the boot block. For each of the
|
||||
@ -866,8 +879,8 @@ H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
|
||||
assert (p-buf == fixed_size);
|
||||
|
||||
/* Read the variable length part of the boot block... */
|
||||
variable_size = H5F_SIZEOF_OFFSET (f) + /*global small obj heap*/
|
||||
H5F_SIZEOF_OFFSET (f) + /*global free list addr*/
|
||||
variable_size = H5F_SIZEOF_ADDR (f) + /*global small obj heap*/
|
||||
H5F_SIZEOF_ADDR (f) + /*global free list addr*/
|
||||
H5F_SIZEOF_SIZE (f) + /*logical file size*/
|
||||
H5G_SIZEOF_ENTRY (f);
|
||||
assert (variable_size <= sizeof buf);
|
||||
@ -990,12 +1003,12 @@ hid_t H5Fcreate(const char *filename, uintn flags, hid_t create_temp,
|
||||
hid_t access_temp)
|
||||
{
|
||||
H5F_t *new_file=NULL; /* file struct for new file */
|
||||
const file_create_temp_t *create_parms; /* pointer to the parameters to
|
||||
const H5F_create_t *create_parms; /* pointer to the parameters to
|
||||
* use when creating the file
|
||||
*/
|
||||
hid_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER(H5Fcreate, H5F_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Fcreate, FAIL);
|
||||
H5ECLEAR;
|
||||
|
||||
/* Check/fix arguments */
|
||||
@ -1005,15 +1018,19 @@ hid_t H5Fcreate(const char *filename, uintn flags, hid_t create_temp,
|
||||
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*invalid flags*/
|
||||
flags = (H5F_ACC_WRITE | H5F_ACC_CREAT) |
|
||||
(H5ACC_OVERWRITE==flags ? H5F_ACC_TRUNC : H5F_ACC_EXCL);
|
||||
if (0==create_temp)
|
||||
create_temp = H5C_get_default_atom (H5_TEMPLATE);
|
||||
if (NULL==(create_parms=H5Aatom_object(create_temp)))
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL); /*can't unatomize template*/
|
||||
|
||||
if (create_temp<=0) {
|
||||
create_parms = &H5F_create_dflt;
|
||||
} else if (NULL==(create_parms=H5Aatom_object (create_temp))) {
|
||||
HGOTO_ERROR (H5E_ATOM, H5E_BADATOM, FAIL); /*can't unatomize template*/
|
||||
}
|
||||
|
||||
#ifdef LATER
|
||||
if (0==access_temp)
|
||||
access_temp = H5CPget_default_atom(H5_TEMPLATE);
|
||||
if (NULL==(access_parms=H5Aatom_object(access_temp)))
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL); /*can't unatomize template*/
|
||||
if (access_temp<=0) {
|
||||
access_parms = &H5F_access_dflt;
|
||||
} else if (NULL==(access_parms=H5Aatom_object (access_temp))) {
|
||||
HGOTO_ERROR (H5E_ATOM, H5E_BADATOM, FAIL); /*can't unatomize template*/
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -1086,7 +1103,7 @@ hid_t H5Fopen(const char *filename, uintn flags, hid_t access_temp)
|
||||
H5F_t *new_file=NULL; /* file struct for new file */
|
||||
hid_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER(H5Fopen, H5F_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Fopen, FAIL);
|
||||
H5ECLEAR;
|
||||
|
||||
/* Check/fix arguments. */
|
||||
@ -1152,7 +1169,7 @@ H5F_flush (H5F_t *f, hbool_t invalidate)
|
||||
uint8 buf[2048], *p=buf;
|
||||
herr_t shadow_flush;
|
||||
|
||||
FUNC_ENTER (H5F_flush, H5F_init_interface, FAIL);
|
||||
FUNC_ENTER (H5F_flush, FAIL);
|
||||
|
||||
/*
|
||||
* Nothing to do if the file is read only. This determination is made at
|
||||
@ -1177,16 +1194,16 @@ H5F_flush (H5F_t *f, hbool_t invalidate)
|
||||
HDmemcpy (p, H5F_SIGNATURE, H5F_SIGNATURE_LEN);
|
||||
p += H5F_SIGNATURE_LEN;
|
||||
|
||||
*p++ = f->shared->file_create_parms.bootblock_ver;
|
||||
*p++ = f->shared->file_create_parms.smallobject_ver;
|
||||
*p++ = f->shared->file_create_parms.freespace_ver;
|
||||
*p++ = f->shared->file_create_parms.objectdir_ver;
|
||||
*p++ = f->shared->file_create_parms.sharedheader_ver;
|
||||
*p++ = H5F_SIZEOF_OFFSET (f);
|
||||
*p++ = f->shared->create_parms.bootblock_ver;
|
||||
*p++ = f->shared->create_parms.smallobject_ver;
|
||||
*p++ = f->shared->create_parms.freespace_ver;
|
||||
*p++ = f->shared->create_parms.objectdir_ver;
|
||||
*p++ = f->shared->create_parms.sharedheader_ver;
|
||||
*p++ = H5F_SIZEOF_ADDR (f);
|
||||
*p++ = H5F_SIZEOF_SIZE (f);
|
||||
*p++ = 0; /*reserved*/
|
||||
UINT16ENCODE (p, f->shared->file_create_parms.sym_leaf_k);
|
||||
UINT16ENCODE (p, f->shared->file_create_parms.btree_k[H5B_SNODE_ID]);
|
||||
UINT16ENCODE (p, f->shared->create_parms.sym_leaf_k);
|
||||
UINT16ENCODE (p, f->shared->create_parms.btree_k[H5B_SNODE_ID]);
|
||||
UINT32ENCODE (p, f->shared->consist_flags);
|
||||
H5F_addr_encode (f, &p, &(f->shared->smallobj_addr));
|
||||
H5F_addr_encode (f, &p, &(f->shared->freespace_addr));
|
||||
@ -1218,58 +1235,6 @@ H5F_flush (H5F_t *f, hbool_t invalidate)
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5Fflush
|
||||
|
||||
PURPOSE
|
||||
Flush all cached data to disk and optionally invalidates all cached
|
||||
data.
|
||||
|
||||
USAGE
|
||||
herr_t H5Fflush(fid, invalidate)
|
||||
hid_t fid; IN: File ID of file to close.
|
||||
hbool_t invalidate; IN: Invalidate all of the cache?
|
||||
|
||||
ERRORS
|
||||
ARGS BADTYPE Not a file atom.
|
||||
ATOM BADATOM Can't get file struct.
|
||||
CACHE CANTFLUSH Flush failed.
|
||||
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
|
||||
DESCRIPTION
|
||||
This function flushes all cached data to disk and, if INVALIDATE
|
||||
is non-zero, removes cached objects from the cache so they must be
|
||||
re-read from the file on the next access to the object.
|
||||
|
||||
MODIFICATIONS:
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t
|
||||
H5Fflush (hid_t fid, hbool_t invalidate)
|
||||
{
|
||||
H5F_t *file = NULL;
|
||||
|
||||
FUNC_ENTER (H5Fflush, H5F_init_interface, FAIL);
|
||||
H5ECLEAR;
|
||||
|
||||
/* check arguments */
|
||||
if (H5_FILE!=H5Aatom_group (fid)) {
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a file atom*/
|
||||
}
|
||||
if (NULL==(file=H5Aatom_object (fid))) {
|
||||
HRETURN_ERROR (H5E_ATOM, H5E_BADATOM, FAIL); /*can't get file struct*/
|
||||
}
|
||||
|
||||
/* do work */
|
||||
if (H5F_flush (file, invalidate)<0) {
|
||||
HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL); /*flush failed*/
|
||||
}
|
||||
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_close
|
||||
@ -1293,7 +1258,7 @@ H5F_close (H5F_t *f)
|
||||
{
|
||||
herr_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER (H5F_close, H5F_init_interface, FAIL);
|
||||
FUNC_ENTER (H5F_close, FAIL);
|
||||
|
||||
if (-2==(ret_value=H5F_flush (f, TRUE))) {
|
||||
/*objects are still open, but don't fail yet*/
|
||||
@ -1302,6 +1267,7 @@ H5F_close (H5F_t *f)
|
||||
HRETURN_ERROR (H5E_CACHE, H5E_CANTFLUSH, FAIL);
|
||||
}
|
||||
if (f->intent & H5F_ACC_DEBUG) H5AC_debug (f);
|
||||
|
||||
H5F_low_close (f->shared->lf);
|
||||
H5F_dest (f);
|
||||
|
||||
@ -1351,7 +1317,7 @@ herr_t H5Fclose(hid_t fid)
|
||||
H5F_t *file=NULL; /* file struct for file to close */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Fclose, H5F_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Fclose, FAIL);
|
||||
H5ECLEAR;
|
||||
|
||||
/* Check/fix arguments. */
|
||||
@ -1400,7 +1366,7 @@ H5F_block_read (H5F_t *f, const haddr_t *addr, size_t size, void *buf)
|
||||
{
|
||||
haddr_t abs_addr;
|
||||
|
||||
FUNC_ENTER (H5F_block_read, H5F_init_interface, FAIL);
|
||||
FUNC_ENTER (H5F_block_read, FAIL);
|
||||
|
||||
if (0==size) return 0;
|
||||
|
||||
@ -1441,11 +1407,11 @@ H5F_block_read (H5F_t *f, const haddr_t *addr, size_t size, void *buf)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5F_block_write (H5F_t *f, const haddr_t *addr, size_t size, void *buf)
|
||||
H5F_block_write (H5F_t *f, const haddr_t *addr, size_t size, const void *buf)
|
||||
{
|
||||
haddr_t abs_addr;
|
||||
|
||||
FUNC_ENTER (H5F_block_write, H5F_init_interface, FAIL);
|
||||
FUNC_ENTER (H5F_block_write, FAIL);
|
||||
|
||||
if (0==size) return 0;
|
||||
|
||||
@ -1492,7 +1458,7 @@ herr_t
|
||||
H5F_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
|
||||
intn fwidth)
|
||||
{
|
||||
FUNC_ENTER (H5F_debug, H5F_init_interface, FAIL);
|
||||
FUNC_ENTER (H5F_debug, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -1544,34 +1510,34 @@ H5F_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
|
||||
|
||||
fprintf (stream, "%*s%-*s %lu bytes\n", indent, "", fwidth,
|
||||
"Size of user block:",
|
||||
(unsigned long)(f->shared->file_create_parms.userblock_size));
|
||||
(unsigned long)(f->shared->create_parms.userblock_size));
|
||||
fprintf (stream, "%*s%-*s %u bytes\n", indent, "", fwidth,
|
||||
"Size of file size_t type:",
|
||||
(unsigned)(f->shared->file_create_parms.sizeof_size));
|
||||
(unsigned)(f->shared->create_parms.sizeof_size));
|
||||
fprintf (stream, "%*s%-*s %u bytes\n", indent, "", fwidth,
|
||||
"Size of file haddr_t type:",
|
||||
(unsigned)(f->shared->file_create_parms.sizeof_addr));
|
||||
(unsigned)(f->shared->create_parms.sizeof_addr));
|
||||
fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
"Symbol table leaf node 1/2 rank:",
|
||||
(unsigned)(f->shared->file_create_parms.sym_leaf_k));
|
||||
(unsigned)(f->shared->create_parms.sym_leaf_k));
|
||||
fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
"Symbol table internal node 1/2 rank:",
|
||||
(unsigned)(f->shared->file_create_parms.btree_k[H5B_SNODE_ID]));
|
||||
(unsigned)(f->shared->create_parms.btree_k[H5B_SNODE_ID]));
|
||||
fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
"Boot block version number:",
|
||||
(unsigned)(f->shared->file_create_parms.bootblock_ver));
|
||||
(unsigned)(f->shared->create_parms.bootblock_ver));
|
||||
fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
"Small object heap version number:",
|
||||
(unsigned)(f->shared->file_create_parms.smallobject_ver));
|
||||
(unsigned)(f->shared->create_parms.smallobject_ver));
|
||||
fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
"Free list version number:",
|
||||
(unsigned)(f->shared->file_create_parms.freespace_ver));
|
||||
(unsigned)(f->shared->create_parms.freespace_ver));
|
||||
fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
"Object directory version number:",
|
||||
(unsigned)(f->shared->file_create_parms.objectdir_ver));
|
||||
(unsigned)(f->shared->create_parms.objectdir_ver));
|
||||
fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
"Shared header version number:",
|
||||
(unsigned)(f->shared->file_create_parms.sharedheader_ver));
|
||||
(unsigned)(f->shared->create_parms.sharedheader_ver));
|
||||
|
||||
fprintf (stream, "%*sRoot symbol table entry:\n", indent, "");
|
||||
H5G_ent_debug (f, f->shared->root_sym, stream, indent+3, MAX(0, fwidth-3));
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#define PABLO_MASK H5F_core
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
static hbool_t H5F_core_access (const char *name, int mode, H5F_search_t *key);
|
||||
static H5F_low_t *H5F_core_open (const char *name, uintn flags, H5F_search_t*);
|
||||
@ -66,7 +67,7 @@ const H5F_low_class_t H5F_LOW_CORE[1] = {{
|
||||
static hbool_t
|
||||
H5F_core_access (const char *name, int mode, H5F_search_t *key/*out*/)
|
||||
{
|
||||
FUNC_ENTER (H5F_core_access, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_core_access, FAIL);
|
||||
FUNC_LEAVE (FALSE);
|
||||
}
|
||||
|
||||
@ -98,7 +99,7 @@ H5F_core_open (const char *name, uintn flags, H5F_search_t *key)
|
||||
H5F_low_t *lf = NULL;
|
||||
static ino_t ino=0;
|
||||
|
||||
FUNC_ENTER (H5F_core_open, NULL, NULL);
|
||||
FUNC_ENTER (H5F_core_open, NULL);
|
||||
|
||||
if (0==(flags & H5F_ACC_WRITE) || 0==(flags & H5F_ACC_CREAT)) {
|
||||
/* must creat file with write access */
|
||||
@ -141,7 +142,7 @@ H5F_core_open (const char *name, uintn flags, H5F_search_t *key)
|
||||
static herr_t
|
||||
H5F_core_close (H5F_low_t *lf)
|
||||
{
|
||||
FUNC_ENTER (H5F_core_close, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_core_close, FAIL);
|
||||
|
||||
lf->u.core.mem = H5MM_xfree (lf->u.core.mem);
|
||||
lf->u.core.size = 0;
|
||||
@ -177,7 +178,7 @@ H5F_core_read (H5F_low_t *lf, const haddr_t *addr, size_t size, uint8 *buf)
|
||||
size_t n;
|
||||
size_t eof;
|
||||
|
||||
FUNC_ENTER (H5F_core_read, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_core_read, FAIL);
|
||||
|
||||
assert (lf);
|
||||
assert (addr && H5F_addr_defined (addr));
|
||||
@ -224,7 +225,7 @@ H5F_core_write (H5F_low_t *lf, const haddr_t *addr, size_t size,
|
||||
{
|
||||
size_t inc_amount;
|
||||
|
||||
FUNC_ENTER (H5F_core_write, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_core_write, FAIL);
|
||||
|
||||
assert (lf);
|
||||
assert (addr && H5F_addr_defined (addr));
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#define PABLO_MASK H5F_family
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
/*
|
||||
* Number of bits in the member address. This can be up to (but not
|
||||
@ -97,7 +98,7 @@ H5F_fam_open (const char *name, uintn flags, H5F_search_t *key/*out*/)
|
||||
size_t nbits=H5F_FAM_DFLT_NBITS;/*num bits in an offset */
|
||||
haddr_t tmp_addr; /*temporary address */
|
||||
|
||||
FUNC_ENTER (H5F_fam_open, NULL, NULL);
|
||||
FUNC_ENTER (H5F_fam_open, NULL);
|
||||
|
||||
/*
|
||||
* If we're truncating the file then delete all but the first family
|
||||
@ -227,7 +228,7 @@ H5F_fam_close (H5F_low_t *lf)
|
||||
{
|
||||
intn membno;
|
||||
|
||||
FUNC_ENTER (H5F_fam_close, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_fam_close, FAIL);
|
||||
|
||||
assert (lf);
|
||||
|
||||
@ -273,7 +274,7 @@ H5F_fam_read (H5F_low_t *lf, const haddr_t *addr, size_t size, uint8 *buf)
|
||||
off_t offset;
|
||||
size_t member_size;
|
||||
|
||||
FUNC_ENTER (H5F_fam_read, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_fam_read, FAIL);
|
||||
|
||||
assert (lf);
|
||||
assert (addr && H5F_addr_defined (addr));
|
||||
@ -339,7 +340,7 @@ H5F_fam_write (H5F_low_t *lf, const haddr_t *addr, size_t size,
|
||||
intn i;
|
||||
size_t member_size;
|
||||
|
||||
FUNC_ENTER (H5F_fam_write, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_fam_write, FAIL);
|
||||
|
||||
assert (lf);
|
||||
assert (addr && H5F_addr_defined (addr));
|
||||
@ -440,7 +441,7 @@ H5F_fam_flush (H5F_low_t *lf)
|
||||
haddr_t addr1, addr2, addr3;
|
||||
size_t max_offset;
|
||||
|
||||
FUNC_ENTER (H5F_fam_flush, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_fam_flush, FAIL);
|
||||
|
||||
/*
|
||||
* Make sure that the first family member is the maximum size because
|
||||
@ -508,7 +509,7 @@ H5F_fam_access (const char *name, int mode, H5F_search_t *key/*out*/)
|
||||
char member_name[4096];
|
||||
hbool_t status;
|
||||
|
||||
FUNC_ENTER (H5F_fam_access, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_fam_access, FAIL);
|
||||
|
||||
for (membno=0; /*void*/; membno++) {
|
||||
sprintf (member_name, name, membno);
|
||||
|
@ -24,8 +24,9 @@ typedef enum H5F_isop_t {
|
||||
|
||||
#define PABLO_MASK H5F_istore_mask
|
||||
|
||||
/* Is the interface initialized? */
|
||||
/* Interface initialization */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static size_t H5F_istore_sizeof_rkey (H5F_t *f, const void *_udata);
|
||||
@ -70,6 +71,7 @@ static herr_t H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore,
|
||||
* The storage file address is part of the B-tree and not part of the key.
|
||||
*/
|
||||
typedef struct H5F_istore_key_t {
|
||||
uintn file_number; /*external file number */
|
||||
size_t offset[H5O_ISTORE_NDIMS]; /*logical offset to start*/
|
||||
size_t size[H5O_ISTORE_NDIMS]; /*logical chunk size */
|
||||
} H5F_istore_key_t;
|
||||
@ -122,11 +124,16 @@ static size_t
|
||||
H5F_istore_sizeof_rkey (H5F_t *f, const void *_udata)
|
||||
{
|
||||
const H5F_istore_ud1_t *udata = (const H5F_istore_ud1_t *)_udata;
|
||||
size_t nbytes;
|
||||
|
||||
assert (udata);
|
||||
assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_ISTORE_NDIMS);
|
||||
|
||||
return udata->mesg.ndims * (4 + 4);
|
||||
nbytes = 4 + /*external file number */
|
||||
udata->mesg.ndims * 4 + /*dimension indices */
|
||||
udata->mesg.ndims * 4; /*dimension sizes */
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
|
||||
@ -154,16 +161,18 @@ H5F_istore_decode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
|
||||
int i;
|
||||
int ndims = bt->sizeof_rkey / 8;
|
||||
|
||||
FUNC_ENTER (H5F_istore_decode_key, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_decode_key, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (bt);
|
||||
assert (raw);
|
||||
assert (key);
|
||||
assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS && 8*ndims==bt->sizeof_rkey);
|
||||
assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS);
|
||||
|
||||
/* decode */
|
||||
UINT32DECODE (raw, key->file_number);
|
||||
assert (0==key->file_number);
|
||||
for (i=0; i<ndims; i++) {
|
||||
UINT32DECODE (raw, key->offset[i]);
|
||||
UINT32DECODE (raw, key->size[i]);
|
||||
@ -197,16 +206,18 @@ H5F_istore_encode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
|
||||
intn ndims = bt->sizeof_rkey / 8;
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER (H5F_istore_encode_key, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_encode_key, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (bt);
|
||||
assert (raw);
|
||||
assert (key);
|
||||
assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS && 8*ndims==bt->sizeof_rkey);
|
||||
assert (ndims>0 && ndims<=H5O_ISTORE_NDIMS);
|
||||
|
||||
/* encode */
|
||||
UINT32ENCODE (raw, key->file_number);
|
||||
assert (0==key->file_number);
|
||||
for (i=0; i<ndims; i++) {
|
||||
UINT32ENCODE (raw, key->offset[i]);
|
||||
UINT32ENCODE (raw, key->size[i]);
|
||||
@ -221,7 +232,8 @@ H5F_istore_encode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
|
||||
*
|
||||
* Purpose: Compares two keys sort of like strcmp(). The UDATA pointer
|
||||
* is only to supply extra information not carried in the keys
|
||||
* (in this case, the dimensionality).
|
||||
* (in this case, the dimensionality) and is not compared
|
||||
* against the keys.
|
||||
*
|
||||
* Return: Success: -1 if LT_KEY is less than RT_KEY;
|
||||
* 1 if LT_KEY is greater than RT_KEY;
|
||||
@ -244,13 +256,14 @@ H5F_istore_cmp2 (H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
|
||||
H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *)_udata;
|
||||
intn cmp;
|
||||
|
||||
FUNC_ENTER (H5F_istore_cmp2, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_cmp2, FAIL);
|
||||
|
||||
assert (lt_key);
|
||||
assert (rt_key);
|
||||
assert (udata);
|
||||
assert (udata->mesg.ndims>0 && udata->mesg.ndims<=H5O_ISTORE_NDIMS);
|
||||
|
||||
|
||||
/* Compare the offsets but ignore the other fields */
|
||||
cmp = H5V_vector_cmp (udata->mesg.ndims, lt_key->offset, rt_key->offset);
|
||||
|
||||
FUNC_LEAVE (cmp);
|
||||
@ -294,7 +307,7 @@ H5F_istore_cmp3 (H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
|
||||
H5F_istore_ud1_t *udata = (H5F_istore_ud1_t *)_udata;
|
||||
intn cmp = 0;
|
||||
|
||||
FUNC_ENTER (H5F_istore_cmp3, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_cmp3, FAIL);
|
||||
|
||||
assert (lt_key);
|
||||
assert (rt_key);
|
||||
@ -343,7 +356,7 @@ H5F_istore_new_node (H5F_t *f, H5B_ins_t op,
|
||||
size_t nbytes;
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER (H5F_istore_new_node, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_new_node, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -361,6 +374,9 @@ H5F_istore_new_node (H5F_t *f, H5B_ins_t op,
|
||||
HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL);
|
||||
}
|
||||
udata->addr = *addr;
|
||||
udata->key.file_number = 0;
|
||||
lt_key->file_number = udata->key.file_number;
|
||||
if (H5B_INS_LEFT!=op) rt_key->file_number = 0;
|
||||
|
||||
/* Initialize the key(s) */
|
||||
for (i=0; i<udata->mesg.ndims; i++) {
|
||||
@ -368,9 +384,9 @@ H5F_istore_new_node (H5F_t *f, H5B_ins_t op,
|
||||
* The left key describes the storage of the UDATA chunk being inserted
|
||||
* into the tree.
|
||||
*/
|
||||
assert (udata->key.size[i]>0);
|
||||
lt_key->offset[i] = udata->key.offset[i];
|
||||
lt_key->size[i] = udata->key.size[i];
|
||||
assert (udata->key.size[i]>0);
|
||||
|
||||
/*
|
||||
* The right key might already be present. If not, then add
|
||||
@ -416,7 +432,7 @@ H5F_istore_found (H5F_t *f, const haddr_t *addr, const void *_lt_key,
|
||||
const H5F_istore_key_t *lt_key = (const H5F_istore_key_t *)_lt_key;
|
||||
int i;
|
||||
|
||||
FUNC_ENTER (H5F_istore_found, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_found, FAIL);
|
||||
|
||||
/* Check arguments */
|
||||
assert (f);
|
||||
@ -426,6 +442,8 @@ H5F_istore_found (H5F_t *f, const haddr_t *addr, const void *_lt_key,
|
||||
|
||||
/* Initialize return values */
|
||||
udata->addr = *addr;
|
||||
udata->key.file_number = lt_key->file_number;
|
||||
assert (0==lt_key->file_number);
|
||||
for (i=0; i<udata->mesg.ndims; i++) {
|
||||
udata->key.offset[i] = lt_key->offset[i];
|
||||
udata->key.size[i] = lt_key->size[i];
|
||||
@ -435,7 +453,6 @@ H5F_istore_found (H5F_t *f, const haddr_t *addr, const void *_lt_key,
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_istore_insert
|
||||
@ -482,7 +499,7 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr,
|
||||
H5B_ins_t ret_value = H5B_INS_ERROR;
|
||||
size_t nbytes;
|
||||
|
||||
FUNC_ENTER (H5F_istore_insert, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_insert, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -510,6 +527,7 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr,
|
||||
* Already exists. Just return the info.
|
||||
*/
|
||||
udata->addr = *addr;
|
||||
udata->key.file_number = lt_key->file_number;
|
||||
ret_value = H5B_INS_NOOP;
|
||||
|
||||
} else if (H5V_hyper_disjointp (udata->mesg.ndims,
|
||||
@ -523,6 +541,7 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr,
|
||||
* Split this node, inserting the new new node to the right of the
|
||||
* current node. The MD_KEY is where the split occurs.
|
||||
*/
|
||||
md_key->file_number = udata->key.file_number;
|
||||
for (i=0, nbytes=1; i<udata->mesg.ndims; i++) {
|
||||
assert (0==udata->key.offset[i] % udata->mesg.alignment[i]);
|
||||
assert (udata->key.size[i] == udata->mesg.alignment[i]);
|
||||
@ -538,6 +557,7 @@ H5F_istore_insert (H5F_t *f, const haddr_t *addr,
|
||||
HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL);
|
||||
}
|
||||
udata->addr = *new_node;
|
||||
udata->key.file_number = 0;
|
||||
ret_value = H5B_INS_RIGHT;
|
||||
|
||||
} else {
|
||||
@ -600,7 +620,7 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op,
|
||||
herr_t status;
|
||||
herr_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER (H5F_istore_copy_hyperslab, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_copy_hyperslab, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -644,6 +664,9 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op,
|
||||
|
||||
/* Read/Write chunk or create it if it doesn't exist */
|
||||
udata.mesg.ndims = istore->ndims;
|
||||
H5F_addr_undef (&(udata.addr));
|
||||
udata.key.file_number = 0;
|
||||
|
||||
for (i=0; i<istore->ndims; i++) {
|
||||
|
||||
/* The location and size of the chunk being accessed */
|
||||
@ -679,6 +702,7 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op,
|
||||
!H5V_vector_zerop (istore->ndims, offset_wrt_chunk) ||
|
||||
!H5V_vector_eq (istore->ndims, sub_size, udata.key.size)) {
|
||||
if (status>=0 && H5F_addr_defined (&(udata.addr))) {
|
||||
assert (0==udata.key.file_number);
|
||||
if (H5F_block_read (f, &(udata.addr), chunk_size, chunk)<0) {
|
||||
HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL);
|
||||
}
|
||||
@ -692,6 +716,7 @@ H5F_istore_copy_hyperslab (H5F_t *f, const H5O_istore_t *istore, H5F_isop_t op,
|
||||
H5V_hyper_copy (istore->ndims, sub_size,
|
||||
udata.key.size, offset_wrt_chunk, chunk,
|
||||
size_m, sub_offset_m, buf);
|
||||
assert (0==udata.key.file_number);
|
||||
if (H5F_block_write (f, &(udata.addr), chunk_size, chunk)<0) {
|
||||
HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL);
|
||||
}
|
||||
@ -738,7 +763,7 @@ herr_t
|
||||
H5F_istore_read (H5F_t *f, const H5O_istore_t *istore,
|
||||
const size_t offset[], const size_t size[], void *buf)
|
||||
{
|
||||
FUNC_ENTER (H5F_istore_read, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_read, FAIL);
|
||||
|
||||
/* Check args */
|
||||
assert (f);
|
||||
@ -778,7 +803,7 @@ herr_t
|
||||
H5F_istore_write (H5F_t *f, const H5O_istore_t *istore,
|
||||
const size_t offset[], const size_t size[], void *buf)
|
||||
{
|
||||
FUNC_ENTER (H5F_istore_write, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_write, FAIL);
|
||||
|
||||
/* Check args */
|
||||
assert (f);
|
||||
@ -799,7 +824,7 @@ H5F_istore_write (H5F_t *f, const H5O_istore_t *istore,
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_istore_new
|
||||
* Function: H5F_istore_create
|
||||
*
|
||||
* Purpose: Creates a new indexed-storage B-tree and initializes the
|
||||
* istore struct with information about the storage. The
|
||||
@ -821,13 +846,13 @@ H5F_istore_write (H5F_t *f, const H5O_istore_t *istore,
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5F_istore_new (H5F_t *f, struct H5O_istore_t *istore,
|
||||
uintn ndims, const size_t alignment[])
|
||||
H5F_istore_create (H5F_t *f, struct H5O_istore_t *istore,
|
||||
uintn ndims, const size_t alignment[])
|
||||
{
|
||||
H5F_istore_ud1_t udata;
|
||||
int i;
|
||||
|
||||
FUNC_ENTER (H5F_istore_new, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_istore_create, FAIL);
|
||||
|
||||
/* Check args */
|
||||
assert (f);
|
||||
@ -841,7 +866,7 @@ H5F_istore_new (H5F_t *f, struct H5O_istore_t *istore,
|
||||
#endif
|
||||
|
||||
udata.mesg.ndims = istore->ndims = ndims;
|
||||
if (H5B_new (f, H5B_ISTORE, &udata, &(istore->btree_addr)/*out*/)<0) {
|
||||
if (H5B_create (f, H5B_ISTORE, &udata, &(istore->btree_addr)/*out*/)<0) {
|
||||
HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL); /* Can't create B-tree */
|
||||
}
|
||||
|
||||
|
75
src/H5Flow.c
75
src/H5Flow.c
@ -21,6 +21,7 @@
|
||||
|
||||
#define PABLO_MASK H5F_low
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -72,7 +73,7 @@ H5F_low_open (const H5F_low_class_t *type, const char *name, uintn flags,
|
||||
{
|
||||
H5F_low_t *lf = NULL;
|
||||
|
||||
FUNC_ENTER (H5F_low_open, NULL, NULL);
|
||||
FUNC_ENTER (H5F_low_open, NULL);
|
||||
|
||||
assert (type && type->open);
|
||||
assert (name && *name);
|
||||
@ -117,7 +118,7 @@ H5F_low_open (const H5F_low_class_t *type, const char *name, uintn flags,
|
||||
H5F_low_t *
|
||||
H5F_low_close (H5F_low_t *lf)
|
||||
{
|
||||
FUNC_ENTER (H5F_low_close, NULL, NULL);
|
||||
FUNC_ENTER (H5F_low_close, NULL);
|
||||
|
||||
if (lf) {
|
||||
if ((lf->type->close)(lf)<0) {
|
||||
@ -163,7 +164,7 @@ H5F_low_read (H5F_low_t *lf, const haddr_t *addr, size_t size,
|
||||
{
|
||||
herr_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER (H5F_low_read, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_low_read, FAIL);
|
||||
|
||||
assert (lf && lf->type);
|
||||
assert (addr && H5F_addr_defined (addr));
|
||||
@ -213,7 +214,7 @@ H5F_low_write (H5F_low_t *lf, const haddr_t *addr, size_t size,
|
||||
herr_t ret_value = FAIL;
|
||||
haddr_t tmp_addr;
|
||||
|
||||
FUNC_ENTER (H5F_low_write, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_low_write, FAIL);
|
||||
|
||||
assert (lf && lf->type);
|
||||
assert (addr && H5F_addr_defined (addr));
|
||||
@ -244,10 +245,14 @@ H5F_low_write (H5F_low_t *lf, const haddr_t *addr, size_t size,
|
||||
* Function: H5F_low_flush
|
||||
*
|
||||
* Purpose: Flushes file buffers to disk. For instance, the stdio.h
|
||||
* driver would call fflush().
|
||||
*
|
||||
* If the subclass doesn't define a flush method then this
|
||||
* function doesn't do anything.
|
||||
* driver would call fflush(). Flushing also insures that the
|
||||
* file exists to the current logical EOF (the library maintains
|
||||
* a notion of EOF which is independent of the physical EOF) by
|
||||
* reading and writing the last byte. On some systems, this
|
||||
* allocates a single block at the end of the file while on
|
||||
* other systems it allocates all blocks up to the end of the
|
||||
* file. Extending the physical file is necessary because
|
||||
* H5F_open() checks for truncated files.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
@ -263,10 +268,24 @@ H5F_low_write (H5F_low_t *lf, const haddr_t *addr, size_t size,
|
||||
herr_t
|
||||
H5F_low_flush (H5F_low_t *lf)
|
||||
{
|
||||
FUNC_ENTER (H5F_low_flush, NULL, FAIL);
|
||||
haddr_t last_byte;
|
||||
uint8 buf[1];
|
||||
|
||||
FUNC_ENTER (H5F_low_flush, FAIL);
|
||||
|
||||
assert (lf && lf->type);
|
||||
|
||||
/* Make sure the last block of the file has been allocated on disk */
|
||||
H5F_addr_reset (&last_byte);
|
||||
if (H5F_addr_defined (&(lf->eof)) && H5F_addr_gt (&(lf->eof), &last_byte)) {
|
||||
last_byte = lf->eof;
|
||||
last_byte.offset -= 1;
|
||||
if (H5F_low_read (lf, &last_byte, 1, buf)>=0) {
|
||||
H5F_low_write (lf, &last_byte, 1, buf);
|
||||
}
|
||||
}
|
||||
|
||||
/* Invoke the subclass the flush method */
|
||||
if (lf->type->flush) {
|
||||
if ((lf->type->flush)(lf)<0) {
|
||||
/* Low level flush failed */
|
||||
@ -315,7 +334,7 @@ H5F_low_size (H5F_low_t *lf, haddr_t *eof/*out*/)
|
||||
{
|
||||
size_t size = (size_t)(-1); /*max possible size*/
|
||||
|
||||
FUNC_ENTER (H5F_low_size, NULL, 0);
|
||||
FUNC_ENTER (H5F_low_size, 0);
|
||||
|
||||
assert (lf && lf->type);
|
||||
assert (eof);
|
||||
@ -368,7 +387,7 @@ H5F_low_access (const H5F_low_class_t *type, const char *name, int mode,
|
||||
hbool_t ret_value;
|
||||
struct stat sb;
|
||||
|
||||
FUNC_ENTER (H5F_low_size, NULL, 0);
|
||||
FUNC_ENTER (H5F_low_size, 0);
|
||||
assert (type);
|
||||
|
||||
if (type->access) {
|
||||
@ -411,7 +430,7 @@ H5F_low_access (const H5F_low_class_t *type, const char *name, int mode,
|
||||
herr_t
|
||||
H5F_low_extend (H5F_low_t *lf, intn op, size_t size, haddr_t *addr/*out*/)
|
||||
{
|
||||
FUNC_ENTER (H5F_low_alloc, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_low_alloc, FAIL);
|
||||
|
||||
assert (lf);
|
||||
assert (size>0);
|
||||
@ -450,7 +469,7 @@ H5F_low_extend (H5F_low_t *lf, intn op, size_t size, haddr_t *addr/*out*/)
|
||||
herr_t
|
||||
H5F_low_seteof (H5F_low_t *lf, const haddr_t *addr)
|
||||
{
|
||||
FUNC_ENTER (H5F_low_seteof, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_low_seteof, FAIL);
|
||||
|
||||
assert (lf);
|
||||
assert (addr && H5F_addr_defined (addr));
|
||||
@ -482,7 +501,7 @@ H5F_low_seteof (H5F_low_t *lf, const haddr_t *addr)
|
||||
intn
|
||||
H5F_addr_cmp (const haddr_t *a1, const haddr_t *a2)
|
||||
{
|
||||
FUNC_ENTER (H5F_addr_cmp, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_addr_cmp, FAIL);
|
||||
|
||||
assert (a1 && H5F_addr_defined (a1));
|
||||
assert (a2 && H5F_addr_defined (a2));
|
||||
@ -493,7 +512,6 @@ H5F_addr_cmp (const haddr_t *a1, const haddr_t *a2)
|
||||
FUNC_LEAVE (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_addr_undef
|
||||
@ -510,8 +528,10 @@ H5F_addr_cmp (const haddr_t *a1, const haddr_t *a2)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5F_addr_undef (haddr_t *addr)
|
||||
H5F_addr_undef (haddr_t *addr/*out*/)
|
||||
{
|
||||
assert (addr);
|
||||
|
||||
addr->offset = -1;
|
||||
}
|
||||
|
||||
@ -535,11 +555,10 @@ H5F_addr_undef (haddr_t *addr)
|
||||
hbool_t
|
||||
H5F_addr_defined (const haddr_t *addr)
|
||||
{
|
||||
FUNC_ENTER (H5F_addr_defined, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_addr_defined, FAIL);
|
||||
FUNC_LEAVE (-1!=addr->offset && addr->offset>=0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_addr_reset
|
||||
@ -556,12 +575,12 @@ H5F_addr_defined (const haddr_t *addr)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5F_addr_reset (haddr_t *addr)
|
||||
H5F_addr_reset (haddr_t *addr/*out*/)
|
||||
{
|
||||
assert (addr);
|
||||
addr->offset = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_addr_zerop
|
||||
@ -582,11 +601,10 @@ H5F_addr_reset (haddr_t *addr)
|
||||
hbool_t
|
||||
H5F_addr_zerop (const haddr_t *addr)
|
||||
{
|
||||
FUNC_ENTER (H5F_addr_zerop, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_addr_zerop, FAIL);
|
||||
FUNC_LEAVE (0==addr->offset);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_addr_encode
|
||||
@ -616,20 +634,19 @@ H5F_addr_encode (H5F_t *f, uint8 **pp, const haddr_t *addr)
|
||||
|
||||
if (H5F_addr_defined (addr)) {
|
||||
tmp = *addr;
|
||||
for (i=0; i<H5F_SIZEOF_OFFSET (f); i++) {
|
||||
for (i=0; i<H5F_SIZEOF_ADDR (f); i++) {
|
||||
*(*pp)++ = tmp.offset & 0xff;
|
||||
tmp.offset >>= 8;
|
||||
}
|
||||
assert ("overflow" && 0==tmp.offset);
|
||||
|
||||
} else {
|
||||
for (i=0; i<H5F_SIZEOF_OFFSET (f); i++) {
|
||||
for (i=0; i<H5F_SIZEOF_ADDR (f); i++) {
|
||||
*(*pp)++ = 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_addr_decode
|
||||
@ -663,7 +680,8 @@ H5F_addr_decode (H5F_t *f, const uint8 **pp, haddr_t *addr/*out*/)
|
||||
assert (addr);
|
||||
|
||||
addr->offset = 0;
|
||||
for (i=0; i<H5F_SIZEOF_OFFSET (f); i++) {
|
||||
|
||||
for (i=0; i<H5F_SIZEOF_ADDR (f); i++) {
|
||||
c = *(*pp)++;
|
||||
if (c!=0xff) all_zero = FALSE;
|
||||
|
||||
@ -678,7 +696,6 @@ H5F_addr_decode (H5F_t *f, const uint8 **pp, haddr_t *addr/*out*/)
|
||||
if (all_zero) H5F_addr_undef (addr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_addr_print
|
||||
@ -723,7 +740,6 @@ H5F_addr_print (FILE *stream, const haddr_t *addr)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_addr_pow2
|
||||
@ -750,7 +766,6 @@ H5F_addr_pow2 (uintn n, haddr_t *addr/*out*/)
|
||||
addr->offset <<= n;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_addr_inc
|
||||
@ -774,7 +789,6 @@ H5F_addr_inc (haddr_t *addr/*in,out*/, size_t inc)
|
||||
addr->offset += inc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_addr_add
|
||||
@ -798,7 +812,6 @@ H5F_addr_add (haddr_t *a1/*in,out*/, const haddr_t *a2)
|
||||
a1->offset += a2->offset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5F_addr_hash
|
||||
|
@ -49,8 +49,8 @@
|
||||
#define H5F_SIGNATURE_LEN 8
|
||||
|
||||
/* size of size_t and off_t as they exist on disk */
|
||||
#define H5F_SIZEOF_OFFSET(F) ((F)->shared->file_create_parms.sizeof_addr)
|
||||
#define H5F_SIZEOF_SIZE(F) ((F)->shared->file_create_parms.sizeof_size)
|
||||
#define H5F_SIZEOF_ADDR(F) ((F)->shared->create_parms.sizeof_addr)
|
||||
#define H5F_SIZEOF_SIZE(F) ((F)->shared->create_parms.sizeof_size)
|
||||
|
||||
/*
|
||||
* File open flags.
|
||||
@ -210,10 +210,10 @@
|
||||
#define NBYTEDECODE(s, d, n) { HDmemcpy(d,s,n); p+=n }
|
||||
|
||||
/*
|
||||
* File-creation template information structure
|
||||
* File-creation template.
|
||||
*/
|
||||
typedef struct {
|
||||
uintn userblock_size; /* Size of the file user block in bytes */
|
||||
typedef struct H5F_create_t {
|
||||
uintn userblock_size; /* Size of the file user block in bytes */
|
||||
uintn sym_leaf_k; /* 1/2 rank for symbol table leaf nodes */
|
||||
uintn btree_k[8]; /* 1/2 rank for btree internal nodes */
|
||||
uint8 sizeof_addr; /* Number of bytes in an address */
|
||||
@ -223,7 +223,7 @@ typedef struct {
|
||||
uint8 freespace_ver; /* Version # of the free-space information */
|
||||
uint8 objectdir_ver; /* Version # of the object directory format */
|
||||
uint8 sharedheader_ver; /* Version # of the shared header format */
|
||||
} file_create_temp_t;
|
||||
} H5F_create_t;
|
||||
|
||||
/*
|
||||
* These things make a file unique.
|
||||
@ -310,7 +310,7 @@ extern const H5F_low_class_t H5F_LOW_STDIO[]; /* Posix stdio */
|
||||
extern const H5F_low_class_t H5F_LOW_CORE[]; /* In-core temp file */
|
||||
extern const H5F_low_class_t H5F_LOW_FAM[]; /* File family */
|
||||
extern const H5F_low_class_t H5F_LOW_SPLIT[]; /* Split meta/raw data */
|
||||
|
||||
|
||||
/*
|
||||
* Define the structure to store the file information for HDF5 files. One of
|
||||
* these structures is allocated per file, not per H5Fopen().
|
||||
@ -327,7 +327,7 @@ typedef struct H5F_file_t {
|
||||
haddr_t freespace_addr; /* Relative address of free-space info */
|
||||
haddr_t hdf5_eof; /* Relative addr of end of all hdf5 data*/
|
||||
struct H5AC_t *cache; /* The object cache */
|
||||
file_create_temp_t file_create_parms; /* File-creation template */
|
||||
H5F_create_t create_parms; /* File-creation template */
|
||||
#ifdef LATER
|
||||
file_access_temp_t file_access_parms; /* File-access template */
|
||||
#endif
|
||||
@ -352,18 +352,18 @@ typedef struct H5F_t {
|
||||
|
||||
|
||||
#ifdef NOT_YET
|
||||
#define H5F_ENCODE_OFFSET(f,p,o) (H5F_SIZEOF_OFFSET(f)==4 ? UINT32ENCODE(p,o) \
|
||||
: H5F_SIZEOF_OFFSET(f)==8 ? UINT64ENCODE(p,o) \
|
||||
: H5F_SIZEOF_OFFSET(f)==2 ? UINT16ENCODE(p,o) \
|
||||
#define H5F_ENCODE_OFFSET(f,p,o) (H5F_SIZEOF_ADDR(f)==4 ? UINT32ENCODE(p,o) \
|
||||
: H5F_SIZEOF_ADDR(f)==8 ? UINT64ENCODE(p,o) \
|
||||
: H5F_SIZEOF_ADDR(f)==2 ? UINT16ENCODE(p,o) \
|
||||
: H5FPencode_unusual_offset(f,&(p),(uint8 *)&(o)))
|
||||
#else /* NOT_YET */
|
||||
#define H5F_ENCODE_OFFSET(f,p,o) switch(H5F_SIZEOF_OFFSET(f)) { case 4: UINT32ENCODE(p,o); break;\
|
||||
#define H5F_ENCODE_OFFSET(f,p,o) switch(H5F_SIZEOF_ADDR(f)) { case 4: UINT32ENCODE(p,o); break;\
|
||||
case 8: UINT64ENCODE(p,o); break;\
|
||||
case 2: UINT16ENCODE(p,o); break;}
|
||||
#endif /* NOT_YET */
|
||||
|
||||
#define H5F_DECODE_OFFSET(f,p,o) \
|
||||
switch (H5F_SIZEOF_OFFSET (f)) { \
|
||||
switch (H5F_SIZEOF_ADDR (f)) { \
|
||||
case 4: \
|
||||
UINT32DECODE (p, o); \
|
||||
break; \
|
||||
@ -397,17 +397,20 @@ typedef struct H5F_t {
|
||||
|
||||
struct H5O_istore_t; /*forward decl for prototype arguments*/
|
||||
|
||||
/* library variables */
|
||||
extern const H5F_create_t H5F_create_dflt;
|
||||
|
||||
/* Private functions, not part of the publicly documented API */
|
||||
void H5F_encode_length_unusual(const H5F_t *f, uint8 **p, uint8 *l);
|
||||
H5F_t *H5F_open (const H5F_low_class_t *type, const char *name, uintn flags,
|
||||
const file_create_temp_t *create_parms);
|
||||
const H5F_create_t *create_parms);
|
||||
herr_t H5F_close (H5F_t *f);
|
||||
herr_t H5F_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
|
||||
intn fwidth);
|
||||
|
||||
/* Functions that operate on indexed storage */
|
||||
herr_t H5F_istore_new (H5F_t *f, struct H5O_istore_t *istore,
|
||||
uintn ndims, const size_t alignment[]);
|
||||
herr_t H5F_istore_create (H5F_t *f, struct H5O_istore_t *istore,
|
||||
uintn ndims, const size_t alignment[]);
|
||||
herr_t H5F_istore_read (H5F_t *f, const struct H5O_istore_t *mesg,
|
||||
const size_t offset[], const size_t size[],
|
||||
void *buf);
|
||||
@ -417,7 +420,8 @@ herr_t H5F_istore_write (H5F_t *f, const struct H5O_istore_t *mesg,
|
||||
|
||||
/* Functions that operate on contiguous storage wrt boot block */
|
||||
herr_t H5F_block_read (H5F_t *f, const haddr_t *addr, size_t size, void *buf);
|
||||
herr_t H5F_block_write (H5F_t *f, const haddr_t *addr, size_t size, void *buf);
|
||||
herr_t H5F_block_write (H5F_t *f, const haddr_t *addr, size_t size,
|
||||
const void *buf);
|
||||
|
||||
/* Functions that operate directly on low-level files */
|
||||
herr_t H5F_low_extend (H5F_low_t *lf, intn op, size_t size, haddr_t *addr);
|
||||
|
@ -37,9 +37,7 @@ hbool_t H5Fis_hdf5(const char *filename);
|
||||
hid_t H5Fcreate(const char *filename, uintn flags, hid_t create_template, hid_t access_template);
|
||||
hid_t H5Fopen(const char *filename, uintn flags, hid_t access_template);
|
||||
herr_t H5Fclose(hid_t fid);
|
||||
herr_t H5Fflush (hid_t fid, hbool_t invalidate);
|
||||
hid_t H5Fget_create_template(hid_t fid);
|
||||
void H5F_term_interface (void);
|
||||
hid_t H5Fget_create_template (hid_t fid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#define PABLO_MASK H5F_sec2
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
static H5F_low_t *H5F_sec2_open (const char *name, uintn flags, H5F_search_t*);
|
||||
static herr_t H5F_sec2_close (H5F_low_t *lf);
|
||||
@ -73,7 +74,7 @@ H5F_sec2_open (const char *name, uintn flags, H5F_search_t *key/*out*/)
|
||||
int fd;
|
||||
struct stat sb;
|
||||
|
||||
FUNC_ENTER (H5F_sec2_open, NULL, NULL);
|
||||
FUNC_ENTER (H5F_sec2_open, NULL);
|
||||
|
||||
oflags = (flags & H5F_ACC_WRITE) ? O_RDWR : O_RDONLY;
|
||||
oflags |= (flags & H5F_ACC_CREAT) ? O_CREAT : 0;
|
||||
@ -122,7 +123,7 @@ H5F_sec2_open (const char *name, uintn flags, H5F_search_t *key/*out*/)
|
||||
static herr_t
|
||||
H5F_sec2_close (H5F_low_t *lf)
|
||||
{
|
||||
FUNC_ENTER (H5F_sec2_close, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_sec2_close, FAIL);
|
||||
|
||||
if (close (lf->u.sec2.fd)<0) {
|
||||
HRETURN_ERROR (H5E_IO, H5E_CLOSEERROR, FAIL); /*close failed*/
|
||||
@ -161,7 +162,7 @@ H5F_sec2_read (H5F_low_t *lf, const haddr_t *addr, size_t size, uint8 *buf)
|
||||
ssize_t n;
|
||||
off_t offset;
|
||||
|
||||
FUNC_ENTER (H5F_sec2_read, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_sec2_read, FAIL);
|
||||
|
||||
|
||||
/* Check for overflow */
|
||||
@ -248,7 +249,7 @@ H5F_sec2_write (H5F_low_t *lf, const haddr_t *addr, size_t size,
|
||||
{
|
||||
off_t offset;
|
||||
|
||||
FUNC_ENTER (H5F_sec2_write, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_sec2_write, FAIL);
|
||||
|
||||
/* Check for overflow */
|
||||
offset = addr->offset;
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#define PABLO_MASK H5F_sec2
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
static H5F_low_t *H5F_stdio_open (const char *name, uintn flags,
|
||||
H5F_search_t *key);
|
||||
@ -73,7 +74,7 @@ H5F_stdio_open (const char *name, uintn flags, H5F_search_t *key/*out*/)
|
||||
FILE *f=NULL;
|
||||
struct stat sb;
|
||||
|
||||
FUNC_ENTER (H5F_stdio_open, NULL, NULL);
|
||||
FUNC_ENTER (H5F_stdio_open, NULL);
|
||||
|
||||
if (access (name, F_OK)<0) {
|
||||
if ((flags & H5F_ACC_CREAT) && (flags & H5F_ACC_WRITE)) {
|
||||
@ -141,7 +142,7 @@ H5F_stdio_open (const char *name, uintn flags, H5F_search_t *key/*out*/)
|
||||
static herr_t
|
||||
H5F_stdio_close (H5F_low_t *lf)
|
||||
{
|
||||
FUNC_ENTER (H5F_stdio_close, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_stdio_close, FAIL);
|
||||
|
||||
if (fclose (lf->u.stdio.f)<0) {
|
||||
HRETURN_ERROR (H5E_IO, H5E_CLOSEERROR, FAIL); /*close failed*/
|
||||
@ -180,7 +181,7 @@ H5F_stdio_read (H5F_low_t *lf, const haddr_t *addr, size_t size, uint8 *buf)
|
||||
size_t n;
|
||||
off_t offset;
|
||||
|
||||
FUNC_ENTER (H5F_stdio_read, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_stdio_read, FAIL);
|
||||
|
||||
/* Check for overflow */
|
||||
offset = addr->offset;
|
||||
@ -264,7 +265,7 @@ H5F_stdio_write (H5F_low_t *lf, const haddr_t *addr, size_t size,
|
||||
{
|
||||
off_t offset;
|
||||
|
||||
FUNC_ENTER (H5F_stdio_write, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_stdio_write, FAIL);
|
||||
|
||||
/* Check for overflow */
|
||||
offset = addr->offset;
|
||||
@ -324,7 +325,7 @@ H5F_stdio_write (H5F_low_t *lf, const haddr_t *addr, size_t size,
|
||||
static herr_t
|
||||
H5F_stdio_flush (H5F_low_t *lf)
|
||||
{
|
||||
FUNC_ENTER (H5F_stdio_flush, NULL, FAIL);
|
||||
FUNC_ENTER (H5F_stdio_flush, FAIL);
|
||||
|
||||
/*
|
||||
* What happens to the file position? Is it guaranteed to be the same
|
||||
|
93
src/H5G.c
93
src/H5G.c
@ -47,9 +47,9 @@
|
||||
#define H5G_INIT_HEAP 8192
|
||||
#define PABLO_MASK H5G_mask
|
||||
|
||||
/* Is the interface initialized? */
|
||||
/* Interface initialization */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -92,7 +92,7 @@ H5Gnew (hid_t file, const char *name, size_t size_hint)
|
||||
H5F_t *f=NULL;
|
||||
H5G_entry_t *grp_handle=NULL;
|
||||
|
||||
FUNC_ENTER (H5Gnew, NULL, FAIL);
|
||||
FUNC_ENTER (H5Gnew, FAIL);
|
||||
|
||||
/* Check/fix arguments */
|
||||
if (!name || !*name) {
|
||||
@ -158,7 +158,7 @@ H5Gset (hid_t file, const char *name)
|
||||
{
|
||||
H5F_t *f=NULL;
|
||||
|
||||
FUNC_ENTER (H5Gset, NULL, FAIL);
|
||||
FUNC_ENTER (H5Gset, FAIL);
|
||||
|
||||
/* Check/fix arguments */
|
||||
if (!name || !*name) {
|
||||
@ -217,7 +217,7 @@ H5Gpush (hid_t file, const char *name)
|
||||
{
|
||||
H5F_t *f=NULL;
|
||||
|
||||
FUNC_ENTER (H5Gpush, NULL, FAIL);
|
||||
FUNC_ENTER (H5Gpush, FAIL);
|
||||
|
||||
/* Check/fix arguments */
|
||||
if (!name || !*name) {
|
||||
@ -277,7 +277,7 @@ H5Gpop (hid_t file)
|
||||
{
|
||||
H5F_t *f=NULL;
|
||||
|
||||
FUNC_ENTER (H5Gpop, NULL, FAIL);
|
||||
FUNC_ENTER (H5Gpop, FAIL);
|
||||
|
||||
/* Check/fix arguments */
|
||||
if (H5_FILE!=H5Aatom_group (file)) {
|
||||
@ -344,57 +344,6 @@ H5G_component (const char *name, size_t *size_p)
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_basename
|
||||
*
|
||||
* Purpose: Returns a pointer into NAME for the start of the last
|
||||
* component of NAME. On return, the optional SIZE_P is
|
||||
* initialized to point to the size of the base name not
|
||||
* counting trailing slashes or the null character.
|
||||
*
|
||||
* Errors:
|
||||
*
|
||||
* Return: Success: Ptr to base name within NAME with SIZE_P
|
||||
* pointing to the number of characters in the
|
||||
* base name.
|
||||
*
|
||||
* Failure: Ptr to the null terminator of NAME.
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* matzke@llnl.gov
|
||||
* Aug 11 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#if 0
|
||||
static const char *
|
||||
H5G_basename (const char *name, size_t *size_p)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
assert (name);
|
||||
|
||||
s = name + HDstrlen(name);
|
||||
while (s>name && '/'==s[-1]) --s; /*skip past trailing slashes*/
|
||||
while (s>name && '/'!=s[-1]) --s; /*skip past base name*/
|
||||
|
||||
/*
|
||||
* If the input was the name of the root group `/' (or
|
||||
* equivalent) then return the null string.
|
||||
*/
|
||||
if ('/'==*s) {
|
||||
if (size_p) *size_p = 0;
|
||||
return s + HDstrlen(s); /*null terminator*/
|
||||
}
|
||||
|
||||
if (size_p) *size_p = HDstrcspn (s, "/");
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_namei
|
||||
@ -476,7 +425,7 @@ H5G_namei (H5F_t *f, H5G_entry_t *cwg, const char *name,
|
||||
H5F_addr_undef (&(grp_ent->header));
|
||||
}
|
||||
|
||||
FUNC_ENTER (H5G_namei, NULL, NULL);
|
||||
FUNC_ENTER (H5G_namei, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -619,7 +568,7 @@ H5G_mkroot (H5F_t *f, size_t size_hint)
|
||||
H5G_entry_t *ent_ptr=NULL; /*pointer to a symbol table entry*/
|
||||
const char *obj_name=NULL; /*name of old root object */
|
||||
|
||||
FUNC_ENTER (H5G_mkroot, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_mkroot, FAIL);
|
||||
|
||||
/*
|
||||
* Make sure that the file descriptor has the latest info -- someone might
|
||||
@ -657,7 +606,7 @@ H5G_mkroot (H5F_t *f, size_t size_hint)
|
||||
* something goes wrong at this step, closing the `handle' will rewrite
|
||||
* info back into f->root_sym because we set the dirty bit.
|
||||
*/
|
||||
if (H5G_stab_new (f, f->shared->root_sym, size_hint)<0) {
|
||||
if (H5G_stab_create (f, f->shared->root_sym, size_hint)<0) {
|
||||
HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); /*cant create root*/
|
||||
}
|
||||
if (1!=H5O_link (f, f->shared->root_sym, 1)) {
|
||||
@ -753,7 +702,7 @@ H5G_new (H5F_t *f, const char *name, size_t size_hint)
|
||||
size_t nchars; /*number of characters in compon*/
|
||||
herr_t status; /*function return status */
|
||||
|
||||
FUNC_ENTER (H5G_new, NULL, NULL);
|
||||
FUNC_ENTER (H5G_new, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -800,7 +749,7 @@ H5G_new (H5F_t *f, const char *name, size_t size_hint)
|
||||
}
|
||||
|
||||
/* create group */
|
||||
if (H5G_stab_new (f, &ent, size_hint)<0) {
|
||||
if (H5G_stab_create (f, &ent, size_hint)<0) {
|
||||
HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL); /*can't create grp*/
|
||||
}
|
||||
|
||||
@ -851,7 +800,7 @@ H5G_set (H5F_t *f, const char *name)
|
||||
H5O_stab_t stab_mesg;
|
||||
herr_t ret_value=FAIL;
|
||||
|
||||
FUNC_ENTER (H5G_set, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_set, FAIL);
|
||||
|
||||
if (NULL==(handle=H5G_open (f, name))) {
|
||||
/* Can't open group */
|
||||
@ -913,7 +862,7 @@ H5G_getcwg (H5F_t *f)
|
||||
{
|
||||
H5G_entry_t *handle=NULL;
|
||||
|
||||
FUNC_ENTER (H5G_getcwg, NULL, NULL);
|
||||
FUNC_ENTER (H5G_getcwg, NULL);
|
||||
|
||||
if (f->cwg_stack && f->cwg_stack->handle) {
|
||||
handle = f->cwg_stack->handle;
|
||||
@ -955,7 +904,7 @@ H5G_push (H5F_t *f, const char *name)
|
||||
H5O_stab_t stab_mesg;
|
||||
herr_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER (H5G_pushd, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_push, FAIL);
|
||||
|
||||
if (NULL==(handle=H5G_open (f, name))) {
|
||||
/* Can't open group */
|
||||
@ -1009,7 +958,7 @@ H5G_pop (H5F_t *f)
|
||||
{
|
||||
H5G_cwgstk_t *stack=NULL;
|
||||
|
||||
FUNC_ENTER (H5G_pop, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_pop, FAIL);
|
||||
|
||||
if ((stack=f->cwg_stack)) {
|
||||
if (H5G_close (f, stack->handle)<0) {
|
||||
@ -1075,7 +1024,7 @@ H5G_create (H5F_t *f, const char *name, size_t ohdr_hint)
|
||||
size_t nchars; /*number of characters in name */
|
||||
char _comp[1024]; /*name component */
|
||||
|
||||
FUNC_ENTER (H5G_create, NULL, NULL);
|
||||
FUNC_ENTER (H5G_create, NULL);
|
||||
|
||||
/* Check args. */
|
||||
assert (f);
|
||||
@ -1105,7 +1054,7 @@ H5G_create (H5F_t *f, const char *name, size_t ohdr_hint)
|
||||
if (H5F_addr_defined (&(f->shared->root_sym->header))) {
|
||||
HRETURN_ERROR (H5E_SYM, H5E_EXISTS, NULL); /*root exists*/
|
||||
}
|
||||
if (H5O_new (f, 0, ohdr_hint, &(ent.header)/*out*/)<0) {
|
||||
if (H5O_create (f, 0, ohdr_hint, &(ent.header)/*out*/)<0) {
|
||||
/* can't create header */
|
||||
HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL);
|
||||
}
|
||||
@ -1141,7 +1090,7 @@ H5G_create (H5F_t *f, const char *name, size_t ohdr_hint)
|
||||
/*
|
||||
* Create the object header.
|
||||
*/
|
||||
if (H5O_new (f, 0, ohdr_hint, &(ent.header)/*out*/)<0) {
|
||||
if (H5O_create (f, 0, ohdr_hint, &(ent.header)/*out*/)<0) {
|
||||
HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, NULL);
|
||||
}
|
||||
|
||||
@ -1238,7 +1187,7 @@ H5G_open (H5F_t *f, const char *name)
|
||||
H5G_entry_t grp;
|
||||
H5G_entry_t *cwg=NULL;
|
||||
|
||||
FUNC_ENTER (H5G_open, NULL, NULL);
|
||||
FUNC_ENTER (H5G_open, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -1287,7 +1236,7 @@ H5G_open (H5F_t *f, const char *name)
|
||||
herr_t
|
||||
H5G_close (H5F_t *f, H5G_entry_t *ent)
|
||||
{
|
||||
FUNC_ENTER (H5G_close, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_close, FAIL);
|
||||
|
||||
assert (f);
|
||||
|
||||
@ -1345,7 +1294,7 @@ H5G_find (H5F_t *f, const char *name,
|
||||
H5G_entry_t *ent_p = NULL;
|
||||
H5G_entry_t *cwg = NULL;
|
||||
|
||||
FUNC_ENTER (H5G_find, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_find, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
|
77
src/H5Gent.c
77
src/H5Gent.c
@ -13,8 +13,8 @@
|
||||
#include <H5MMprivate.h>
|
||||
|
||||
#define PABLO_MASK H5G_ent_mask
|
||||
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -64,7 +64,7 @@ H5G_ent_calloc (void)
|
||||
herr_t
|
||||
H5G_ent_invalidate (H5G_entry_t *ent)
|
||||
{
|
||||
FUNC_ENTER (H5G_ent_invalidate, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_ent_invalidate, FAIL);
|
||||
|
||||
if (ent && H5G_NOTHING_CACHED!=ent->type) {
|
||||
ent->dirty = TRUE;
|
||||
@ -97,7 +97,7 @@ H5G_ent_invalidate (H5G_entry_t *ent)
|
||||
herr_t
|
||||
H5G_ent_addr (H5G_entry_t *ent, haddr_t *addr/*out*/)
|
||||
{
|
||||
FUNC_ENTER (H5G_ent_addr, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_ent_addr, FAIL);
|
||||
|
||||
assert (ent);
|
||||
*addr = ent->header;
|
||||
@ -128,7 +128,7 @@ H5G_ent_addr (H5G_entry_t *ent, haddr_t *addr/*out*/)
|
||||
H5G_cache_t *
|
||||
H5G_ent_cache (H5G_entry_t *ent, H5G_type_t *cache_type)
|
||||
{
|
||||
FUNC_ENTER (H5G_ent_cache, NULL, NULL);
|
||||
FUNC_ENTER (H5G_ent_cache, NULL);
|
||||
if (!ent) {
|
||||
HRETURN_ERROR (H5E_SYM, H5E_BADVALUE, NULL);
|
||||
}
|
||||
@ -162,7 +162,7 @@ H5G_ent_cache (H5G_entry_t *ent, H5G_type_t *cache_type)
|
||||
herr_t
|
||||
H5G_ent_modified (H5G_entry_t *ent, H5G_type_t cache_type)
|
||||
{
|
||||
FUNC_ENTER (H5G_ent_modified, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_ent_modified, FAIL);
|
||||
assert (ent);
|
||||
if (H5G_NO_CHANGE!=ent->type) ent->type = cache_type;
|
||||
ent->dirty = TRUE;
|
||||
@ -197,7 +197,7 @@ H5G_ent_decode_vec (H5F_t *f, const uint8 **pp, H5G_entry_t *ent, intn n)
|
||||
{
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER (H5G_ent_decode_vec, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_ent_decode_vec, FAIL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
@ -241,7 +241,7 @@ H5G_ent_decode (H5F_t *f, const uint8 **pp, H5G_entry_t *ent)
|
||||
{
|
||||
const uint8 *p_ret = *pp;
|
||||
|
||||
FUNC_ENTER (H5G_ent_decode, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_ent_decode, FAIL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
@ -258,20 +258,17 @@ H5G_ent_decode (H5F_t *f, const uint8 **pp, H5G_entry_t *ent)
|
||||
case H5G_NOTHING_CACHED:
|
||||
break;
|
||||
|
||||
case H5G_CACHED_SDATA:
|
||||
assert (1+1+2+(5*4) <= H5G_SIZEOF_SCRATCH);
|
||||
ent->cache.sdata.nt.length= *(*pp)++;
|
||||
ent->cache.sdata.nt.arch= *(*pp)++;
|
||||
UINT16DECODE (*pp, ent->cache.sdata.nt.type);
|
||||
UINT32DECODE (*pp, ent->cache.sdata.ndim);
|
||||
UINT32DECODE (*pp, ent->cache.sdata.dim[0]);
|
||||
UINT32DECODE (*pp, ent->cache.sdata.dim[1]);
|
||||
UINT32DECODE (*pp, ent->cache.sdata.dim[2]);
|
||||
UINT32DECODE (*pp, ent->cache.sdata.dim[3]);
|
||||
case H5G_CACHED_SDSPACE:
|
||||
assert (5*4 <= H5G_SIZEOF_SCRATCH);
|
||||
UINT32DECODE (*pp, ent->cache.sdspace.ndim);
|
||||
UINT32DECODE (*pp, ent->cache.sdspace.dim[0]);
|
||||
UINT32DECODE (*pp, ent->cache.sdspace.dim[1]);
|
||||
UINT32DECODE (*pp, ent->cache.sdspace.dim[2]);
|
||||
UINT32DECODE (*pp, ent->cache.sdspace.dim[3]);
|
||||
break;
|
||||
|
||||
case H5G_CACHED_STAB:
|
||||
assert (2*H5F_SIZEOF_OFFSET (f) <= H5G_SIZEOF_SCRATCH);
|
||||
assert (2*H5F_SIZEOF_ADDR (f) <= H5G_SIZEOF_SCRATCH);
|
||||
H5F_addr_decode (f, pp, &(ent->cache.stab.btree_addr));
|
||||
H5F_addr_decode (f, pp, &(ent->cache.stab.heap_addr));
|
||||
break;
|
||||
@ -312,7 +309,7 @@ H5G_ent_encode_vec (H5F_t *f, uint8 **pp, H5G_entry_t *ent, intn n)
|
||||
{
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER (H5G_ent_encode_vec, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_ent_encode_vec, FAIL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
@ -362,7 +359,7 @@ H5G_ent_encode (H5F_t *f, uint8 **pp, H5G_entry_t *ent)
|
||||
{
|
||||
uint8 *p_ret = *pp + H5G_SIZEOF_ENTRY(f);
|
||||
|
||||
FUNC_ENTER (H5G_ent_encode, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_ent_encode, FAIL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
@ -379,20 +376,17 @@ H5G_ent_encode (H5F_t *f, uint8 **pp, H5G_entry_t *ent)
|
||||
case H5G_NOTHING_CACHED:
|
||||
break;
|
||||
|
||||
case H5G_CACHED_SDATA:
|
||||
assert (1+1+2+(5*4) <= H5G_SIZEOF_SCRATCH);
|
||||
*(*pp)++= ent->cache.sdata.nt.length;
|
||||
*(*pp)++= ent->cache.sdata.nt.arch;
|
||||
UINT16ENCODE (*pp, ent->cache.sdata.nt.type);
|
||||
UINT32ENCODE (*pp, ent->cache.sdata.ndim);
|
||||
UINT32ENCODE (*pp, ent->cache.sdata.dim[0]);
|
||||
UINT32ENCODE (*pp, ent->cache.sdata.dim[1]);
|
||||
UINT32ENCODE (*pp, ent->cache.sdata.dim[2]);
|
||||
UINT32ENCODE (*pp, ent->cache.sdata.dim[3]);
|
||||
case H5G_CACHED_SDSPACE:
|
||||
assert (5*4 <= H5G_SIZEOF_SCRATCH);
|
||||
UINT32ENCODE (*pp, ent->cache.sdspace.ndim);
|
||||
UINT32ENCODE (*pp, ent->cache.sdspace.dim[0]);
|
||||
UINT32ENCODE (*pp, ent->cache.sdspace.dim[1]);
|
||||
UINT32ENCODE (*pp, ent->cache.sdspace.dim[2]);
|
||||
UINT32ENCODE (*pp, ent->cache.sdspace.dim[3]);
|
||||
break;
|
||||
|
||||
case H5G_CACHED_STAB:
|
||||
assert (2*H5F_SIZEOF_OFFSET (f) <= H5G_SIZEOF_SCRATCH);
|
||||
assert (2*H5F_SIZEOF_ADDR (f) <= H5G_SIZEOF_SCRATCH);
|
||||
H5F_addr_encode (f, pp, &(ent->cache.stab.btree_addr));
|
||||
H5F_addr_encode (f, pp, &(ent->cache.stab.heap_addr));
|
||||
break;
|
||||
@ -435,7 +429,7 @@ H5G_ent_debug (H5F_t *f, H5G_entry_t *ent, FILE *stream, intn indent,
|
||||
int i;
|
||||
char buf[64];
|
||||
|
||||
FUNC_ENTER (H5G_ent_debug, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_ent_debug, FAIL);
|
||||
|
||||
fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth,
|
||||
"Name offset into private heap:",
|
||||
@ -461,25 +455,16 @@ H5G_ent_debug (H5F_t *f, H5G_entry_t *ent, FILE *stream, intn indent,
|
||||
fprintf (stream, "Nothing Cached\n");
|
||||
break;
|
||||
|
||||
case H5G_CACHED_SDATA:
|
||||
fprintf (stream, "S-data\n");
|
||||
fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
"Number type length:",
|
||||
(unsigned)(ent->cache.sdata.nt.length));
|
||||
fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
"Number type architecture:",
|
||||
(unsigned)(ent->cache.sdata.nt.arch));
|
||||
fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
"Number type type:",
|
||||
(unsigned)(ent->cache.sdata.nt.type));
|
||||
case H5G_CACHED_SDSPACE:
|
||||
fprintf (stream, "Simple data space\n");
|
||||
fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
"Dimensionality:",
|
||||
(unsigned)(ent->cache.sdata.ndim));
|
||||
for (i=0; i<ent->cache.sdata.ndim && i<4; i++) {
|
||||
(unsigned)(ent->cache.sdspace.ndim));
|
||||
for (i=0; i<ent->cache.sdspace.ndim && i<4; i++) {
|
||||
sprintf (buf, "Dimension %d", i);
|
||||
fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
buf,
|
||||
(unsigned)(ent->cache.sdata.dim[i]));
|
||||
(unsigned)(ent->cache.sdspace.dim[i]));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -44,8 +44,9 @@ static herr_t H5G_node_decode_key (H5F_t *f, H5B_t *bt, uint8 *raw,
|
||||
static herr_t H5G_node_encode_key (H5F_t *f, H5B_t *bt, uint8 *raw,
|
||||
void *_key);
|
||||
static size_t H5G_node_size (H5F_t *f);
|
||||
static herr_t H5G_node_new (H5F_t *f, H5B_ins_t op, void *_lt_key,
|
||||
void *_udata, void *_rt_key, haddr_t *addr/*out*/);
|
||||
static herr_t H5G_node_create (H5F_t *f, H5B_ins_t op, void *_lt_key,
|
||||
void *_udata, void *_rt_key,
|
||||
haddr_t *addr/*out*/);
|
||||
static herr_t H5G_node_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr,
|
||||
H5G_node_t *sym);
|
||||
static H5G_node_t *H5G_node_load (H5F_t *f, const haddr_t *addr,
|
||||
@ -77,7 +78,7 @@ H5B_class_t H5B_SNODE[1] = {{
|
||||
H5B_SNODE_ID, /*id */
|
||||
sizeof (H5G_node_key_t), /*sizeof_nkey */
|
||||
H5G_node_sizeof_rkey, /*get_sizeof_rkey */
|
||||
H5G_node_new, /*new */
|
||||
H5G_node_create, /*new */
|
||||
H5G_node_cmp2, /*cmp2 */
|
||||
H5G_node_cmp3, /*cmp3 */
|
||||
H5G_node_found, /*found */
|
||||
@ -89,8 +90,9 @@ H5B_class_t H5B_SNODE[1] = {{
|
||||
H5G_node_encode_key, /*encode */
|
||||
}};
|
||||
|
||||
/* Has the interface been initialized? */
|
||||
/* Interface initialization */
|
||||
static intn interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -140,7 +142,7 @@ H5G_node_decode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
|
||||
{
|
||||
H5G_node_key_t *key = (H5G_node_key_t *)_key;
|
||||
|
||||
FUNC_ENTER (H5G_node_decode_key, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_node_decode_key, FAIL);
|
||||
|
||||
assert (f);
|
||||
assert (raw);
|
||||
@ -174,7 +176,7 @@ H5G_node_encode_key (H5F_t *f, H5B_t *bt, uint8 *raw, void *_key)
|
||||
{
|
||||
H5G_node_key_t *key = (H5G_node_key_t *)_key;
|
||||
|
||||
FUNC_ENTER (H5G_node_encode_key, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_node_encode_key, FAIL);
|
||||
|
||||
assert (f);
|
||||
assert (raw);
|
||||
@ -212,7 +214,7 @@ H5G_node_size (H5F_t *f)
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_node_new
|
||||
* Function: H5G_node_create
|
||||
*
|
||||
* Purpose: Creates a new empty symbol table. This function is called
|
||||
* by the B-tree insert function for an empty tree. It is
|
||||
@ -233,16 +235,16 @@ H5G_node_size (H5F_t *f)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5G_node_new (H5F_t *f, H5B_ins_t op,
|
||||
void *_lt_key, void *_udata, void *_rt_key,
|
||||
haddr_t *addr/*out*/)
|
||||
H5G_node_create (H5F_t *f, H5B_ins_t op,
|
||||
void *_lt_key, void *_udata, void *_rt_key,
|
||||
haddr_t *addr/*out*/)
|
||||
{
|
||||
H5G_node_key_t *lt_key = (H5G_node_key_t*)_lt_key;
|
||||
H5G_node_key_t *rt_key = (H5G_node_key_t*)_rt_key;
|
||||
H5G_node_t *sym = NULL;
|
||||
size_t size = 0;
|
||||
|
||||
FUNC_ENTER (H5G_node_new, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_node_create, FAIL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -307,7 +309,7 @@ H5G_node_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr,
|
||||
herr_t status;
|
||||
int i;
|
||||
|
||||
FUNC_ENTER (H5G_node_flush, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_node_flush, FAIL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -402,7 +404,7 @@ H5G_node_load (H5F_t *f, const haddr_t *addr, const void *_udata1,
|
||||
const H5G_ac_ud1_t *ac_udata = (const H5G_ac_ud1_t*)_udata1;
|
||||
H5G_node_t *ret_value = NULL; /*for error handling*/
|
||||
|
||||
FUNC_ENTER (H5G_node_load, NULL, NULL);
|
||||
FUNC_ENTER (H5G_node_load, NULL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -447,8 +449,13 @@ H5G_node_load (H5F_t *f, const haddr_t *addr, const void *_udata1,
|
||||
}
|
||||
buf = H5MM_xfree (buf);
|
||||
|
||||
/* shadows */
|
||||
if (H5G_shadow_assoc_node (f, sym, ac_udata)<0) {
|
||||
/*
|
||||
* shadows. If we are running this under the debugger, then the grp_addr
|
||||
* field of ac_udata might be undefined. If that's the case, then we
|
||||
* don't try to associate any shadows with this symbol table node.
|
||||
*/
|
||||
if (H5F_addr_defined (&(ac_udata->grp_addr)) &&
|
||||
H5G_shadow_assoc_node (f, sym, ac_udata)<0) {
|
||||
HGOTO_ERROR (H5E_SYM, H5E_CANTLOAD, NULL);
|
||||
}
|
||||
|
||||
@ -499,7 +506,7 @@ H5G_node_cmp2 (H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
|
||||
const char *s1, *s2;
|
||||
intn cmp;
|
||||
|
||||
FUNC_ENTER (H5G_node_cmp2, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_node_cmp2, FAIL);
|
||||
|
||||
assert (udata);
|
||||
assert (lt_key);
|
||||
@ -553,7 +560,7 @@ H5G_node_cmp3 (H5F_t *f, void *_lt_key, void *_udata, void *_rt_key)
|
||||
H5G_node_key_t *rt_key = (H5G_node_key_t *)_rt_key;
|
||||
const char *s;
|
||||
|
||||
FUNC_ENTER (H5G_node_cmp3, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_node_cmp3, FAIL);
|
||||
|
||||
/* left side */
|
||||
if (NULL==(s=H5H_peek (f, &(udata->heap_addr), lt_key->offset))) {
|
||||
@ -610,7 +617,7 @@ H5G_node_found (H5F_t *f, const haddr_t *addr, const void *_lt_key,
|
||||
const char *s;
|
||||
herr_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER (H5G_node_found, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_node_found, FAIL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -746,7 +753,7 @@ H5G_node_insert (H5F_t *f, const haddr_t *addr,
|
||||
H5G_node_t *insert_into=NULL; /*node that gets new entry*/
|
||||
haddr_t insert_addr; /*address of that node */
|
||||
|
||||
FUNC_ENTER (H5G_node_insert, NULL, H5B_INS_ERROR);
|
||||
FUNC_ENTER (H5G_node_insert, H5B_INS_ERROR);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -813,8 +820,8 @@ H5G_node_insert (H5F_t *f, const haddr_t *addr,
|
||||
ret_value = H5B_INS_RIGHT;
|
||||
|
||||
/* The right node */
|
||||
if (H5G_node_new (f, H5B_INS_FIRST, NULL, NULL, NULL,
|
||||
new_node/*out*/)<0) {
|
||||
if (H5G_node_create (f, H5B_INS_FIRST, NULL, NULL, NULL,
|
||||
new_node/*out*/)<0) {
|
||||
HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR);
|
||||
}
|
||||
if (NULL==(snrt=H5AC_find (f, H5AC_SNODE, new_node, &ac_udata, NULL))) {
|
||||
@ -944,7 +951,7 @@ H5G_node_list (H5F_t *f, const haddr_t *addr, void *_udata)
|
||||
herr_t ret_value = FAIL;
|
||||
H5G_ac_ud1_t ac_udata;
|
||||
|
||||
FUNC_ENTER (H5G_node_list, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_node_list, FAIL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -1030,7 +1037,7 @@ H5G_node_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
|
||||
const char *s;
|
||||
H5G_ac_ud1_t ac_udata;
|
||||
|
||||
FUNC_ENTER (H5G_node_debug, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_node_debug, FAIL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -1045,7 +1052,7 @@ H5G_node_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
|
||||
* We have absolutely no idea where the object header for the symbol table
|
||||
* to which this node belongs is located. In fact, if the file is corrupt,
|
||||
* there may not even be an object header for that symbol table. So we
|
||||
* supply `-1' as the group address which causes no open objects to be
|
||||
* supply UNDEF as the group address which causes no open objects to be
|
||||
* associated with the node. For that reason, we flush this node from the
|
||||
* cache when we're done so if some later caller knows the header address
|
||||
* they'll be able to access the open objects.
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#define H5G_NODE_VERS 1 /*symbol table node version number */
|
||||
#define H5G_SIZE_HINT 1024 /*default root grp size hint */
|
||||
#define H5G_NODE_K(F) ((F)->shared->file_create_parms.sym_leaf_k)
|
||||
#define H5G_NODE_K(F) ((F)->shared->create_parms.sym_leaf_k)
|
||||
#define H5G_NODE_SIZEOF_HDR(F) (H5G_NODE_SIZEOF_MAGIC + 4)
|
||||
#define H5G_DEFAULT_ROOT_SIZE 32
|
||||
|
||||
@ -158,7 +158,7 @@ extern const H5AC_class_t H5AC_SNODE[1];
|
||||
* functions that understand names are exported to the rest of
|
||||
* the library and appear in H5Gprivate.h.
|
||||
*/
|
||||
herr_t H5G_stab_new (H5F_t *f, H5G_entry_t *self, size_t init);
|
||||
herr_t H5G_stab_create (H5F_t *f, H5G_entry_t *self, size_t init);
|
||||
H5G_entry_t *H5G_stab_find (H5F_t *f, const haddr_t *addr, H5G_entry_t *self,
|
||||
const char *name);
|
||||
H5G_entry_t *H5G_stab_insert (H5F_t *f, H5G_entry_t *self,
|
||||
|
@ -45,7 +45,7 @@
|
||||
#define H5G_SIZEOF_SCRATCH 24
|
||||
#define H5G_SIZEOF_ENTRY(F) \
|
||||
(H5F_SIZEOF_SIZE(F) + /*offset of name into heap */ \
|
||||
H5F_SIZEOF_OFFSET(F) + /*address of object header */ \
|
||||
H5F_SIZEOF_ADDR(F) + /*address of object header */ \
|
||||
4 + /*entry type */ \
|
||||
H5G_SIZEOF_SCRATCH) /*scratch pad space */
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
*/
|
||||
typedef enum H5G_type_t {
|
||||
H5G_NOTHING_CACHED =0, /*nothing is cached, must be 0 */
|
||||
H5G_CACHED_SDATA =1, /*simple dataset, `sdata' */
|
||||
H5G_CACHED_SDSPACE =1, /*simple data space */
|
||||
H5G_CACHED_STAB =2 /*symbol table, `stab' */
|
||||
} H5G_type_t;
|
||||
|
||||
@ -67,14 +67,9 @@ typedef enum H5G_type_t {
|
||||
*/
|
||||
typedef union H5G_cache_t {
|
||||
struct {
|
||||
struct {
|
||||
uint8 length;
|
||||
uint8 arch;
|
||||
uint16 type;
|
||||
} nt ; /*number type */
|
||||
uint32 ndim; /*number of dimensions */
|
||||
uint32 dim[4]; /*dimension sizes */
|
||||
} sdata;
|
||||
} sdspace;
|
||||
|
||||
struct {
|
||||
haddr_t btree_addr; /*file address of symbol table B-tree */
|
||||
|
@ -16,8 +16,9 @@
|
||||
|
||||
#define PABLO_MASK H5G_shadow_mask
|
||||
|
||||
/* Is the interface initialized? */
|
||||
/* Interface initialization */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
typedef struct H5G_hash_t {
|
||||
haddr_t grp_addr;
|
||||
@ -111,7 +112,7 @@ H5G_shadow_check (H5F_t *f)
|
||||
fprintf (stderr, "), ");
|
||||
shadow_error = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* Linked to symbol table entry */
|
||||
if (shadow->main && shadow!=shadow->main->shadow) {
|
||||
fprintf (stderr, "entry linkage problem, ");
|
||||
@ -167,7 +168,7 @@ H5G_shadow_p (H5G_entry_t *ent)
|
||||
size_t delta = (char*)&(tmp.entry) - (char*)&tmp;
|
||||
hbool_t ret_value = FALSE;
|
||||
|
||||
FUNC_ENTER (H5G_shadow_p, NULL, FALSE);
|
||||
FUNC_ENTER (H5G_shadow_p, FALSE);
|
||||
|
||||
if (!ent || !ent->shadow) return FALSE;
|
||||
ret_value = ((char*)ent - (char*)(ent->shadow) == delta);
|
||||
@ -197,7 +198,7 @@ H5G_shadow_p (H5G_entry_t *ent)
|
||||
herr_t
|
||||
H5G_shadow_dissociate (H5G_entry_t *ent)
|
||||
{
|
||||
FUNC_ENTER (H5G_shadow_dissociate, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_shadow_dissociate, FAIL);
|
||||
|
||||
if (H5G_shadow_p (ent)) {
|
||||
if (ent->shadow->main) {
|
||||
@ -239,7 +240,7 @@ herr_t
|
||||
H5G_shadow_sync (H5G_entry_t *ent)
|
||||
{
|
||||
H5G_shadow_t *shadow = NULL;
|
||||
FUNC_ENTER (H5G_shadow_sync, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_shadow_sync, FAIL);
|
||||
|
||||
/*
|
||||
* If the caller supplied us with a shadow instead of the main entry, then
|
||||
@ -287,7 +288,7 @@ H5G_shadow_list (H5F_t *f, const haddr_t *grp_addr)
|
||||
uintn idx = H5F_addr_hash (grp_addr, f->shared->nshadows);
|
||||
H5G_hash_t *bucket = NULL;
|
||||
|
||||
FUNC_ENTER (H5G_shadows, NULL, NULL);
|
||||
FUNC_ENTER (H5G_shadows, NULL);
|
||||
|
||||
for (bucket=f->shared->shadow[idx]; bucket; bucket=bucket->next) {
|
||||
if (0==idx &&
|
||||
@ -331,7 +332,7 @@ H5G_shadow_assoc_node (H5F_t *f, H5G_node_t *sym, const H5G_ac_ud1_t *ac_udata)
|
||||
intn i = 0;
|
||||
haddr_t heap_addr;
|
||||
|
||||
FUNC_ENTER (H5G_shadow_assoc_node, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_shadow_assoc_node, FAIL);
|
||||
|
||||
/* Check arguments */
|
||||
assert (f); /* The file */
|
||||
@ -405,7 +406,7 @@ H5G_shadow_open (H5F_t *f, H5G_entry_t *grp, H5G_entry_t *ent)
|
||||
H5G_entry_t *ret_value = NULL;
|
||||
haddr_t grp_header;
|
||||
|
||||
FUNC_ENTER (H5G_shadow_open, NULL, NULL);
|
||||
FUNC_ENTER (H5G_shadow_open, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -563,7 +564,7 @@ H5G_shadow_close (H5F_t *f, H5G_entry_t *ent)
|
||||
H5G_hash_t *hash=NULL;
|
||||
H5G_shadow_t *hash_ent=NULL, *shadow=NULL;
|
||||
|
||||
FUNC_ENTER (H5G_shadow_close, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_shadow_close, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (ent);
|
||||
@ -662,7 +663,7 @@ H5G_shadow_move (H5F_t *f, H5G_shadow_t *shadow, const char *new_name,
|
||||
H5G_hash_t *hash;
|
||||
uintn idx;
|
||||
|
||||
FUNC_ENTER (H5G_shadow_move, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_shadow_move, FAIL);
|
||||
|
||||
assert (shadow);
|
||||
assert (new_entry);
|
||||
@ -735,7 +736,7 @@ H5G_shadow_flush (H5F_t *f, hbool_t invalidate)
|
||||
H5G_shadow_t *shadow = NULL;
|
||||
intn nfound=0;
|
||||
|
||||
FUNC_ENTER (H5G_shadow_flush, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_shadow_flush, FAIL);
|
||||
|
||||
for (idx=0; idx<f->shared->nshadows; idx++) {
|
||||
for (hash=f->shared->shadow[idx]; hash; hash=hash->next) {
|
||||
|
@ -18,10 +18,11 @@
|
||||
|
||||
#define PABLO_MASK H5G_stab_mask
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_stab_new
|
||||
* Function: H5G_stab_create
|
||||
*
|
||||
* Purpose: Creates a new empty symbol table (object header, name heap,
|
||||
* and B-tree). The caller can specify an initial size for the
|
||||
@ -54,13 +55,13 @@ static hbool_t interface_initialize_g = FALSE;
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5G_stab_new (H5F_t *f, H5G_entry_t *self, size_t init)
|
||||
H5G_stab_create (H5F_t *f, H5G_entry_t *self, size_t init)
|
||||
{
|
||||
size_t name; /*offset of "" name */
|
||||
haddr_t addr; /*object header address */
|
||||
H5O_stab_t stab; /*symbol table message */
|
||||
|
||||
FUNC_ENTER (H5G_stab_new, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_stab_create, FAIL);
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
@ -70,7 +71,7 @@ H5G_stab_new (H5F_t *f, H5G_entry_t *self, size_t init)
|
||||
init = MAX(init, H5H_SIZEOF_FREE(f)+2);
|
||||
|
||||
/* Create symbol table private heap */
|
||||
if (H5H_new (f, H5H_LOCAL, init, &(stab.heap_addr)/*out*/)<0) {
|
||||
if (H5H_create (f, H5H_LOCAL, init, &(stab.heap_addr)/*out*/)<0) {
|
||||
HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); /*can't create heap*/
|
||||
}
|
||||
if ((name = H5H_insert (f, &(stab.heap_addr), 1, "")<0)) {
|
||||
@ -85,7 +86,7 @@ H5G_stab_new (H5F_t *f, H5G_entry_t *self, size_t init)
|
||||
}
|
||||
|
||||
/* Create the B-tree */
|
||||
if (H5B_new (f, H5B_SNODE, NULL, &(stab.btree_addr)/*out*/)<0) {
|
||||
if (H5B_create (f, H5B_SNODE, NULL, &(stab.btree_addr)/*out*/)<0) {
|
||||
HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); /*can't create B-tree*/
|
||||
}
|
||||
|
||||
@ -94,7 +95,7 @@ H5G_stab_new (H5F_t *f, H5G_entry_t *self, size_t init)
|
||||
* since nothing refers to it yet. The link count will be
|
||||
* incremented if the object is added to the group directed graph.
|
||||
*/
|
||||
if (H5O_new (f, 0, 4+2*H5F_SIZEOF_OFFSET(f), &addr/*out*/)<0) {
|
||||
if (H5O_create (f, 0, 4+2*H5F_SIZEOF_ADDR(f), &addr/*out*/)<0) {
|
||||
HRETURN_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); /*can't create header*/
|
||||
}
|
||||
|
||||
@ -146,7 +147,7 @@ H5G_stab_find (H5F_t *f, const haddr_t *addr, H5G_entry_t *self,
|
||||
H5G_bt_ud1_t udata; /*data to pass through B-tree */
|
||||
H5O_stab_t stab; /*symbol table message */
|
||||
|
||||
FUNC_ENTER (H5G_stab_find, NULL, NULL);
|
||||
FUNC_ENTER (H5G_stab_find, NULL);
|
||||
|
||||
/* Check arguments */
|
||||
assert (f);
|
||||
@ -227,7 +228,7 @@ H5G_stab_insert (H5F_t *f, H5G_entry_t *self, const char *name,
|
||||
H5O_stab_t stab; /*symbol table message */
|
||||
H5G_bt_ud1_t udata; /*data to pass through B-tree */
|
||||
|
||||
FUNC_ENTER (H5G_stab_insert, NULL, NULL);
|
||||
FUNC_ENTER (H5G_stab_insert, NULL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
@ -311,7 +312,7 @@ H5G_stab_list (H5F_t *f, H5G_entry_t *self, intn maxentries,
|
||||
H5O_stab_t stab;
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER (H5G_stab_list, NULL, FAIL);
|
||||
FUNC_ENTER (H5G_stab_list, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
|
29
src/H5H.c
29
src/H5H.c
@ -59,12 +59,13 @@ static const H5AC_class_t H5AC_HEAP[1] = {{
|
||||
(herr_t(*)(H5F_t*,hbool_t,const haddr_t*,void*))H5H_flush,
|
||||
}};
|
||||
|
||||
/* Is the interface initialized? */
|
||||
/* Interface initialization */
|
||||
static intn interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5H_new
|
||||
* Function: H5H_create
|
||||
*
|
||||
* Purpose: Creates a new heap data structure on disk and caches it
|
||||
* in memory. SIZE_HINT is a hint for the initial size of the
|
||||
@ -91,20 +92,20 @@ static intn interface_initialize_g = FALSE;
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5H_new (H5F_t *f, H5H_type_t heap_type, size_t size_hint,
|
||||
haddr_t *addr/*out*/)
|
||||
H5H_create (H5F_t *f, H5H_type_t heap_type, size_t size_hint,
|
||||
haddr_t *addr/*out*/)
|
||||
{
|
||||
H5H_t *heap = NULL;
|
||||
size_t total_size; /*total heap size on disk */
|
||||
|
||||
FUNC_ENTER (H5H_new, NULL, FAIL);
|
||||
FUNC_ENTER (H5H_create, FAIL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
assert (addr);
|
||||
if (H5H_GLOBAL==heap_type) {
|
||||
#ifndef NDEBUG
|
||||
fprintf (stderr, "H5H_new: a local heap is used as the global heap\n");
|
||||
fprintf (stderr, "H5H_create: a local heap is used as the global heap\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -176,7 +177,7 @@ H5H_load (H5F_t *f, const haddr_t *addr, const void *udata1, void *udata2)
|
||||
size_t free_block=H5H_FREE_NULL;
|
||||
H5H_t *ret_value=NULL;
|
||||
|
||||
FUNC_ENTER (H5H_load, NULL, NULL);
|
||||
FUNC_ENTER (H5H_load, NULL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
@ -279,7 +280,7 @@ H5H_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5H_t *heap)
|
||||
H5H_free_t *fl = heap->freelist;
|
||||
haddr_t hdr_end_addr;
|
||||
|
||||
FUNC_ENTER (H5H_flush, NULL, FAIL);
|
||||
FUNC_ENTER (H5H_flush, FAIL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
@ -401,7 +402,7 @@ H5H_read (H5F_t *f, const haddr_t *addr, size_t offset, size_t size, void *buf)
|
||||
{
|
||||
H5H_t *heap = NULL;
|
||||
|
||||
FUNC_ENTER (H5H_read, NULL, NULL);
|
||||
FUNC_ENTER (H5H_read, NULL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
@ -461,7 +462,7 @@ H5H_peek (H5F_t *f, const haddr_t *addr, size_t offset)
|
||||
H5H_t *heap = NULL;
|
||||
const void *retval = NULL;
|
||||
|
||||
FUNC_ENTER (H5H_peek, NULL, NULL);
|
||||
FUNC_ENTER (H5H_peek, NULL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
@ -538,7 +539,7 @@ H5H_insert (H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf)
|
||||
static nmessages = 0;
|
||||
#endif
|
||||
|
||||
FUNC_ENTER (H5H_insert, NULL, FAIL);
|
||||
FUNC_ENTER (H5H_insert, FAIL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
@ -693,7 +694,7 @@ H5H_write (H5F_t *f, const haddr_t *addr, size_t offset, size_t size,
|
||||
{
|
||||
H5H_t *heap = NULL;
|
||||
|
||||
FUNC_ENTER (H5H_write, NULL, FAIL);
|
||||
FUNC_ENTER (H5H_write, FAIL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
@ -755,7 +756,7 @@ H5H_remove (H5F_t *f, const haddr_t *addr, size_t offset, size_t size)
|
||||
static int nmessages = 0;
|
||||
#endif
|
||||
|
||||
FUNC_ENTER (H5H_remove, NULL, FAIL);
|
||||
FUNC_ENTER (H5H_remove, FAIL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
@ -870,7 +871,7 @@ H5H_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent, intn fwidth
|
||||
uint8 *marker = NULL;
|
||||
size_t amount_free = 0;
|
||||
|
||||
FUNC_ENTER (H5H_debug, NULL, FAIL);
|
||||
FUNC_ENTER (H5H_debug, FAIL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
|
@ -29,7 +29,7 @@
|
||||
(H5H_SIZEOF_MAGIC + /*heap signature */ \
|
||||
H5F_SIZEOF_SIZE (F) + /*data size */ \
|
||||
H5F_SIZEOF_SIZE (F) + /*free list head */ \
|
||||
H5F_SIZEOF_OFFSET (F)) /*data address */
|
||||
H5F_SIZEOF_ADDR (F)) /*data address */
|
||||
|
||||
#define H5H_SIZEOF_FREE(F) \
|
||||
(H5F_SIZEOF_SIZE (F) + /*ptr to next free block */ \
|
||||
@ -44,8 +44,8 @@ typedef enum H5H_type_t {
|
||||
/*
|
||||
* Library prototypes...
|
||||
*/
|
||||
herr_t H5H_new (H5F_t *f, H5H_type_t type, size_t size_hint,
|
||||
haddr_t *addr/*out*/);
|
||||
herr_t H5H_create (H5F_t *f, H5H_type_t type, size_t size_hint,
|
||||
haddr_t *addr/*out*/);
|
||||
void *H5H_read (H5F_t *f, const haddr_t *addr, size_t offset, size_t size,
|
||||
void *buf);
|
||||
const void *H5H_peek (H5F_t *f, const haddr_t *addr, size_t offset);
|
||||
|
508
src/H5M.c
508
src/H5M.c
@ -1,13 +1,13 @@
|
||||
/****************************************************************************
|
||||
* 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. *
|
||||
* *
|
||||
* NCSA HDF *
|
||||
* Software Development Group *
|
||||
* National Center for Supercomputing Applications *
|
||||
* University of Illinois at Urbana-Champaign *
|
||||
* 605 E. Springfield, Champaign IL 61820 *
|
||||
* *
|
||||
* For conditions of distribution and use, see the accompanying *
|
||||
* hdf/COPYING file. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef RCSID
|
||||
@ -23,20 +23,19 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
HDF5 "Meta-Object" routines
|
||||
|
||||
EXPORTED ROUTINES
|
||||
H5Mcreate -- Create an object
|
||||
H5Maccess -- Start access to an existing object
|
||||
H5Mcopy -- Copy an object
|
||||
H5Mfind_name -- Find an object by name
|
||||
H5Mcopy -- Copy an object
|
||||
H5Mopen -- Find an object by name
|
||||
H5Mname_len -- Get the length of an object's name
|
||||
H5Mget_name -- Get an object's name
|
||||
H5Mset_name -- Set an object's name
|
||||
H5Msearch -- Wildcard search for an object by name
|
||||
H5Mindex -- Get an object by index
|
||||
H5Mflush -- Flush an object out to disk
|
||||
H5Mindex -- Get an object by index
|
||||
H5Mflush -- Flush an object out to disk
|
||||
H5Mdelete -- Delete an object from disk
|
||||
H5Mget_file -- Get the file ID for an object
|
||||
H5Mget_file -- Get the parent ID for an object
|
||||
H5Mrelease -- Release access to an object
|
||||
H5Mclose -- Release access to an object
|
||||
|
||||
LIBRARY-SCOPED ROUTINES
|
||||
|
||||
@ -44,94 +43,93 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
H5M_init_interface -- initialize the interface
|
||||
+ */
|
||||
|
||||
#include <H5private.h> /* Generic functions */
|
||||
#include <H5Cprivate.h> /* Template interface */
|
||||
#include <H5private.h> /* Generic functions */
|
||||
#include <H5Cprivate.h> /* Template interface */
|
||||
#include <H5Dprivate.h> /* Dataset interface */
|
||||
#include <H5Eprivate.h> /*error handling */
|
||||
#include <H5Eprivate.h> /*error handling */
|
||||
#include <H5Pprivate.h> /* Dataspace functions */
|
||||
#include <H5Tprivate.h> /* Datatype interface */
|
||||
#include <H5Tprivate.h> /* Datatype interface */
|
||||
#include <H5Mprivate.h> /* Meta-object interface */
|
||||
#include <H5Cprivate.h> /* Template interface */
|
||||
#include <H5Cprivate.h> /* Template interface */
|
||||
|
||||
#define PABLO_MASK H5M_mask
|
||||
|
||||
/*--------------------- Locally scoped variables -----------------------------*/
|
||||
|
||||
/* Whether we've installed the library termination function yet for this interface */
|
||||
static intn interface_initialize_g = FALSE;
|
||||
|
||||
static meta_func_t meta_func_arr[]={
|
||||
{ /* Template object meta-functions (defined in H5C.c) */
|
||||
H5_TEMPLATE, /* File-Creation Template Type ID */
|
||||
H5C_create, /* File-Creation Template Create */
|
||||
NULL, /* File-Creation Template Access */
|
||||
H5C_copy, /* File-Creation Template Copy */
|
||||
NULL, /* File-Creation Template FindName */
|
||||
NULL, /* File-Creation Template NameLen */
|
||||
NULL, /* File-Creation Template GetName */
|
||||
NULL, /* File-Creation Template SetName */
|
||||
NULL, /* File-Creation Template Search */
|
||||
NULL, /* File-Creation Template Index */
|
||||
NULL, /* File-Creation Template Flush */
|
||||
NULL, /* File-Creation Template Delete */
|
||||
NULL, /* File-Creation Template GetParent */
|
||||
NULL, /* File-Creation Template GetFile */
|
||||
H5C_release /* File-Creation Template Release */
|
||||
{ /* Template object meta-functions (defined in H5C.c) */
|
||||
H5_TEMPLATE_0, /* File-Creation Template Type ID */
|
||||
NULL, /* File-Creation Template Create */
|
||||
NULL, /* File-Creation Template Access */
|
||||
H5Ccopy, /* File-Creation Template Copy */
|
||||
NULL, /* File-Creation Template FindName */
|
||||
NULL, /* File-Creation Template NameLen */
|
||||
NULL, /* File-Creation Template GetName */
|
||||
NULL, /* File-Creation Template SetName */
|
||||
NULL, /* File-Creation Template Search */
|
||||
NULL, /* File-Creation Template Index */
|
||||
NULL, /* File-Creation Template Flush */
|
||||
NULL, /* File-Creation Template Delete */
|
||||
NULL, /* File-Creation Template GetParent */
|
||||
NULL, /* File-Creation Template GetFile */
|
||||
H5Cclose /* File-Creation Template Release */
|
||||
},
|
||||
{ /* Datatype object meta-functions (defined in H5T.c) */
|
||||
H5_DATATYPE, /* Datatype Type ID */
|
||||
H5T_create, /* Datatype Create */
|
||||
NULL, /* Datatype Access */
|
||||
NULL, /* Dataspace Copy */
|
||||
NULL, /* Datatype FindName */
|
||||
NULL, /* Datatype NameLen */
|
||||
NULL, /* Datatype GetName */
|
||||
NULL, /* Datatype SetName */
|
||||
NULL, /* Datatype Search */
|
||||
NULL, /* Datatype Index */
|
||||
NULL, /* Datatype Flush */
|
||||
NULL, /* Datatype Delete */
|
||||
NULL, /* Datatype GetParent */
|
||||
NULL, /* Datatype GetFile */
|
||||
H5T_release /* Datatype Release */
|
||||
{ /* Datatype object meta-functions (defined in H5T.c) */
|
||||
H5_DATATYPE, /* Datatype Type ID */
|
||||
NULL, /* Datatype Create */
|
||||
NULL, /* Datatype Access */
|
||||
H5Tcopy, /* Dataspace Copy */
|
||||
NULL, /* Datatype FindName */
|
||||
NULL, /* Datatype NameLen */
|
||||
NULL, /* Datatype GetName */
|
||||
NULL, /* Datatype SetName */
|
||||
NULL, /* Datatype Search */
|
||||
NULL, /* Datatype Index */
|
||||
NULL, /* Datatype Flush */
|
||||
NULL, /* Datatype Delete */
|
||||
NULL, /* Datatype GetParent */
|
||||
NULL, /* Datatype GetFile */
|
||||
H5Tclose /* Datatype Release */
|
||||
},
|
||||
{ /* Dimensionality object meta-functions (defined in H5P.c) */
|
||||
H5_DATASPACE, /* Dimensionality Type ID */
|
||||
H5P_create, /* Dimensionality Create */
|
||||
NULL, /* Dimensionality Access */
|
||||
NULL, /* Dimensionality Copy */
|
||||
NULL, /* Dimensionality FindName */
|
||||
NULL, /* Dimensionality NameLen */
|
||||
NULL, /* Dimensionality GetName */
|
||||
NULL, /* Dimensionality SetName */
|
||||
NULL, /* Dimensionality Search */
|
||||
NULL, /* Dimensionality Index */
|
||||
NULL, /* Dimensionality Flush */
|
||||
NULL, /* Dimensionality Delete */
|
||||
NULL, /* Dimensionality GetParent */
|
||||
NULL, /* Dimensionality GetFile */
|
||||
H5P_release /* Dimensionality Release */
|
||||
{ /* Dimensionality object meta-functions (defined in H5P.c) */
|
||||
H5_DATASPACE, /* Dimensionality Type ID */
|
||||
NULL, /* Dimensionality Create */
|
||||
NULL, /* Dimensionality Access */
|
||||
NULL, /* Dimensionality Copy */
|
||||
NULL, /* Dimensionality FindName */
|
||||
NULL, /* Dimensionality NameLen */
|
||||
NULL, /* Dimensionality GetName */
|
||||
NULL, /* Dimensionality SetName */
|
||||
NULL, /* Dimensionality Search */
|
||||
NULL, /* Dimensionality Index */
|
||||
NULL, /* Dimensionality Flush */
|
||||
NULL, /* Dimensionality Delete */
|
||||
NULL, /* Dimensionality GetParent */
|
||||
NULL, /* Dimensionality GetFile */
|
||||
H5Pclose /* Dimensionality Release */
|
||||
},
|
||||
{ /* Dataset object meta-functions (defined in H5D.c) */
|
||||
H5_DATASET, /* Dataset Type ID */
|
||||
H5D_create, /* Dataset Create */
|
||||
NULL, /* Dataset Access */
|
||||
NULL, /* Dataset Copy */
|
||||
H5D_find_name, /* Dataset FindName */
|
||||
NULL, /* Dataset NameLen */
|
||||
NULL, /* Dataset GetName */
|
||||
NULL, /* Dataset SetName */
|
||||
NULL, /* Dataset Search */
|
||||
NULL, /* Dataset Index */
|
||||
H5D_flush, /* Dataset Flush */
|
||||
NULL, /* Dataset Delete */
|
||||
NULL, /* Dataset GetParent */
|
||||
NULL, /* Dataset GetFile */
|
||||
H5D_release /* Dataset Release */
|
||||
{ /* Dataset object meta-functions (defined in H5D.c) */
|
||||
H5_DATASET, /* Dataset Type ID */
|
||||
NULL, /* Dataset Create */
|
||||
NULL, /* Dataset Access */
|
||||
NULL, /* Dataset Copy */
|
||||
H5D_find_name, /* Dataset FindName */
|
||||
NULL, /* Dataset NameLen */
|
||||
NULL, /* Dataset GetName */
|
||||
NULL, /* Dataset SetName */
|
||||
NULL, /* Dataset Search */
|
||||
NULL, /* Dataset Index */
|
||||
NULL, /* Dataset Flush */
|
||||
NULL, /* Dataset Delete */
|
||||
NULL, /* Dataset GetParent */
|
||||
NULL, /* Dataset GetFile */
|
||||
H5Dclose /* Dataset Release */
|
||||
},
|
||||
};
|
||||
|
||||
/*------------------_-- Local function prototypes ----------------------------*/
|
||||
/* Interface initialization */
|
||||
static intn interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT H5M_init_interface
|
||||
static herr_t H5M_init_interface(void);
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
@ -153,7 +151,7 @@ MODIFICATIONS
|
||||
static herr_t H5M_init_interface(void)
|
||||
{
|
||||
herr_t ret_value = SUCCEED;
|
||||
FUNC_ENTER (H5M_init_interface, NULL, FAIL);
|
||||
FUNC_ENTER (H5M_init_interface, FAIL);
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* H5M_init_interface */
|
||||
@ -165,20 +163,21 @@ static herr_t H5M_init_interface(void)
|
||||
Find the type of meta-object to issue a method call on
|
||||
USAGE
|
||||
intn H5M_find_type(type)
|
||||
hobjtype_t type; IN: Type of object to create
|
||||
hobjtype_t type; IN: Type of object to create
|
||||
RETURNS
|
||||
Returns the index of the type in the array of methods on success, or FAIL
|
||||
on failure.
|
||||
on failure.
|
||||
DESCRIPTION
|
||||
This function performs a search to find the index of the type of a
|
||||
This function performs a search to find the index of the type of a
|
||||
meta-object in the array of function pointers.
|
||||
--------------------------------------------------------------------------*/
|
||||
static intn H5M_find_type(hobjtype_t type)
|
||||
static intn
|
||||
H5M_find_type (group_t type)
|
||||
{
|
||||
intn i; /* local counting variable */
|
||||
intn i; /* local counting variable */
|
||||
intn ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER(H5M_find_type, H5M_init_interface, FAIL);
|
||||
FUNC_ENTER(H5M_find_type, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
@ -188,8 +187,8 @@ static intn H5M_find_type(hobjtype_t type)
|
||||
* to a binary search when it becomes too slow.
|
||||
*/
|
||||
for(i=0; i<(sizeof(meta_func_arr)/sizeof(meta_func_t)); i++)
|
||||
if(type==meta_func_arr[i].type)
|
||||
HGOTO_DONE(i);
|
||||
if(type==meta_func_arr[i].type)
|
||||
HGOTO_DONE(i);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
@ -202,50 +201,6 @@ done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5M_find_type() */
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5Mcreate
|
||||
PURPOSE
|
||||
Create a new HDF5 object.
|
||||
USAGE
|
||||
hid_t H5Mcreate(owner_id, type, name)
|
||||
hid_t owner_id; IN: Group/file which owns this object
|
||||
hobjtype_t type; IN: Type of object to create
|
||||
const char *name; IN: Name of the object
|
||||
RETURNS
|
||||
Returns ID (atom) on success, FAIL on failure
|
||||
DESCRIPTION
|
||||
This function re-directs the object's creation into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h
|
||||
--------------------------------------------------------------------------*/
|
||||
hid_t H5Mcreate(hid_t owner_id, hobjtype_t type, const char *name)
|
||||
{
|
||||
intn i; /* local counting variable */
|
||||
hid_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Mcreate, H5M_init_interface, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(type<=BADGROUP || type>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(type);
|
||||
if(meta_func_arr[i].create==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].create)(owner_id,type,name);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
|
||||
/* Normal function cleanup */
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5Mcreate() */
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5Maccess
|
||||
@ -253,20 +208,20 @@ done:
|
||||
Start access to an existing HDF5 object.
|
||||
USAGE
|
||||
hid_t H5Maccess(owner_id)
|
||||
hid_t oid; IN: OID of the object to access.
|
||||
hid_t oid; IN: OID of the object to access.
|
||||
RETURNS
|
||||
Returns ID (atom) on success, FAIL on failure
|
||||
DESCRIPTION
|
||||
This function re-directs the object's access into the appropriate
|
||||
This function re-directs the object's access into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h
|
||||
--------------------------------------------------------------------------*/
|
||||
hid_t H5Maccess(hid_t oid)
|
||||
{
|
||||
group_t group;
|
||||
intn i; /* local counting variable */
|
||||
hid_t ret_value = SUCCEED;
|
||||
group_t group;
|
||||
intn i; /* local counting variable */
|
||||
hid_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Maccess, H5M_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Maccess, FAIL);
|
||||
|
||||
/* Atom group for incoming object */
|
||||
group = H5Aatom_group (oid);
|
||||
@ -274,15 +229,15 @@ hid_t H5Maccess(hid_t oid)
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(group<=BADGROUP || group>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(group);
|
||||
if(meta_func_arr[i].access==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].access)(oid);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
@ -299,33 +254,33 @@ done:
|
||||
Copy an HDF5 object.
|
||||
USAGE
|
||||
hid_t H5Mcopy(oid)
|
||||
hid_t oid; IN: Object to copy
|
||||
hid_t oid; IN: Object to copy
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function re-directs the object's copy into the appropriate
|
||||
This function re-directs the object's copy into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h
|
||||
--------------------------------------------------------------------------*/
|
||||
hid_t H5Mcopy(hid_t oid)
|
||||
{
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Mcopy, H5M_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Mcopy, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(group<=BADGROUP || group>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(group);
|
||||
if(meta_func_arr[i].copy==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].copy)(oid);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
@ -342,44 +297,45 @@ done:
|
||||
Find an HDF5 object by name.
|
||||
USAGE
|
||||
hid_t H5Mfind_name(owner_id, type, name)
|
||||
hid_t owner_id; IN: Group/file in which to search
|
||||
hobjtype_t type; IN: Type of object to search names of
|
||||
const char *name; IN: Name of the object to search for
|
||||
hid_t owner_id; IN: Group/file in which to search
|
||||
hobjtype_t type; IN: Type of object to search names of
|
||||
const char *name; IN: Name of the object to search for
|
||||
RETURNS
|
||||
Returns ID (atom) on success, FAIL on failure
|
||||
DESCRIPTION
|
||||
This function re-directs the object's "find name" into the appropriate
|
||||
This function re-directs the object's "find name" into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h
|
||||
--------------------------------------------------------------------------*/
|
||||
hid_t H5Mfind_name(hid_t owner_id, hobjtype_t type, const char *name)
|
||||
hid_t
|
||||
H5Mfind_name (hid_t owner_id, group_t type, const char *name)
|
||||
{
|
||||
#ifdef OLD_WAY
|
||||
group_t group=H5Aatom_group(owner_id); /* Atom group for incoming object */
|
||||
#endif /* OLD_WAY */
|
||||
intn i; /* local counting variable */
|
||||
hid_t ret_value = SUCCEED;
|
||||
intn i; /* local counting variable */
|
||||
hid_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Mfind_name, H5M_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Mfind_name, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
#ifdef OLD_WAY
|
||||
if(group<=BADGROUP || group>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(group);
|
||||
#else /* OLD_WAY */
|
||||
if(type<=BADGROUP || type>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(type);
|
||||
#endif /* OLD_WAY */
|
||||
if(meta_func_arr[i].find_name==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].find_name)(owner_id,type,name);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
@ -396,33 +352,33 @@ done:
|
||||
Determine the length of the name of an HDF5 object.
|
||||
USAGE
|
||||
uint32 H5Mname_len(oid)
|
||||
hid_t oid; IN: Object to get name's length
|
||||
hid_t oid; IN: Object to get name's length
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function re-directs the object's "name length" into the appropriate
|
||||
This function re-directs the object's "name length" into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h
|
||||
--------------------------------------------------------------------------*/
|
||||
uint32 H5Mname_len(hid_t oid)
|
||||
{
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Mname_len, H5M_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Mname_len, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(group<=BADGROUP || group>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(group);
|
||||
if(meta_func_arr[i].name_len==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].name_len)(oid);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
@ -439,34 +395,34 @@ done:
|
||||
Get the name of an HDF5 object.
|
||||
USAGE
|
||||
herr_t H5Mget_name(oid, name)
|
||||
hid_t oid; IN: Object to retreive name of
|
||||
char *name; OUT: Buffer to place object's name in
|
||||
hid_t oid; IN: Object to retreive name of
|
||||
char *name; OUT: Buffer to place object's name in
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function re-directs the object's "get name" into the appropriate
|
||||
This function re-directs the object's "get name" into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t H5Mget_name(hid_t oid, char *name)
|
||||
{
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
hid_t ret_value = SUCCEED;
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
hid_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Mget_name, H5M_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Mget_name, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(group<=BADGROUP || group>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(group);
|
||||
if(meta_func_arr[i].get_name==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].get_name)(oid,name);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
@ -483,34 +439,34 @@ done:
|
||||
Set the name of an HDF5 object.
|
||||
USAGE
|
||||
herr_t H5Mget_name(oid, name)
|
||||
hid_t oid; IN: Object to set name of
|
||||
const char *name; IN: Name to use for object
|
||||
hid_t oid; IN: Object to set name of
|
||||
const char *name; IN: Name to use for object
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function re-directs the object's "set name" into the appropriate
|
||||
This function re-directs the object's "set name" into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t H5Mset_name(hid_t oid, const char *name)
|
||||
{
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
hid_t ret_value = SUCCEED;
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
hid_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Mset_name, H5M_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Mset_name, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(group<=BADGROUP || group>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(group);
|
||||
if(meta_func_arr[i].set_name==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].set_name)(oid,name);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
@ -527,35 +483,36 @@ done:
|
||||
Wildcard search for an HDF5 object by name.
|
||||
USAGE
|
||||
hid_t H5Mfind_name(owner_id, type, name)
|
||||
hid_t owner_id; IN: Group/file in which to search
|
||||
hobjtype_t type; IN: Type of object to search names of
|
||||
const char *name; IN: Name of the object to search for
|
||||
hid_t owner_id; IN: Group/file in which to search
|
||||
hobjtype_t type; IN: Type of object to search names of
|
||||
const char *name; IN: Name of the object to search for
|
||||
RETURNS
|
||||
Returns ID (atom) on success, FAIL on failure
|
||||
DESCRIPTION
|
||||
This function re-directs the object's "search" into the appropriate
|
||||
This function re-directs the object's "search" into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h
|
||||
--------------------------------------------------------------------------*/
|
||||
hid_t H5Msearch(hid_t oid, hobjtype_t type, const char *name)
|
||||
hid_t
|
||||
H5Msearch (hid_t oid, group_t type, const char *name)
|
||||
{
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
hid_t ret_value = SUCCEED;
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
hid_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Msearch, H5M_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Msearch, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(group<=BADGROUP || group>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(group);
|
||||
if(meta_func_arr[i].search==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].search)(oid,type,name);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
@ -572,35 +529,36 @@ done:
|
||||
Get an HDF5 object by index.
|
||||
USAGE
|
||||
hid_t H5Mindex(oid, type, idx)
|
||||
hid_t oid; IN: Group/file in which to find items
|
||||
hobjtype_t type; IN: Type of object to get
|
||||
uint32 idx; IN: Index of the object to get
|
||||
hid_t oid; IN: Group/file in which to find items
|
||||
hobjtype_t type; IN: Type of object to get
|
||||
uint32 idx; IN: Index of the object to get
|
||||
RETURNS
|
||||
Returns ID (atom) on success, FAIL on failure
|
||||
DESCRIPTION
|
||||
This function re-directs the object's "index" into the appropriate
|
||||
This function re-directs the object's "index" into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h
|
||||
--------------------------------------------------------------------------*/
|
||||
hid_t H5Mindex(hid_t oid, hobjtype_t type, uint32 idx)
|
||||
hid_t
|
||||
H5Mindex (hid_t oid, group_t type, uint32 idx)
|
||||
{
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
hid_t ret_value = SUCCEED;
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
hid_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Mindex, H5M_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Mindex, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(group<=BADGROUP || group>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(group);
|
||||
if(meta_func_arr[i].index==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].index)(oid,type,idx);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
@ -617,35 +575,35 @@ done:
|
||||
Flush an HDF5 object out to a file.
|
||||
USAGE
|
||||
hid_t H5Mflush(oid)
|
||||
hid_t oid; IN: Object to flush
|
||||
hid_t oid; IN: Object to flush
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function re-directs the object's flush into the appropriate
|
||||
This function re-directs the object's flush into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h
|
||||
--------------------------------------------------------------------------*/
|
||||
hid_t H5Mflush(hid_t oid)
|
||||
{
|
||||
group_t group; /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Mflush, H5M_init_interface, FAIL); /* Insert function initialization code and variables */
|
||||
FUNC_ENTER(H5Mflush, FAIL); /* Insert function initialization code and variables */
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
group=H5Aatom_group(oid); /* look up group for incoming object */
|
||||
group=H5Aatom_group(oid); /* look up group for incoming object */
|
||||
if(group<=BADGROUP || group>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
/* Find correct function pointer set from static array */
|
||||
i=H5M_find_type(group);
|
||||
if(meta_func_arr[i].flush==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].flush)(oid);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
@ -662,34 +620,34 @@ done:
|
||||
Delete an HDF5 object from a file.
|
||||
USAGE
|
||||
herr_t H5Mdelete(oid)
|
||||
hid_t oid; IN: Object to delete
|
||||
hid_t oid; IN: Object to delete
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function re-directs the object's delete into the appropriate
|
||||
This function re-directs the object's delete into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h. Deleting
|
||||
an object implicitly ends access to it.
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t H5Mdelete(hid_t oid)
|
||||
{
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Mdelete, H5M_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Mdelete, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(group<=BADGROUP || group>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(group);
|
||||
if(meta_func_arr[i].delete==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].delete)(oid);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
@ -706,33 +664,33 @@ done:
|
||||
Get the parent ID an HDF5 object.
|
||||
USAGE
|
||||
hid_t H5Mget_parent(oid)
|
||||
hid_t oid; IN: Object to query
|
||||
hid_t oid; IN: Object to query
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function re-directs the object's query into the appropriate
|
||||
This function re-directs the object's query into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h
|
||||
--------------------------------------------------------------------------*/
|
||||
hid_t H5Mget_parent(hid_t oid)
|
||||
{
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Mget_parent, H5M_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Mget_parent, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(group<=BADGROUP || group>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(group);
|
||||
if(meta_func_arr[i].get_parent==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].get_parent)(oid);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
@ -749,33 +707,33 @@ done:
|
||||
Get the file ID an HDF5 object.
|
||||
USAGE
|
||||
hid_t H5Mget_file(oid)
|
||||
hid_t oid; IN: Object to query
|
||||
hid_t oid; IN: Object to query
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function re-directs the object's query into the appropriate
|
||||
This function re-directs the object's query into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h
|
||||
--------------------------------------------------------------------------*/
|
||||
hid_t H5Mget_file(hid_t oid)
|
||||
{
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Mget_file, H5M_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Mget_file, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(group<=BADGROUP || group>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(group);
|
||||
if(meta_func_arr[i].get_file==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].get_file)(oid);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
@ -787,38 +745,38 @@ done:
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5Mrelease
|
||||
H5Mclose
|
||||
PURPOSE
|
||||
Release access to an HDF5 object.
|
||||
USAGE
|
||||
herr_t H5Mrelease(oid)
|
||||
hid_t oid; IN: Object to release access to
|
||||
herr_t H5Mclose(oid)
|
||||
hid_t oid; IN: Object to release access to
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function re-directs the object's release into the appropriate
|
||||
This function re-directs the object's release into the appropriate
|
||||
interface, as defined by the function pointers in hdf5fptr.h
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t H5Mrelease(hid_t oid)
|
||||
herr_t H5Mclose(hid_t oid)
|
||||
{
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
group_t group=H5Aatom_group(oid); /* Atom group for incoming object */
|
||||
intn i; /* local counting variable */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Mrelease, H5M_init_interface, FAIL);
|
||||
FUNC_ENTER(H5Mclose, FAIL);
|
||||
|
||||
/* Clear errors and check args and all the boring stuff. */
|
||||
H5ECLEAR;
|
||||
if(group<=BADGROUP || group>=MAXGROUP)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL);
|
||||
|
||||
i=H5M_find_type(group);
|
||||
if(meta_func_arr[i].release==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].release)(oid);
|
||||
if(meta_func_arr[i].close==NULL)
|
||||
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL);
|
||||
ret_value=(meta_func_arr[i].close)(oid);
|
||||
|
||||
done:
|
||||
if(ret_value == FAIL)
|
||||
if(ret_value == FAIL)
|
||||
{ /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
@ -826,5 +784,5 @@ done:
|
||||
/* Normal function cleanup */
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5Mrelease() */
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
/* Is the interface initialized? */
|
||||
static intn interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -55,7 +56,7 @@ H5MF_alloc (H5F_t *f, intn op, size_t size, haddr_t *addr/*out*/)
|
||||
{
|
||||
haddr_t tmp_addr;
|
||||
|
||||
FUNC_ENTER (H5MF_alloc, NULL, FAIL);
|
||||
FUNC_ENTER (H5MF_alloc, FAIL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
@ -109,7 +110,7 @@ H5MF_alloc (H5F_t *f, intn op, size_t size, haddr_t *addr/*out*/)
|
||||
herr_t
|
||||
H5MF_free (H5F_t *f, const haddr_t *addr, size_t size)
|
||||
{
|
||||
FUNC_ENTER (H5MF_free, NULL, FAIL);
|
||||
FUNC_ENTER (H5MF_free, FAIL);
|
||||
|
||||
/* check arguments */
|
||||
assert (f);
|
||||
|
@ -25,25 +25,25 @@
|
||||
|
||||
/*
|
||||
* A function table record for accessing interfaces which use the "meta"
|
||||
* interface to create/access/release objects.
|
||||
* interface to create/open/close objects.
|
||||
*/
|
||||
typedef struct meta_func_t
|
||||
{
|
||||
hobjtype_t type; /* Object type this interface is for */
|
||||
hid_t (*create) (hid_t , hobjtype_t, const char *); /* Object creation function */
|
||||
group_t type; /* Object type this interface is for */
|
||||
hid_t (*create) (hid_t , group_t, const char *); /* Object creation function */
|
||||
hid_t (*access) (hid_t ); /* Object access function */
|
||||
hid_t (*copy) (hid_t ); /* Object copy function */
|
||||
hid_t (*find_name) (hid_t , hobjtype_t, const char *); /* Find first object */
|
||||
hid_t (*find_name) (hid_t , group_t, const char *); /* Find first object */
|
||||
uint32 (*name_len) (hid_t ); /* Get length of object name */
|
||||
herr_t (*get_name) (hid_t , char *); /* Get object name */
|
||||
herr_t (*set_name) (hid_t , const char *); /* Set object name */
|
||||
hid_t (*search) (hid_t , hobjtype_t, const char *); /* Search for list of objects */
|
||||
hid_t (*index) (hid_t , hobjtype_t, uint32); /* Get the OID for the n'th object */
|
||||
hid_t (*search) (hid_t , group_t, const char *); /* Search for list of objects */
|
||||
hid_t (*index) (hid_t , group_t, uint32); /* Get the OID for the n'th object */
|
||||
herr_t (*flush) (hid_t ); /* Flush the object to disk */
|
||||
herr_t (*delete) (hid_t ); /* Delete an object from file */
|
||||
hid_t (*get_parent) (hid_t ); /* Get the parent object of an object */
|
||||
hid_t (*get_file) (hid_t ); /* Get the file ID of an object */
|
||||
herr_t (*release) (hid_t ); /* End access to an object */
|
||||
herr_t (*close) (hid_t ); /* End access to an object */
|
||||
}
|
||||
meta_func_t;
|
||||
|
||||
|
@ -29,20 +29,19 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Functions in H5M.c */
|
||||
hid_t H5Mcreate(hid_t owner_id, hobjtype_t type, const char *name);
|
||||
hid_t H5Maccess(hid_t oid);
|
||||
hid_t H5Mcopy(hid_t oid);
|
||||
hid_t H5Mfind_name(hid_t oid, hobjtype_t type, const char *name);
|
||||
hid_t H5Mfind_name(hid_t oid, group_t type, const char *name);
|
||||
uint32 H5Mname_len(hid_t oid);
|
||||
herr_t H5Mget_name(hid_t oid, char *name);
|
||||
herr_t H5Mset_name(hid_t oid, const char *name);
|
||||
hid_t H5Msearch(hid_t oid, hobjtype_t type, const char *name);
|
||||
hid_t H5Mindex(hid_t oid, hobjtype_t type, uint32 idx);
|
||||
hid_t H5Msearch(hid_t oid, group_t type, const char *name);
|
||||
hid_t H5Mindex(hid_t oid, group_t type, uint32 idx);
|
||||
hid_t H5Mflush(hid_t oid);
|
||||
herr_t H5Mdelete(hid_t oid);
|
||||
hid_t H5Mget_file(hid_t oid);
|
||||
hid_t H5Mget_parent(hid_t oid);
|
||||
herr_t H5Mrelease(hid_t oid);
|
||||
herr_t H5Mclose(hid_t oid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
57
src/H5O.c
57
src/H5O.c
@ -43,34 +43,35 @@ static const H5AC_class_t H5AC_OHDR[1] = {{
|
||||
(herr_t(*)(H5F_t*,hbool_t,const haddr_t*,void*))H5O_flush,
|
||||
}};
|
||||
|
||||
/* Is the interface initialized? */
|
||||
/* Interface initialization */
|
||||
static intn interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
/* ID to type mapping */
|
||||
static const H5O_class_t *const message_type_g[] = {
|
||||
H5O_NULL, /*0x0000 Null */
|
||||
H5O_SIM_DIM, /*0x0001 Simple dimensionality */
|
||||
H5O_NULL, /*0x0000 Null */
|
||||
H5O_SDSPACE, /*0x0001 Simple Dimensionality */
|
||||
NULL, /*0x0002 Data space (fiber bundle?) */
|
||||
H5O_SIM_DTYPE, /*0x0003 Simple data type */
|
||||
NULL, /*0x0004 Compound data type */
|
||||
H5O_STD_STORE, /*0x0005 Data storage -- standard object */
|
||||
H5O_DTYPE, /*0x0003 Data Type */
|
||||
NULL, /*0x0004 Not assigned */
|
||||
H5O_CSTORE, /*0x0005 Contiguous Data Storage */
|
||||
NULL, /*0x0006 Data storage -- compact object */
|
||||
NULL, /*0x0007 Data storage -- external object */
|
||||
H5O_ISTORE, /*0x0008 Data storage -- indexed object */
|
||||
NULL, /*0x0009 Not assigned */
|
||||
H5O_ISTORE, /*0x0008 Indexed Data Storage */
|
||||
H5O_EFL, /*0x0009 External File List */
|
||||
NULL, /*0x000A Not assigned */
|
||||
NULL, /*0x000B Data storage -- compressed object */
|
||||
NULL, /*0x000C Attribute list */
|
||||
H5O_NAME, /*0x000D Object name */
|
||||
H5O_NAME, /*0x000D Object name */
|
||||
NULL, /*0x000E Object modification date and time */
|
||||
NULL, /*0x000F Shared header message */
|
||||
H5O_CONT, /*0x0010 Object header continuation */
|
||||
H5O_STAB, /*0x0011 Symbol table */
|
||||
H5O_CONT, /*0x0010 Object header continuation */
|
||||
H5O_STAB, /*0x0011 Symbol table */
|
||||
};
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_new
|
||||
* Function: H5O_create
|
||||
*
|
||||
* Purpose: Creates a new object header, sets the link count
|
||||
* to NLINK, and caches the header.
|
||||
@ -89,13 +90,13 @@ static const H5O_class_t *const message_type_g[] = {
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_new (H5F_t *f, intn nlink, size_t size_hint, haddr_t *addr/*out*/)
|
||||
H5O_create (H5F_t *f, intn nlink, size_t size_hint, haddr_t *addr/*out*/)
|
||||
{
|
||||
size_t size; /*total size of object header */
|
||||
H5O_t *oh = NULL;
|
||||
haddr_t tmp_addr;
|
||||
|
||||
FUNC_ENTER (H5O_new, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_create, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -184,7 +185,7 @@ H5O_load (H5F_t *f, const haddr_t *addr, const void *_udata1, void *_udata2)
|
||||
size_t chunk_size;
|
||||
H5O_cont_t *cont=NULL;
|
||||
|
||||
FUNC_ENTER (H5O_load, NULL, NULL);
|
||||
FUNC_ENTER (H5O_load, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -344,7 +345,7 @@ H5O_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
|
||||
int i;
|
||||
H5O_cont_t *cont = NULL;
|
||||
|
||||
FUNC_ENTER (H5O_flush, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_flush, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -476,7 +477,7 @@ H5O_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5O_t *oh)
|
||||
herr_t
|
||||
H5O_reset (const H5O_class_t *type, void *native)
|
||||
{
|
||||
FUNC_ENTER (H5O_reset, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_reset, FAIL);
|
||||
|
||||
if (native) {
|
||||
if (type->reset) {
|
||||
@ -517,7 +518,7 @@ H5O_link (H5F_t *f, H5G_entry_t *ent, intn adjust)
|
||||
H5O_t *oh = NULL;
|
||||
haddr_t addr;
|
||||
|
||||
FUNC_ENTER (H5O_link, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_link, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -582,7 +583,7 @@ H5O_read (H5F_t *f, const haddr_t *addr, H5G_entry_t *ent,
|
||||
H5G_type_t cache_type;
|
||||
haddr_t _addr;
|
||||
|
||||
FUNC_ENTER (H5O_read, NULL, NULL);
|
||||
FUNC_ENTER (H5O_read, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -650,7 +651,7 @@ H5O_find_in_ohdr (H5F_t *f, const haddr_t *addr, const H5O_class_t **type_p,
|
||||
H5O_t *oh = NULL;
|
||||
int i;
|
||||
|
||||
FUNC_ENTER (H5O_find_in_ohdr, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_find_in_ohdr, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -717,7 +718,7 @@ H5O_peek (H5F_t *f, const haddr_t *addr, const H5O_class_t *type,
|
||||
intn idx;
|
||||
H5O_t *oh = NULL;
|
||||
|
||||
FUNC_ENTER (H5O_peek, NULL, NULL);
|
||||
FUNC_ENTER (H5O_peek, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -775,7 +776,7 @@ H5O_modify (H5F_t *f, const haddr_t *addr, H5G_entry_t *ent,
|
||||
size_t size;
|
||||
haddr_t _addr;
|
||||
|
||||
FUNC_ENTER (H5O_modify, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_modify, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -879,7 +880,7 @@ H5O_remove (H5F_t *f, const haddr_t *addr, H5G_entry_t *ent,
|
||||
intn i, seq;
|
||||
haddr_t _addr;
|
||||
|
||||
FUNC_ENTER (H5O_remove, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_remove, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -954,7 +955,7 @@ H5O_alloc_extend_chunk (H5O_t *oh, intn chunkno, size_t size)
|
||||
size_t delta;
|
||||
uint8 *old_addr;
|
||||
|
||||
FUNC_ENTER (H5O_alloc_extend_chunk, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_alloc_extend_chunk, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (oh);
|
||||
@ -1071,7 +1072,7 @@ H5O_alloc_new_chunk (H5F_t *f, H5O_t *oh, size_t size)
|
||||
H5O_cont_t *cont = NULL; /*native continuation message */
|
||||
intn i, chunkno;
|
||||
|
||||
FUNC_ENTER (H5O_alloc_new_chunk, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_alloc_new_chunk, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (oh);
|
||||
@ -1083,7 +1084,7 @@ H5O_alloc_new_chunk (H5F_t *f, H5O_t *oh, size_t size)
|
||||
* that could be moved to make room for the continuation message.
|
||||
* Don't ever move continuation message from one chunk to another.
|
||||
*/
|
||||
cont_size = H5F_SIZEOF_OFFSET(f) + H5F_SIZEOF_SIZE(f);
|
||||
cont_size = H5F_SIZEOF_ADDR(f) + H5F_SIZEOF_SIZE(f);
|
||||
for (i=0; i<oh->nmesgs; i++) {
|
||||
if (H5O_NULL_ID == oh->mesg[i].type->id) {
|
||||
if (cont_size == oh->mesg[i].raw_size) {
|
||||
@ -1228,7 +1229,7 @@ H5O_alloc (H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size)
|
||||
intn idx;
|
||||
intn null_idx;
|
||||
|
||||
FUNC_ENTER (H5O_alloc, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_alloc, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (oh);
|
||||
@ -1330,7 +1331,7 @@ H5O_debug (H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
|
||||
int *sequence;
|
||||
haddr_t tmp_addr;
|
||||
|
||||
FUNC_ENTER (H5O_debug, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_debug, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
|
@ -47,8 +47,9 @@ const H5O_class_t H5O_CONT[1] = {{
|
||||
H5O_cont_debug, /*debugging */
|
||||
}};
|
||||
|
||||
/* Is the interface initialized? */
|
||||
/* Interface initialization */
|
||||
static intn interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -73,11 +74,11 @@ H5O_cont_decode (H5F_t *f, size_t raw_size, const uint8 *p)
|
||||
{
|
||||
H5O_cont_t *cont = NULL;
|
||||
|
||||
FUNC_ENTER (H5O_cont_decode, NULL, NULL);
|
||||
FUNC_ENTER (H5O_cont_decode, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (raw_size == H5F_SIZEOF_OFFSET(f) + H5F_SIZEOF_SIZE(f));
|
||||
assert (raw_size == H5F_SIZEOF_ADDR(f) + H5F_SIZEOF_SIZE(f));
|
||||
assert (p);
|
||||
|
||||
/* decode */
|
||||
@ -111,11 +112,11 @@ H5O_cont_encode (H5F_t *f, size_t size, uint8 *p, const void *_mesg)
|
||||
{
|
||||
const H5O_cont_t *cont = (const H5O_cont_t *)_mesg;
|
||||
|
||||
FUNC_ENTER (H5O_cont_encode, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_cont_encode, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (size == H5F_SIZEOF_OFFSET(f) + H5F_SIZEOF_SIZE(f));
|
||||
assert (size == H5F_SIZEOF_ADDR(f) + H5F_SIZEOF_SIZE(f));
|
||||
assert (p);
|
||||
assert (cont);
|
||||
|
||||
@ -150,7 +151,7 @@ H5O_cont_debug (H5F_t *f, const void *_mesg, FILE *stream,
|
||||
{
|
||||
const H5O_cont_t *cont = (const H5O_cont_t *)_mesg;
|
||||
|
||||
FUNC_ENTER (H5O_cont_debug, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_cont_debug, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
|
@ -10,17 +10,11 @@
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef RCSID
|
||||
static char RcsId[] = "@(#)$Revision$";
|
||||
#endif
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/*LINTLIBRARY */
|
||||
/*+
|
||||
FILE
|
||||
H5Ostdst.c
|
||||
HDF5 Standard Data Storage Object Header Message routines
|
||||
H5Ocstore.c
|
||||
HDF5 Contiguous Data Storage Object Header Message routines
|
||||
|
||||
EXPORTED ROUTINES
|
||||
|
||||
@ -35,71 +29,72 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
#include <H5MMprivate.h>
|
||||
#include <H5Oprivate.h>
|
||||
|
||||
#define PABLO_MASK H5O_std_store_mask
|
||||
#define PABLO_MASK H5O_cstore_mask
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_std_store_decode (H5F_t *f, size_t raw_size, const uint8 *p);
|
||||
static herr_t H5O_std_store_encode (H5F_t *f, size_t size, uint8 *p,
|
||||
const void *_mesg);
|
||||
static void *H5O_std_store_copy (const void *_mesg, void *_dest);
|
||||
static size_t H5O_std_store_size (H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_std_store_debug (H5F_t *f, const void *_mesg,
|
||||
FILE *stream, intn indent, intn fwidth);
|
||||
static void *H5O_cstore_decode (H5F_t *f, size_t raw_size, const uint8 *p);
|
||||
static herr_t H5O_cstore_encode (H5F_t *f, size_t size, uint8 *p,
|
||||
const void *_mesg);
|
||||
static void *H5O_cstore_copy (const void *_mesg, void *_dest);
|
||||
static size_t H5O_cstore_size (H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_cstore_debug (H5F_t *f, const void *_mesg,
|
||||
FILE *stream, intn indent, intn fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_STD_STORE[1] = {{
|
||||
H5O_STD_STORE_ID, /* message id number */
|
||||
"std_store", /* message name for debugging */
|
||||
sizeof (H5O_std_store_t),/* native message size */
|
||||
H5G_NOTHING_CACHED, /* symtab entry `type' field */
|
||||
H5O_std_store_decode, /* decode message */
|
||||
H5O_std_store_encode, /* encode message */
|
||||
NULL, /* get message from stab entry */
|
||||
NULL, /* put message into stab entry */
|
||||
H5O_std_store_copy, /* copy the native value */
|
||||
H5O_std_store_size, /* size of symbol table entry */
|
||||
NULL, /* default reset method */
|
||||
H5O_std_store_debug, /* debug the message */
|
||||
const H5O_class_t H5O_CSTORE[1] = {{
|
||||
H5O_CSTORE_ID, /* message id number */
|
||||
"cstore", /* message name for debugging */
|
||||
sizeof (H5O_cstore_t), /* native message size */
|
||||
H5G_NOTHING_CACHED, /* symtab entry `type' field */
|
||||
H5O_cstore_decode, /* decode message */
|
||||
H5O_cstore_encode, /* encode message */
|
||||
NULL, /* get message from stab entry */
|
||||
NULL, /* put message into stab entry */
|
||||
H5O_cstore_copy, /* copy the native value */
|
||||
H5O_cstore_size, /* size of symbol table entry */
|
||||
NULL, /* default reset method */
|
||||
H5O_cstore_debug, /* debug the message */
|
||||
}};
|
||||
|
||||
/* Is the interface initialized? */
|
||||
/* Interface initialization */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_std_store_decode
|
||||
H5O_cstore_decode
|
||||
PURPOSE
|
||||
Decode a standard data storage and return a pointer to a memory
|
||||
Decode a contiguous data storage and return a pointer to a memory
|
||||
struct with the decoded information
|
||||
USAGE
|
||||
void *H5O_std_store_decode(f, raw_size, p)
|
||||
void *H5O_cstore_decode(f, raw_size, p)
|
||||
H5F_t *f; IN: pointer to the HDF5 file struct
|
||||
size_t raw_size; IN: size of the raw information buffer
|
||||
const uint8 *p; IN: the raw information buffer
|
||||
RETURNS
|
||||
Pointer to the new message in native order on success, NULL on failure
|
||||
DESCRIPTION
|
||||
This function decodes the "raw" disk form of a standard data storage
|
||||
This function decodes the "raw" disk form of a contiguous data storage
|
||||
message into a struct in memory native format. The struct is allocated
|
||||
within this function using malloc() and is returned to the caller.
|
||||
--------------------------------------------------------------------------*/
|
||||
static void *
|
||||
H5O_std_store_decode (H5F_t *f, size_t raw_size, const uint8 *p)
|
||||
H5O_cstore_decode (H5F_t *f, size_t raw_size, const uint8 *p)
|
||||
{
|
||||
H5O_std_store_t *store=NULL; /* New standard storage structure */
|
||||
H5O_cstore_t *store=NULL; /* New contiguous storage structure */
|
||||
|
||||
FUNC_ENTER (H5O_std_store_decode, NULL, NULL);
|
||||
FUNC_ENTER (H5O_cstore_decode, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (raw_size == H5F_SIZEOF_OFFSET(f)+H5F_SIZEOF_SIZE(f));
|
||||
assert (raw_size == H5F_SIZEOF_ADDR(f)+H5F_SIZEOF_SIZE(f));
|
||||
assert (p);
|
||||
|
||||
/* decode */
|
||||
if((store = H5MM_xcalloc (1, sizeof(H5O_std_store_t)))!=NULL)
|
||||
if((store = H5MM_xcalloc (1, sizeof(H5O_cstore_t)))!=NULL)
|
||||
{
|
||||
H5F_addr_decode (f, &p,&(store->off));
|
||||
H5F_decode_length(f,p,store->len);
|
||||
H5F_addr_decode (f, &p,&(store->addr));
|
||||
H5F_decode_length(f,p,store->size);
|
||||
} /* end if */
|
||||
|
||||
#ifdef LATER
|
||||
@ -113,117 +108,121 @@ done:
|
||||
/* Normal function cleanup */
|
||||
|
||||
FUNC_LEAVE (store);
|
||||
} /* end H5O_std_store_decode() */
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_std_store_encode
|
||||
H5O_cstore_encode
|
||||
PURPOSE
|
||||
Encode a standard data storage message
|
||||
Encode a contiguous data storage message
|
||||
USAGE
|
||||
herr_t H5O_std_store_encode(f, raw_size, p, mesg)
|
||||
herr_t H5O_cstore_encode(f, raw_size, p, mesg)
|
||||
H5F_t *f; IN: pointer to the HDF5 file struct
|
||||
size_t raw_size; IN: size of the raw information buffer
|
||||
const uint8 *p; IN: the raw information buffer
|
||||
const void *mesg; IN: Pointer to the standard storage struct
|
||||
const void *mesg; IN: Pointer to the contiguous storage struct
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function encodes the native memory form of the standard data
|
||||
This function encodes the native memory form of the contiguous data
|
||||
storage message in the "raw" disk form.
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5O_std_store_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *mesg)
|
||||
H5O_cstore_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *mesg)
|
||||
{
|
||||
const H5O_std_store_t *store = (const H5O_std_store_t *)mesg;
|
||||
const H5O_cstore_t *store = (const H5O_cstore_t *)mesg;
|
||||
|
||||
FUNC_ENTER (H5O_std_store_encode, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_cstore_encode, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (raw_size == H5F_SIZEOF_OFFSET(f)+H5F_SIZEOF_SIZE(f));
|
||||
assert (raw_size == H5F_SIZEOF_ADDR(f)+H5F_SIZEOF_SIZE(f));
|
||||
assert (p);
|
||||
assert (store);
|
||||
|
||||
/* encode */
|
||||
H5F_addr_encode (f, &p, &(store->off));
|
||||
H5F_encode_length(f,p,store->len);
|
||||
H5F_addr_encode (f, &p, &(store->addr));
|
||||
H5F_encode_length(f,p,store->size);
|
||||
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
} /* end H5O_std_store_encode() */
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_std_store_copy
|
||||
H5O_cstore_copy
|
||||
PURPOSE
|
||||
Copies a message from MESG to DEST, allocating DEST if necessary.
|
||||
USAGE
|
||||
void *H5O_std_store_copy(mesg, dest)
|
||||
const void *mesg; IN: Pointer to the source standard storage struct
|
||||
const void *dest; IN: Pointer to the destination standard storage struct
|
||||
void *H5O_cstore_copy(mesg, dest)
|
||||
const void *mesg; IN: Pointer to the source contiguous storage
|
||||
struct
|
||||
const void *dest; IN: Pointer to the destination contiguous
|
||||
storage struct
|
||||
RETURNS
|
||||
Pointer to DEST on success, NULL on failure
|
||||
DESCRIPTION
|
||||
This function copies a native (memory) standard storage message,
|
||||
This function copies a native (memory) contiguous storage message,
|
||||
allocating the destination structure if necessary.
|
||||
--------------------------------------------------------------------------*/
|
||||
static void *
|
||||
H5O_std_store_copy (const void *mesg, void *dest)
|
||||
H5O_cstore_copy (const void *mesg, void *dest)
|
||||
{
|
||||
const H5O_std_store_t *src = (const H5O_std_store_t *)mesg;
|
||||
H5O_std_store_t *dst = (H5O_std_store_t *)dest;
|
||||
const H5O_cstore_t *src = (const H5O_cstore_t *)mesg;
|
||||
H5O_cstore_t *dst = (H5O_cstore_t *)dest;
|
||||
|
||||
FUNC_ENTER (H5O_std_store_copy, NULL, NULL);
|
||||
FUNC_ENTER (H5O_cstore_copy, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (src);
|
||||
if (!dst)
|
||||
dst = H5MM_xcalloc (1, sizeof(H5O_std_store_t));
|
||||
dst = H5MM_xcalloc (1, sizeof(H5O_cstore_t));
|
||||
|
||||
/* copy */
|
||||
HDmemcpy(dst,src,sizeof(H5O_std_store_t));
|
||||
HDmemcpy(dst,src,sizeof(H5O_cstore_t));
|
||||
|
||||
FUNC_LEAVE ((void*)dst);
|
||||
} /* end H5O_std_store_copy() */
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_std_store_size
|
||||
H5O_cstore_size
|
||||
PURPOSE
|
||||
Return the raw message size in bytes
|
||||
USAGE
|
||||
void *H5O_std_store_copy(f, mesg)
|
||||
void *H5O_cstore_copy(f, mesg)
|
||||
H5F_t *f; IN: pointer to the HDF5 file struct
|
||||
const void *mesg; IN: Pointer to the source standard storage struct
|
||||
const void *mesg; IN: Pointer to the source contiguous storage
|
||||
struct
|
||||
RETURNS
|
||||
Size of message on success, FAIL on failure
|
||||
DESCRIPTION
|
||||
This function returns the size of the raw standard storage message on
|
||||
This function returns the size of the raw contiguous storage message on
|
||||
success. (Not counting the message type or size fields, only the data
|
||||
portion of the message). It doesn't take into account alignment.
|
||||
--------------------------------------------------------------------------*/
|
||||
static size_t
|
||||
H5O_std_store_size (H5F_t *f, const void *mesg)
|
||||
H5O_cstore_size (H5F_t *f, const void *mesg)
|
||||
{
|
||||
size_t ret_value;
|
||||
|
||||
FUNC_ENTER (H5O_std_store_size, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_cstore_size, FAIL);
|
||||
|
||||
/* All standard data storage messages have the same data */
|
||||
ret_value=H5F_SIZEOF_OFFSET(f)+H5F_SIZEOF_SIZE(f);
|
||||
/* All contiguous data storage messages have the same data */
|
||||
ret_value=H5F_SIZEOF_ADDR(f)+H5F_SIZEOF_SIZE(f);
|
||||
|
||||
FUNC_LEAVE (ret_value);
|
||||
} /* end H5O_std_store_size() */
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_std_store_debug
|
||||
H5O_cstore_debug
|
||||
PURPOSE
|
||||
Prints debugging information for a standard storage message
|
||||
Prints debugging information for a contiguous storage message
|
||||
USAGE
|
||||
void *H5O_std_store_debug(f, mesg, stream, indent, fwidth)
|
||||
void *H5O_cstore_debug(f, mesg, stream, indent, fwidth)
|
||||
H5F_t *f; IN: pointer to the HDF5 file struct
|
||||
const void *mesg; IN: Pointer to the source standard storage struct
|
||||
const void *mesg; IN: Pointer to the source contiguous storage
|
||||
struct
|
||||
FILE *stream; IN: Pointer to the stream for output data
|
||||
intn indent; IN: Amount to indent information by
|
||||
intn fwidth; IN: Field width (?)
|
||||
@ -234,12 +233,12 @@ H5O_std_store_size (H5F_t *f, const void *mesg)
|
||||
parameter.
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5O_std_store_debug (H5F_t *f, const void *mesg, FILE *stream,
|
||||
H5O_cstore_debug (H5F_t *f, const void *mesg, FILE *stream,
|
||||
intn indent, intn fwidth)
|
||||
{
|
||||
const H5O_std_store_t *store = (const H5O_std_store_t *)mesg;
|
||||
const H5O_cstore_t *store = (const H5O_cstore_t *)mesg;
|
||||
|
||||
FUNC_ENTER (H5O_std_store_debug, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_cstore_debug, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -249,14 +248,14 @@ H5O_std_store_debug (H5F_t *f, const void *mesg, FILE *stream,
|
||||
assert (fwidth>=0);
|
||||
|
||||
fprintf (stream, "%*s%-*s ", indent, "", fwidth,
|
||||
"Offset:");
|
||||
H5F_addr_print (stream, &(store->off));
|
||||
"Address:");
|
||||
H5F_addr_print (stream, &(store->addr));
|
||||
fprintf (stream, "\n");
|
||||
|
||||
fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth,
|
||||
"Length:",
|
||||
(unsigned long)(store->len));
|
||||
"Size (bytes):",
|
||||
(unsigned long)(store->size));
|
||||
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
} /* end H5O_std_store_debug() */
|
||||
}
|
||||
|
307
src/H5Oefl.c
Normal file
307
src/H5Oefl.c
Normal file
@ -0,0 +1,307 @@
|
||||
/*
|
||||
* Copyright (C) 1997 NCSA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Programmer: Robb Matzke <matzke@llnl.gov>
|
||||
* Tuesday, November 25, 1997
|
||||
*/
|
||||
#include <H5private.h>
|
||||
#include <H5Eprivate.h>
|
||||
#include <H5MMprivate.h>
|
||||
#include <H5Oprivate.h>
|
||||
|
||||
#define PABLO_MASK H5O_efl_mask
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_efl_decode (H5F_t *f, size_t raw_size, const uint8 *p);
|
||||
static herr_t H5O_efl_encode (H5F_t *f, size_t size, uint8 *p,
|
||||
const void *_mesg);
|
||||
static void *H5O_efl_copy (const void *_mesg, void *_dest);
|
||||
static size_t H5O_efl_size (H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_efl_reset (void *_mesg);
|
||||
static herr_t H5O_efl_debug (H5F_t *f, const void *_mesg, FILE *stream,
|
||||
intn indent, intn fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_EFL[1] = {{
|
||||
H5O_EFL_ID, /*message id number */
|
||||
"external file list", /*message name for debugging */
|
||||
sizeof(H5O_efl_t), /*native message size */
|
||||
H5G_NOTHING_CACHED, /*symtab entry `type' field */
|
||||
H5O_efl_decode, /*decode message */
|
||||
H5O_efl_encode, /*encode message */
|
||||
NULL, /*get messaage from stab entry */
|
||||
NULL, /*put message into stab entry */
|
||||
H5O_efl_copy, /*copy native value */
|
||||
H5O_efl_size, /*size of message on disk */
|
||||
H5O_efl_reset, /*reset method */
|
||||
H5O_efl_debug, /*debug the message */
|
||||
}};
|
||||
|
||||
|
||||
/* Interface initialization */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_decode
|
||||
*
|
||||
* Purpose: Decode an external file list message and return a pointer to
|
||||
* the message (and some other data).
|
||||
*
|
||||
* Return: Success: Ptr to a new message struct.
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
H5O_efl_decode (H5F_t *f, size_t raw_size, const uint8 *p)
|
||||
{
|
||||
H5O_efl_t *mesg = NULL;
|
||||
int i;
|
||||
|
||||
FUNC_ENTER (H5O_efl_decode, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (p);
|
||||
|
||||
/* decode */
|
||||
mesg = H5MM_xcalloc (1, sizeof(H5O_efl_t));
|
||||
H5F_addr_decode (f, &p, &(mesg->heap_addr));
|
||||
UINT32DECODE (p, mesg->nalloc);
|
||||
assert (mesg->nalloc>0);
|
||||
UINT32DECODE (p, mesg->nused);
|
||||
assert (mesg->nused<=mesg->nalloc);
|
||||
|
||||
mesg->offset = H5MM_xmalloc (mesg->nalloc * sizeof(size_t));
|
||||
for (i=0; i<mesg->nused; i++) {
|
||||
UINT32DECODE (p, mesg->offset[i]);
|
||||
}
|
||||
|
||||
FUNC_LEAVE (mesg);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_encode
|
||||
*
|
||||
* Purpose: Encodes a message
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_efl_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg)
|
||||
{
|
||||
const H5O_efl_t *mesg = (const H5O_efl_t *)_mesg;
|
||||
int i;
|
||||
|
||||
FUNC_ENTER (H5O_efl_encode, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (mesg);
|
||||
assert (raw_size == H5O_efl_size (f, _mesg));
|
||||
assert (p);
|
||||
|
||||
/* encode */
|
||||
H5F_addr_encode (f, &p, &(mesg->heap_addr));
|
||||
UINT32ENCODE (p, mesg->nalloc);
|
||||
UINT32ENCODE (p, mesg->nused);
|
||||
for (i=0; i<mesg->nused; i++) {
|
||||
UINT32ENCODE (p, mesg->offset[i]);
|
||||
}
|
||||
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_copy
|
||||
*
|
||||
* Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
|
||||
* necessary.
|
||||
*
|
||||
* Return: Success: Ptr to _DEST
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
H5O_efl_copy (const void *_mesg, void *_dest)
|
||||
{
|
||||
const H5O_efl_t *mesg = (const H5O_efl_t *)_mesg;
|
||||
H5O_efl_t *dest = (H5O_efl_t *)_dest;
|
||||
int i;
|
||||
|
||||
FUNC_ENTER (H5O_efl_copy, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (mesg);
|
||||
if (!dest) {
|
||||
dest = H5MM_xcalloc (1, sizeof(H5O_efl_t));
|
||||
dest->offset = H5MM_xmalloc (mesg->nalloc * sizeof(size_t));
|
||||
} else if (dest->nalloc<mesg->nalloc) {
|
||||
H5MM_xfree (dest->offset);
|
||||
dest->offset = H5MM_xmalloc (mesg->nalloc * sizeof(size_t));
|
||||
}
|
||||
|
||||
dest->heap_addr = mesg->heap_addr;
|
||||
dest->nalloc = mesg->nalloc;
|
||||
dest->nused = mesg->nused;
|
||||
|
||||
for (i=0; i<mesg->nused; i++) {
|
||||
dest->offset[i] = mesg->offset[i];
|
||||
}
|
||||
|
||||
FUNC_LEAVE ((void*)dest);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_size
|
||||
*
|
||||
* Purpose: Returns the size of the raw message in bytes not counting the
|
||||
* message type or size fields, but only the data fields. This
|
||||
* function doesn't take into account message alignment.
|
||||
*
|
||||
* Return: Success: Message data size in bytes.
|
||||
*
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static size_t
|
||||
H5O_efl_size (H5F_t *f, const void *_mesg)
|
||||
{
|
||||
const H5O_efl_t *mesg = (const H5O_efl_t *)_mesg;
|
||||
size_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER (H5O_efl_size, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (mesg);
|
||||
|
||||
ret_value = H5F_SIZEOF_ADDR (f) + /*heap address */
|
||||
4 + /*num slots allocated */
|
||||
4 + /*num slots used */
|
||||
mesg->nalloc * 4; /*name offsets in heap */
|
||||
|
||||
FUNC_LEAVE (ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_reset
|
||||
*
|
||||
* Purpose: Frees internal pointers and resets the message to an
|
||||
* initialial state.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_efl_reset (void *_mesg)
|
||||
{
|
||||
H5O_efl_t *mesg = (H5O_efl_t *)_mesg;
|
||||
|
||||
FUNC_ENTER (H5O_efl_reset, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (mesg);
|
||||
|
||||
/* reset */
|
||||
mesg->nused = mesg->nalloc = 0;
|
||||
mesg->offset = H5MM_xfree (mesg->offset);
|
||||
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_debug
|
||||
*
|
||||
* Purpose: Prints debugging info for a message.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_efl_debug (H5F_t *f, const void *_mesg, FILE *stream, intn indent,
|
||||
intn fwidth)
|
||||
{
|
||||
const H5O_efl_t *mesg = (const H5O_efl_t *)_mesg;
|
||||
char buf[64];
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER (H5O_efl_debug, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (mesg);
|
||||
assert (stream);
|
||||
assert (indent>=0);
|
||||
assert (fwidth>=0);
|
||||
|
||||
fprintf (stream, "%*s%-*s ", indent, "", fwidth,
|
||||
"Heap address:");
|
||||
H5F_addr_print (stream, &(mesg->heap_addr));
|
||||
fprintf (stream, "\n");
|
||||
|
||||
fprintf (stream, "%*s%-*s %u/%u\n", indent, "", fwidth,
|
||||
"Slots used/allocated:",
|
||||
mesg->nused, mesg->nalloc);
|
||||
|
||||
for (i=0; i<mesg->nused; i++) {
|
||||
sprintf (buf, "Name %d:", i+1);
|
||||
fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth,
|
||||
buf,
|
||||
(unsigned long)(mesg->offset[i]));
|
||||
}
|
||||
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
}
|
@ -37,9 +37,9 @@ const H5O_class_t H5O_ISTORE[1] = {{
|
||||
H5O_istore_debug, /*debug the message */
|
||||
}};
|
||||
|
||||
/* Is the interface initialized? */
|
||||
/* Interface initialization */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -65,7 +65,7 @@ H5O_istore_decode (H5F_t *f, size_t raw_size, const uint8 *p)
|
||||
H5O_istore_t *mesg = NULL;
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER (H5O_istore_decode, NULL, NULL);
|
||||
FUNC_ENTER (H5O_istore_decode, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -112,7 +112,7 @@ H5O_istore_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg)
|
||||
const H5O_istore_t *mesg = (const H5O_istore_t *)_mesg;
|
||||
int i;
|
||||
|
||||
FUNC_ENTER (H5O_istore_encode, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_istore_encode, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -163,7 +163,7 @@ H5O_istore_copy (const void *_mesg, void *_dest)
|
||||
const H5O_istore_t *mesg = (const H5O_istore_t *)_mesg;
|
||||
H5O_istore_t *dest = (H5O_istore_t *)_dest;
|
||||
|
||||
FUNC_ENTER (H5O_istore_copy, NULL, NULL);
|
||||
FUNC_ENTER (H5O_istore_copy, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (mesg);
|
||||
@ -201,14 +201,14 @@ H5O_istore_size (H5F_t *f, const void *_mesg)
|
||||
const H5O_istore_t *mesg = (const H5O_istore_t *)_mesg;
|
||||
size_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER (H5O_istore_size, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_istore_size, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (mesg);
|
||||
assert (mesg->ndims>0 && mesg->ndims<=H5O_ISTORE_NDIMS);
|
||||
|
||||
ret_value = H5F_SIZEOF_OFFSET (f) + /* B-tree address */
|
||||
ret_value = H5F_SIZEOF_ADDR (f) + /* B-tree address */
|
||||
1 + /* max dimension index */
|
||||
7 + /* reserved bytes */
|
||||
mesg->ndims * 4; /* alignment */
|
||||
@ -241,7 +241,7 @@ H5O_istore_debug (H5F_t *f, const void *_mesg, FILE *stream, intn indent,
|
||||
const H5O_istore_t *mesg = (const H5O_istore_t *)_mesg;
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER (H5O_istore_debug, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_istore_debug, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
|
@ -47,8 +47,9 @@ const H5O_class_t H5O_NAME[1] = {{
|
||||
H5O_name_debug, /*debug the message */
|
||||
}};
|
||||
|
||||
/* Is the interface initialized? */
|
||||
/* Interface initialization */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -75,7 +76,7 @@ H5O_name_decode (H5F_t *f, size_t raw_size, const uint8 *p)
|
||||
H5O_name_t *mesg;
|
||||
char *s;
|
||||
|
||||
FUNC_ENTER (H5O_name_decode, NULL, NULL);
|
||||
FUNC_ENTER (H5O_name_decode, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -114,7 +115,7 @@ H5O_name_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg)
|
||||
const H5O_name_t *mesg = (const H5O_name_t *)_mesg;
|
||||
size_t size;
|
||||
|
||||
FUNC_ENTER (H5O_name_encode, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_name_encode, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -157,7 +158,7 @@ H5O_name_copy (const void *_mesg, void *_dest)
|
||||
const H5O_name_t *mesg = (const H5O_name_t *)_mesg;
|
||||
H5O_name_t *dest = (H5O_name_t *)_dest;
|
||||
|
||||
FUNC_ENTER (H5O_name_copy, NULL, NULL);
|
||||
FUNC_ENTER (H5O_name_copy, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (mesg);
|
||||
@ -197,7 +198,7 @@ H5O_name_size (H5F_t *f, const void *_mesg)
|
||||
const H5O_name_t *mesg = (const H5O_name_t *)_mesg;
|
||||
size_t size;
|
||||
|
||||
FUNC_ENTER (H5O_name_size, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_name_size, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -231,7 +232,7 @@ H5O_name_reset (void *_mesg)
|
||||
{
|
||||
H5O_name_t *mesg = (H5O_name_t *)_mesg;
|
||||
|
||||
FUNC_ENTER (H5O_name_reset, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_name_reset, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (mesg);
|
||||
@ -266,7 +267,7 @@ H5O_name_debug (H5F_t *f, const void *_mesg, FILE *stream,
|
||||
{
|
||||
const H5O_name_t *mesg = (const H5O_name_t *)_mesg;
|
||||
|
||||
FUNC_ENTER (H5O_name_debug, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_name_debug, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
|
@ -87,40 +87,38 @@ typedef struct H5O_t {
|
||||
} H5O_t;
|
||||
|
||||
/*
|
||||
* Null message.
|
||||
* Null Message.
|
||||
*/
|
||||
#define H5O_NULL_ID 0x0000
|
||||
extern const H5O_class_t H5O_NULL[1];
|
||||
|
||||
/*
|
||||
* Simple Dimensionality message.
|
||||
* Simple Dimensionality Message.
|
||||
*/
|
||||
#define H5O_SIM_DIM_ID 0x0001
|
||||
extern const H5O_class_t H5O_SIM_DIM[1];
|
||||
|
||||
typedef H5P_sdim_t H5O_sim_dim_t;
|
||||
#define H5O_SDSPACE_ID 0x0001
|
||||
extern const H5O_class_t H5O_SDSPACE[1];
|
||||
/* operates on an H5P_simple_t struct */
|
||||
|
||||
/*
|
||||
* Simple Datatype message.
|
||||
* Data Type Message.
|
||||
*/
|
||||
#define H5O_SIM_DTYPE_ID 0x0003
|
||||
extern const H5O_class_t H5O_SIM_DTYPE[1];
|
||||
|
||||
typedef h5_atomic_type_t H5O_sim_dtype_t;
|
||||
#define H5O_DTYPE_ID 0x0003
|
||||
extern const H5O_class_t H5O_DTYPE[1];
|
||||
/* operates on an H5T_t struct */
|
||||
|
||||
/*
|
||||
* Standard Data Storage message.
|
||||
* Contiguous Data Storage Message.
|
||||
*/
|
||||
#define H5O_STD_STORE_ID 0x0005
|
||||
extern const H5O_class_t H5O_STD_STORE[1];
|
||||
#define H5O_CSTORE_ID 0x0005
|
||||
extern const H5O_class_t H5O_CSTORE[1];
|
||||
|
||||
typedef struct H5O_std_store_t {
|
||||
haddr_t off;
|
||||
size_t len;
|
||||
} H5O_std_store_t;
|
||||
typedef struct H5O_cstore_t {
|
||||
haddr_t addr;
|
||||
size_t size;
|
||||
} H5O_cstore_t;
|
||||
|
||||
/*
|
||||
* Indexed Data Storage message.
|
||||
* Indexed Data Storage Message.
|
||||
*/
|
||||
#define H5O_ISTORE_ID 0x0008
|
||||
#define H5O_ISTORE_NDIMS 32
|
||||
@ -132,6 +130,19 @@ typedef struct H5O_istore_t {
|
||||
size_t alignment[H5O_ISTORE_NDIMS]; /*algn in logical space */
|
||||
} H5O_istore_t;
|
||||
|
||||
/*
|
||||
* External File List Message
|
||||
*/
|
||||
#define H5O_EFL_ID 0x0009
|
||||
extern const H5O_class_t H5O_EFL[1];
|
||||
|
||||
typedef struct H5O_efl_t {
|
||||
haddr_t heap_addr; /*Address of name heap */
|
||||
uintn nalloc; /*Number of slots allocated */
|
||||
uintn nused; /*Number of slots used */
|
||||
size_t *offset; /*Array of name offsets in heap */
|
||||
} H5O_efl_t;
|
||||
|
||||
/*
|
||||
* Object name message.
|
||||
*/
|
||||
@ -169,7 +180,7 @@ typedef struct H5O_stab_t {
|
||||
|
||||
|
||||
|
||||
herr_t H5O_new (H5F_t *f, intn nlink, size_t size_hint, haddr_t*);
|
||||
herr_t H5O_create (H5F_t *f, intn nlink, size_t size_hint, haddr_t*);
|
||||
intn H5O_link (H5F_t *f, H5G_entry_t *ent, intn adjust);
|
||||
void *H5O_read (H5F_t *f, const haddr_t *addr, H5G_entry_t *ent,
|
||||
const H5O_class_t *type, intn sequence, void *mesg);
|
||||
|
380
src/H5Osdim.c
380
src/H5Osdim.c
@ -1,13 +1,13 @@
|
||||
/****************************************************************************
|
||||
* 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. *
|
||||
* *
|
||||
* NCSA HDF *
|
||||
* Software Development Group *
|
||||
* National Center for Supercomputing Applications *
|
||||
* University of Illinois at Urbana-Champaign *
|
||||
* 605 E. Springfield, Champaign IL 61820 *
|
||||
* *
|
||||
* For conditions of distribution and use, see the accompanying *
|
||||
* hdf/COPYING file. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef RCSID
|
||||
@ -16,83 +16,71 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/*LINTLIBRARY */
|
||||
/*+
|
||||
FILE
|
||||
H5Osdim.c
|
||||
HDF5 Simple Dimensionality Object Header Message routines
|
||||
|
||||
EXPORTED ROUTINES
|
||||
|
||||
LIBRARY-SCOPED ROUTINES
|
||||
|
||||
LOCAL ROUTINES
|
||||
+ */
|
||||
|
||||
#include <H5private.h>
|
||||
#include <H5Eprivate.h>
|
||||
#include <H5Gprivate.h>
|
||||
#include <H5MMprivate.h>
|
||||
#include <H5Oprivate.h>
|
||||
|
||||
#define PABLO_MASK H5O_sim_dim_mask
|
||||
#define PABLO_MASK H5O_sdspace_mask
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_sim_dim_decode (H5F_t *f, size_t raw_size, const uint8 *p);
|
||||
static herr_t H5O_sim_dim_encode (H5F_t *f, size_t size, uint8 *p,
|
||||
static void *H5O_sdspace_decode (H5F_t *f, size_t raw_size, const uint8 *p);
|
||||
static herr_t H5O_sdspace_encode (H5F_t *f, size_t size, uint8 *p,
|
||||
const void *_mesg);
|
||||
static void *H5O_sim_dim_fast (const H5G_cache_t *cache, void *_mesg);
|
||||
static hbool_t H5O_sim_dim_cache (H5G_type_t *cache_type, H5G_cache_t *cache,
|
||||
static void *H5O_sdspace_fast (const H5G_cache_t *cache, void *_mesg);
|
||||
static hbool_t H5O_sdspace_cache (H5G_type_t *cache_type, H5G_cache_t *cache,
|
||||
const void *_mesg);
|
||||
static void *H5O_sim_dim_copy (const void *_mesg, void *_dest);
|
||||
static size_t H5O_sim_dim_size (H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_sim_dim_debug (H5F_t *f, const void *_mesg,
|
||||
static void *H5O_sdspace_copy (const void *_mesg, void *_dest);
|
||||
static size_t H5O_sdspace_size (H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_sdspace_debug (H5F_t *f, const void *_mesg,
|
||||
FILE *stream, intn indent, intn fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_SIM_DIM[1] = {{
|
||||
H5O_SIM_DIM_ID, /* message id number */
|
||||
"sim_dim", /* message name for debugging */
|
||||
sizeof (H5O_sim_dim_t), /* native message size */
|
||||
H5G_CACHED_SDATA, /* symtab entry `type' field */
|
||||
H5O_sim_dim_decode, /* decode message */
|
||||
H5O_sim_dim_encode, /* encode message */
|
||||
H5O_sim_dim_fast, /* get message from stab entry */
|
||||
H5O_sim_dim_cache, /* put message into stab entry */
|
||||
H5O_sim_dim_copy, /* copy the native value */
|
||||
H5O_sim_dim_size, /* size of symbol table entry */
|
||||
NULL, /* default reset method */
|
||||
H5O_sim_dim_debug, /* debug the message */
|
||||
const H5O_class_t H5O_SDSPACE[1] = {{
|
||||
H5O_SDSPACE_ID, /* message id number */
|
||||
"simple_dspace", /* message name for debugging */
|
||||
sizeof (H5P_simple_t), /* native message size */
|
||||
H5G_CACHED_SDSPACE, /* symtab entry `type' field */
|
||||
H5O_sdspace_decode, /* decode message */
|
||||
H5O_sdspace_encode, /* encode message */
|
||||
H5O_sdspace_fast, /* get message from stab entry */
|
||||
H5O_sdspace_cache, /* put message into stab entry */
|
||||
H5O_sdspace_copy, /* copy the native value */
|
||||
H5O_sdspace_size, /* size of symbol table entry */
|
||||
NULL, /* default reset method */
|
||||
H5O_sdspace_debug, /* debug the message */
|
||||
}};
|
||||
|
||||
/* Is the interface initialized? */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_sim_dim_decode
|
||||
H5O_sdspace_decode
|
||||
PURPOSE
|
||||
Decode a simple dimensionality message and return a pointer to a memory
|
||||
struct with the decoded information
|
||||
struct with the decoded information
|
||||
USAGE
|
||||
void *H5O_sim_dim_decode(f, raw_size, p)
|
||||
H5F_t *f; IN: pointer to the HDF5 file struct
|
||||
size_t raw_size; IN: size of the raw information buffer
|
||||
const uint8 *p; IN: the raw information buffer
|
||||
void *H5O_sdspace_decode(f, raw_size, p)
|
||||
H5F_t *f; IN: pointer to the HDF5 file struct
|
||||
size_t raw_size; IN: size of the raw information buffer
|
||||
const uint8 *p; IN: the raw information buffer
|
||||
RETURNS
|
||||
Pointer to the new message in native order on success, NULL on failure
|
||||
DESCRIPTION
|
||||
This function decodes the "raw" disk form of a simple dimensionality
|
||||
This function decodes the "raw" disk form of a simple dimensionality
|
||||
message into a struct in memory native format. The struct is allocated
|
||||
within this function using malloc() and is returned to the caller.
|
||||
--------------------------------------------------------------------------*/
|
||||
static void *
|
||||
H5O_sim_dim_decode (H5F_t *f, size_t raw_size, const uint8 *p)
|
||||
H5O_sdspace_decode (H5F_t *f, size_t raw_size, const uint8 *p)
|
||||
{
|
||||
H5O_sim_dim_t *sdim=NULL; /* New simple dimensionality structure */
|
||||
uintn u; /* local counting variable */
|
||||
H5P_simple_t *sdim=NULL; /* New simple dimensionality structure */
|
||||
uintn u; /* local counting variable */
|
||||
|
||||
FUNC_ENTER (H5O_sim_dim_decode, NULL, NULL);
|
||||
FUNC_ENTER (H5O_sdspace_decode, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -100,28 +88,28 @@ H5O_sim_dim_decode (H5F_t *f, size_t raw_size, const uint8 *p)
|
||||
assert (p);
|
||||
|
||||
/* decode */
|
||||
if((sdim = H5MM_xcalloc (1, sizeof(H5O_sim_dim_t)))!=NULL)
|
||||
if((sdim = H5MM_xcalloc (1, sizeof(H5P_simple_t)))!=NULL)
|
||||
{
|
||||
UINT32DECODE(p,sdim->rank);
|
||||
UINT32DECODE(p,sdim->dim_flags);
|
||||
if(sdim->rank>0)
|
||||
{
|
||||
sdim->size=H5MM_xmalloc(sizeof(uint32)*sdim->rank);
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
UINT32DECODE(p,sdim->size[u]);
|
||||
if(sdim->dim_flags&0x01)
|
||||
{
|
||||
sdim->max=H5MM_xmalloc(sizeof(uint32)*sdim->rank);
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
UINT32DECODE(p,sdim->max[u]);
|
||||
} /* end if */
|
||||
if(sdim->dim_flags&0x02)
|
||||
{
|
||||
sdim->perm=H5MM_xmalloc(sizeof(uint32)*sdim->rank);
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
UINT32DECODE(p,sdim->perm[u]);
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
UINT32DECODE(p,sdim->rank);
|
||||
UINT32DECODE(p,sdim->dim_flags);
|
||||
if(sdim->rank>0)
|
||||
{
|
||||
sdim->size=H5MM_xmalloc(sizeof(uint32)*sdim->rank);
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
UINT32DECODE(p,sdim->size[u]);
|
||||
if(sdim->dim_flags&0x01)
|
||||
{
|
||||
sdim->max=H5MM_xmalloc(sizeof(uint32)*sdim->rank);
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
UINT32DECODE(p,sdim->max[u]);
|
||||
} /* end if */
|
||||
if(sdim->dim_flags&0x02)
|
||||
{
|
||||
sdim->perm=H5MM_xmalloc(sizeof(uint32)*sdim->rank);
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
UINT32DECODE(p,sdim->perm[u]);
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
|
||||
#ifdef LATER
|
||||
@ -135,32 +123,32 @@ done:
|
||||
/* Normal function cleanup */
|
||||
|
||||
FUNC_LEAVE (sdim);
|
||||
} /* end H5O_sim_dim_decode() */
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_sim_dim_encode
|
||||
H5O_sdspace_encode
|
||||
PURPOSE
|
||||
Encode a simple dimensionality message
|
||||
USAGE
|
||||
herr_t H5O_sim_dim_encode(f, raw_size, p, mesg)
|
||||
H5F_t *f; IN: pointer to the HDF5 file struct
|
||||
size_t raw_size; IN: size of the raw information buffer
|
||||
const uint8 *p; IN: the raw information buffer
|
||||
const void *mesg; IN: Pointer to the simple dimensionality struct
|
||||
herr_t H5O_sdspace_encode(f, raw_size, p, mesg)
|
||||
H5F_t *f; IN: pointer to the HDF5 file struct
|
||||
size_t raw_size; IN: size of the raw information buffer
|
||||
const uint8 *p; IN: the raw information buffer
|
||||
const void *mesg; IN: Pointer to the simple dimensionality struct
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function encodes the native memory form of the simple
|
||||
This function encodes the native memory form of the simple
|
||||
dimensionality message in the "raw" disk form.
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5O_sim_dim_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *mesg)
|
||||
H5O_sdspace_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *mesg)
|
||||
{
|
||||
const H5O_sim_dim_t *sdim = (const H5O_sim_dim_t *)mesg;
|
||||
uintn u; /* Local counting variable */
|
||||
const H5P_simple_t *sdim = (const H5P_simple_t *)mesg;
|
||||
uintn u; /* Local counting variable */
|
||||
|
||||
FUNC_ENTER (H5O_sim_dim_encode, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_sdspace_encode, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -173,165 +161,165 @@ H5O_sim_dim_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *mesg)
|
||||
UINT32ENCODE(p,sdim->dim_flags);
|
||||
if(sdim->rank>0)
|
||||
{
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
UINT32ENCODE(p,sdim->size[u]);
|
||||
if(sdim->dim_flags&0x01)
|
||||
{
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
UINT32ENCODE(p,sdim->max[u]);
|
||||
} /* end if */
|
||||
if(sdim->dim_flags&0x02)
|
||||
{
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
UINT32ENCODE(p,sdim->perm[u]);
|
||||
} /* end if */
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
UINT32ENCODE(p,sdim->size[u]);
|
||||
if(sdim->dim_flags&0x01)
|
||||
{
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
UINT32ENCODE(p,sdim->max[u]);
|
||||
} /* end if */
|
||||
if(sdim->dim_flags&0x02)
|
||||
{
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
UINT32ENCODE(p,sdim->perm[u]);
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
} /* end H5O_sim_dim_encode() */
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_sim_dim_fast
|
||||
H5O_sdspace_fast
|
||||
PURPOSE
|
||||
Initializes a new simple dimensionality struct with info from a symbol
|
||||
table entry.
|
||||
table entry.
|
||||
USAGE
|
||||
void *H5O_sim_dim_fast(ent, mesg)
|
||||
const H5G_entry_t *ent; IN: pointer to the symbol table entry
|
||||
const void *mesg; IN: Pointer to the simple dimensionality struct
|
||||
void *H5O_sdspace_fast(ent, mesg)
|
||||
const H5G_entry_t *ent; IN: pointer to the symbol table entry
|
||||
const void *mesg; IN: Pointer to the simple dimensionality struct
|
||||
RETURNS
|
||||
Pointer to the message structure (allocated if none is supplied) on success,
|
||||
NULL on failure
|
||||
NULL on failure
|
||||
DESCRIPTION
|
||||
This function fills the native memory form of the simple dimensionality
|
||||
This function fills the native memory form of the simple dimensionality
|
||||
message from a symbol-table entry cache fields. (This method is required
|
||||
for simple dimensionality, as they can be cached in the symbol-table entry)
|
||||
--------------------------------------------------------------------------*/
|
||||
static void *
|
||||
H5O_sim_dim_fast (const H5G_cache_t *cache, void *mesg)
|
||||
H5O_sdspace_fast (const H5G_cache_t *cache, void *mesg)
|
||||
{
|
||||
H5O_sim_dim_t *sdim = (H5O_sim_dim_t *)mesg;
|
||||
uintn u; /* local counting variable */
|
||||
H5P_simple_t *sdim = (H5P_simple_t *)mesg;
|
||||
uintn u; /* local counting variable */
|
||||
|
||||
FUNC_ENTER (H5O_sim_dim_fast, NULL, NULL);
|
||||
FUNC_ENTER (H5O_sdspace_fast, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (cache);
|
||||
|
||||
if (!sdim) sdim = H5MM_xcalloc (1, sizeof(H5O_sim_dim_t));
|
||||
sdim->rank = cache->sdata.ndim;
|
||||
assert (sdim->rank<=NELMTS (cache->sdata.dim));
|
||||
if (!sdim) sdim = H5MM_xcalloc (1, sizeof(H5P_simple_t));
|
||||
sdim->rank = cache->sdspace.ndim;
|
||||
assert (sdim->rank<=NELMTS (cache->sdspace.dim));
|
||||
sdim->dim_flags = 0;
|
||||
sdim->size = H5MM_xmalloc (sizeof(uint32) * sdim->rank);
|
||||
for (u=0; u<sdim->rank; u++) {
|
||||
sdim->size[u] = cache->sdata.dim[u];
|
||||
sdim->size[u] = cache->sdspace.dim[u];
|
||||
}
|
||||
|
||||
FUNC_LEAVE (sdim);
|
||||
} /* end H5O_sim_dim_fast() */
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_sim_dim_cache
|
||||
H5O_sdspace_cache
|
||||
PURPOSE
|
||||
Copies a simple dimensionality message into the cache portion of a symbol
|
||||
table entry.
|
||||
table entry.
|
||||
USAGE
|
||||
hbool_t H5O_sim_dim_cache(ent, mesg)
|
||||
const H5G_entry_t *ent; IN: Pointer to the symbol table entry
|
||||
const void *mesg; IN: Pointer to the simple dimensionality struct
|
||||
hbool_t H5O_sdspace_cache(ent, mesg)
|
||||
const H5G_entry_t *ent; IN: Pointer to the symbol table entry
|
||||
const void *mesg; IN: Pointer to the simple dimensionality struct
|
||||
RETURNS
|
||||
BTRUE if symbol-table modified, BFALSE if not modified, BFAIL on failure.
|
||||
The new cache type is returned through the CACHE_TYPE argument.
|
||||
DESCRIPTION
|
||||
This function is the opposite of the H5O_sim_dim_fast method, it
|
||||
This function is the opposite of the H5O_sdspace_fast method, it
|
||||
copies a message into the cached portion of a symbol-table entry. (This
|
||||
method is required for simple dimensionalities, as they can be cached in
|
||||
the symbol-table entry)
|
||||
--------------------------------------------------------------------------*/
|
||||
static hbool_t
|
||||
H5O_sim_dim_cache (H5G_type_t *cache_type, H5G_cache_t *cache,
|
||||
H5O_sdspace_cache (H5G_type_t *cache_type, H5G_cache_t *cache,
|
||||
const void *mesg)
|
||||
{
|
||||
const H5O_sim_dim_t *sdim = (const H5O_sim_dim_t *)mesg;
|
||||
uintn u; /* Local counting variable */
|
||||
const H5P_simple_t *sdim = (const H5P_simple_t *)mesg;
|
||||
uintn u; /* Local counting variable */
|
||||
hbool_t modified = BFALSE;
|
||||
|
||||
FUNC_ENTER (H5O_sim_dim_cache, NULL, BFAIL);
|
||||
FUNC_ENTER (H5O_sdspace_cache, BFAIL);
|
||||
|
||||
/* check args */
|
||||
assert (cache_type);
|
||||
assert (cache);
|
||||
assert (sdim);
|
||||
|
||||
if (sdim->rank <= NELMTS (cache->sdata.dim)) {
|
||||
if (H5G_CACHED_SDATA != *cache_type) {
|
||||
if (sdim->rank <= NELMTS (cache->sdspace.dim)) {
|
||||
if (H5G_CACHED_SDSPACE != *cache_type) {
|
||||
modified = BTRUE;
|
||||
*cache_type = H5G_CACHED_SDATA;
|
||||
cache->sdata.ndim = sdim->rank;
|
||||
*cache_type = H5G_CACHED_SDSPACE;
|
||||
cache->sdspace.ndim = sdim->rank;
|
||||
for (u=0; u<=sdim->rank; u++) {
|
||||
cache->sdata.dim[u] = sdim->size[u];
|
||||
cache->sdspace.dim[u] = sdim->size[u];
|
||||
}
|
||||
} else {
|
||||
if(cache->sdata.ndim != sdim->rank) {
|
||||
if(cache->sdspace.ndim != sdim->rank) {
|
||||
modified = BTRUE;
|
||||
cache->sdata.ndim = sdim->rank;
|
||||
}
|
||||
cache->sdspace.ndim = sdim->rank;
|
||||
}
|
||||
|
||||
/* Check each dimension */
|
||||
if (NULL==cache->sdata.dim) {
|
||||
if (NULL==cache->sdspace.dim) {
|
||||
modified = BTRUE;
|
||||
} else {
|
||||
for (u=0; u<sdim->rank; u++) {
|
||||
if (cache->sdata.dim[u] != sdim->size[u]) {
|
||||
modified = BTRUE;
|
||||
cache->sdata.dim[u] = sdim->size[u];
|
||||
if (cache->sdspace.dim[u] != sdim->size[u]) {
|
||||
modified = BTRUE;
|
||||
cache->sdspace.dim[u] = sdim->size[u];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (H5G_CACHED_SDATA == *cache_type) {
|
||||
} else if (H5G_CACHED_SDSPACE == *cache_type) {
|
||||
/*
|
||||
* Number of dimensions is too large to cache.
|
||||
*/
|
||||
* Number of dimensions is too large to cache.
|
||||
*/
|
||||
modified = TRUE;
|
||||
*cache_type = H5G_NOTHING_CACHED;
|
||||
}
|
||||
|
||||
FUNC_LEAVE (modified);
|
||||
} /* end H5O_sim_dim_cache() */
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_sim_dim_copy
|
||||
H5O_sdspace_copy
|
||||
PURPOSE
|
||||
Copies a message from MESG to DEST, allocating DEST if necessary.
|
||||
USAGE
|
||||
void *H5O_sim_dim_copy(mesg, dest)
|
||||
const void *mesg; IN: Pointer to the source simple dimensionality struct
|
||||
const void *dest; IN: Pointer to the destination simple dimensionality struct
|
||||
void *H5O_sdspace_copy(mesg, dest)
|
||||
const void *mesg; IN: Pointer to the source simple dimensionality struct
|
||||
const void *dest; IN: Pointer to the destination simple dimensionality struct
|
||||
RETURNS
|
||||
Pointer to DEST on success, NULL on failure
|
||||
DESCRIPTION
|
||||
This function copies a native (memory) simple dimensionality message,
|
||||
This function copies a native (memory) simple dimensionality message,
|
||||
allocating the destination structure if necessary.
|
||||
--------------------------------------------------------------------------*/
|
||||
static void *
|
||||
H5O_sim_dim_copy (const void *mesg, void *dest)
|
||||
H5O_sdspace_copy (const void *mesg, void *dest)
|
||||
{
|
||||
const H5O_sim_dim_t *src = (const H5O_sim_dim_t *)mesg;
|
||||
H5O_sim_dim_t *dst = (H5O_sim_dim_t *)dest;
|
||||
const H5P_simple_t *src = (const H5P_simple_t *)mesg;
|
||||
H5P_simple_t *dst = (H5P_simple_t *)dest;
|
||||
|
||||
FUNC_ENTER (H5O_sim_dim_copy, NULL, NULL);
|
||||
FUNC_ENTER (H5O_sdspace_copy, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (src);
|
||||
if (!dst)
|
||||
dst = H5MM_xcalloc (1, sizeof(H5O_sim_dim_t));
|
||||
dst = H5MM_xcalloc (1, sizeof(H5P_simple_t));
|
||||
|
||||
/* deep copy -- pointed-to values are copied also */
|
||||
HDmemcpy(dst,src,sizeof(H5O_sim_dim_t));
|
||||
HDmemcpy(dst,src,sizeof(H5P_simple_t));
|
||||
if (src->size) dst->size = H5MM_xcalloc (src->rank, sizeof(uint32));
|
||||
if (src->max) dst->max = H5MM_xcalloc (src->rank, sizeof(uint32));
|
||||
if (src->perm) dst->perm = H5MM_xcalloc (src->rank, sizeof(uint32));
|
||||
@ -341,76 +329,76 @@ H5O_sim_dim_copy (const void *mesg, void *dest)
|
||||
HDmemcpy(dst->size,src->size,src->rank*sizeof(uint32));
|
||||
/* Check for maximum dimensions and copy those */
|
||||
if((src->dim_flags&0x01)>0)
|
||||
{
|
||||
HDmemcpy(dst->max,src->max,src->rank*sizeof(uint32));
|
||||
} /* end if */
|
||||
{
|
||||
HDmemcpy(dst->max,src->max,src->rank*sizeof(uint32));
|
||||
} /* end if */
|
||||
/* Check for dimension permutation and copy those */
|
||||
if((src->dim_flags&0x02)>0)
|
||||
{
|
||||
HDmemcpy(dst->perm,src->perm,src->rank*sizeof(uint32));
|
||||
} /* end if */
|
||||
{
|
||||
HDmemcpy(dst->perm,src->perm,src->rank*sizeof(uint32));
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
|
||||
FUNC_LEAVE ((void*)dst);
|
||||
} /* end H5O_sim_dim_copy() */
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_sim_dim_size
|
||||
H5O_sdspace_size
|
||||
PURPOSE
|
||||
Return the raw message size in bytes
|
||||
USAGE
|
||||
void *H5O_sim_dim_copy(f, mesg)
|
||||
H5F_t *f; IN: pointer to the HDF5 file struct
|
||||
const void *mesg; IN: Pointer to the source simple dimensionality struct
|
||||
void *H5O_sdspace_copy(f, mesg)
|
||||
H5F_t *f; IN: pointer to the HDF5 file struct
|
||||
const void *mesg; IN: Pointer to the source simple dimensionality struct
|
||||
RETURNS
|
||||
Size of message on success, FAIL on failure
|
||||
DESCRIPTION
|
||||
This function returns the size of the raw simple dimensionality message on
|
||||
This function returns the size of the raw simple dimensionality message on
|
||||
success. (Not counting the message type or size fields, only the data
|
||||
portion of the message). It doesn't take into account alignment.
|
||||
--------------------------------------------------------------------------*/
|
||||
static size_t
|
||||
H5O_sim_dim_size (H5F_t *f, const void *mesg)
|
||||
H5O_sdspace_size (H5F_t *f, const void *mesg)
|
||||
{
|
||||
const H5O_sim_dim_t *sdim = (const H5O_sim_dim_t *)mesg;
|
||||
size_t ret_value=8; /* all dimensionality messages are at least 8 bytes long (rank and flags) */
|
||||
const H5P_simple_t *sdim = (const H5P_simple_t *)mesg;
|
||||
size_t ret_value=8; /* all dimensionality messages are at least 8 bytes long (rank and flags) */
|
||||
|
||||
FUNC_ENTER (H5O_sim_dtype_size, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_sim_dtype_size, FAIL);
|
||||
|
||||
ret_value+=sdim->rank*4; /* add in the dimension sizes */
|
||||
ret_value+=((sdim->dim_flags&0x01)>0)*sdim->rank*4; /* add in the space for the maximum dimensions, if they are present */
|
||||
ret_value+=((sdim->dim_flags&0x02)>0)*sdim->rank*4; /* add in the space for the dimension permutations, if they are present */
|
||||
ret_value+=((sdim->dim_flags&0x01)>0)*sdim->rank*4; /* add in the space for the maximum dimensions, if they are present */
|
||||
ret_value+=((sdim->dim_flags&0x02)>0)*sdim->rank*4; /* add in the space for the dimension permutations, if they are present */
|
||||
|
||||
FUNC_LEAVE (ret_value);
|
||||
} /* end H5O_sim_dim_size() */
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_sim_dim_debug
|
||||
H5O_sdspace_debug
|
||||
PURPOSE
|
||||
Prints debugging information for a simple dimensionality message
|
||||
USAGE
|
||||
void *H5O_sim_dim_debug(f, mesg, stream, indent, fwidth)
|
||||
H5F_t *f; IN: pointer to the HDF5 file struct
|
||||
const void *mesg; IN: Pointer to the source simple dimensionality struct
|
||||
FILE *stream; IN: Pointer to the stream for output data
|
||||
intn indent; IN: Amount to indent information by
|
||||
intn fwidth; IN: Field width (?)
|
||||
void *H5O_sdspace_debug(f, mesg, stream, indent, fwidth)
|
||||
H5F_t *f; IN: pointer to the HDF5 file struct
|
||||
const void *mesg; IN: Pointer to the source simple dimensionality struct
|
||||
FILE *stream; IN: Pointer to the stream for output data
|
||||
intn indent; IN: Amount to indent information by
|
||||
intn fwidth; IN: Field width (?)
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
This function prints debugging output to the stream passed as a
|
||||
This function prints debugging output to the stream passed as a
|
||||
parameter.
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5O_sim_dim_debug (H5F_t *f, const void *mesg, FILE *stream,
|
||||
H5O_sdspace_debug (H5F_t *f, const void *mesg, FILE *stream,
|
||||
intn indent, intn fwidth)
|
||||
{
|
||||
const H5O_sim_dim_t *sdim = (const H5O_sim_dim_t *)mesg;
|
||||
uintn u; /* local counting variable */
|
||||
const H5P_simple_t *sdim = (const H5P_simple_t *)mesg;
|
||||
uintn u; /* local counting variable */
|
||||
|
||||
FUNC_ENTER (H5O_sim_dim_debug, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_sdspace_debug, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
@ -427,19 +415,19 @@ H5O_sim_dim_debug (H5F_t *f, const void *mesg, FILE *stream,
|
||||
(unsigned long)(sdim->dim_flags));
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
fprintf (stream, "%*s%-*s %lx\n", indent, "", fwidth,
|
||||
"Dim Size:",
|
||||
(unsigned long)(sdim->size[u]));
|
||||
"Dim Size:",
|
||||
(unsigned long)(sdim->size[u]));
|
||||
if(sdim->dim_flags&0x01)
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
fprintf (stream, "%*s%-*s %lx\n", indent, "", fwidth,
|
||||
"Dim Max:",
|
||||
(unsigned long)(sdim->max[u]));
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
fprintf (stream, "%*s%-*s %lx\n", indent, "", fwidth,
|
||||
"Dim Max:",
|
||||
(unsigned long)(sdim->max[u]));
|
||||
if(sdim->dim_flags&0x02)
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
fprintf (stream, "%*s%-*s %lx\n", indent, "", fwidth,
|
||||
"Dim Perm:",
|
||||
(unsigned long)(sdim->perm[u]));
|
||||
for(u=0; u<sdim->rank; u++)
|
||||
fprintf (stream, "%*s%-*s %lx\n", indent, "", fwidth,
|
||||
"Dim Perm:",
|
||||
(unsigned long)(sdim->perm[u]));
|
||||
|
||||
FUNC_LEAVE (SUCCEED);
|
||||
} /* end H5O_sim_dim_debug() */
|
||||
}
|
||||
|
||||
|
937
src/H5Osdtyp.c
937
src/H5Osdtyp.c
File diff suppressed because it is too large
Load Diff
@ -50,8 +50,9 @@ const H5O_class_t H5O_STAB[1] = {{
|
||||
H5O_stab_debug, /*debug the message */
|
||||
}};
|
||||
|
||||
/* Is the interface initialized? */
|
||||
/* Interface initialization */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -77,11 +78,11 @@ H5O_stab_decode (H5F_t *f, size_t raw_size, const uint8 *p)
|
||||
{
|
||||
H5O_stab_t *stab;
|
||||
|
||||
FUNC_ENTER (H5O_stab_decode, NULL, NULL);
|
||||
FUNC_ENTER (H5O_stab_decode, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (raw_size == 2*H5F_SIZEOF_OFFSET(f));
|
||||
assert (raw_size == 2*H5F_SIZEOF_ADDR(f));
|
||||
assert (p);
|
||||
|
||||
/* decode */
|
||||
@ -115,11 +116,11 @@ H5O_stab_encode (H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg)
|
||||
{
|
||||
const H5O_stab_t *stab = (const H5O_stab_t *)_mesg;
|
||||
|
||||
FUNC_ENTER (H5O_stab_encode, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_stab_encode, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
assert (raw_size == 2 * H5F_SIZEOF_OFFSET(f));
|
||||
assert (raw_size == 2 * H5F_SIZEOF_ADDR(f));
|
||||
assert (p);
|
||||
assert (stab);
|
||||
|
||||
@ -155,7 +156,7 @@ H5O_stab_fast (const H5G_cache_t *cache, void *_mesg)
|
||||
{
|
||||
H5O_stab_t *stab = (H5O_stab_t *)_mesg;
|
||||
|
||||
FUNC_ENTER (H5O_stab_fast, NULL, NULL);
|
||||
FUNC_ENTER (H5O_stab_fast, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (cache);
|
||||
@ -194,7 +195,7 @@ H5O_stab_cache (H5G_type_t *cache_type, H5G_cache_t *cache, const void *_mesg)
|
||||
const H5O_stab_t *stab = (const H5O_stab_t *)_mesg;
|
||||
hbool_t modified = FALSE;
|
||||
|
||||
FUNC_ENTER (H5O_stab_cache, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_stab_cache, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (cache_type);
|
||||
@ -246,7 +247,7 @@ H5O_stab_copy (const void *_mesg, void *_dest)
|
||||
const H5O_stab_t *stab = (const H5O_stab_t *)_mesg;
|
||||
H5O_stab_t *dest = (H5O_stab_t *)_dest;
|
||||
|
||||
FUNC_ENTER (H5O_stab_copy, NULL, NULL);
|
||||
FUNC_ENTER (H5O_stab_copy, NULL);
|
||||
|
||||
/* check args */
|
||||
assert (stab);
|
||||
@ -281,8 +282,8 @@ H5O_stab_copy (const void *_mesg, void *_dest)
|
||||
static size_t
|
||||
H5O_stab_size (H5F_t *f, const void *_mesg)
|
||||
{
|
||||
FUNC_ENTER (H5O_stab_size, NULL, FAIL);
|
||||
FUNC_LEAVE (2 * H5F_SIZEOF_OFFSET(f));
|
||||
FUNC_ENTER (H5O_stab_size, FAIL);
|
||||
FUNC_LEAVE (2 * H5F_SIZEOF_ADDR(f));
|
||||
}
|
||||
|
||||
|
||||
@ -309,7 +310,7 @@ H5O_stab_debug (H5F_t *f, const void *_mesg, FILE *stream, intn indent,
|
||||
{
|
||||
const H5O_stab_t *stab = (const H5O_stab_t *)_mesg;
|
||||
|
||||
FUNC_ENTER (H5O_stab_debug, NULL, FAIL);
|
||||
FUNC_ENTER (H5O_stab_debug, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (f);
|
||||
|
@ -22,29 +22,39 @@
|
||||
|
||||
/* Private headers needed by this file */
|
||||
#include <H5private.h>
|
||||
#include <H5Cprivate.h> /*for hobjtype_t defn*/
|
||||
#include <H5Gprivate.h> /*for H5G_entry_t */
|
||||
|
||||
/* Flags to indicate special dataspace features are active */
|
||||
#define H5P_VALID_MAX 0x01
|
||||
#define H5P_VALID_PERM 0x02
|
||||
|
||||
typedef struct H5P_sdim_t {
|
||||
uint32 rank; /* Number of dimensions */
|
||||
uint32 dim_flags; /* Dimension flags */
|
||||
uint32 *size; /* Dimension sizes */
|
||||
uint32 *max; /* Maximum dimension sizes */
|
||||
uint32 *perm; /* Dimension permutations */
|
||||
} H5P_sdim_t;
|
||||
typedef struct H5P_simple_t {
|
||||
intn rank; /*number of dimensions */
|
||||
intn dim_flags; /*dimension flags */
|
||||
intn *size; /*dimension sizes */
|
||||
intn *max; /*maximum dimension sizes */
|
||||
intn *perm; /*dimension permutations */
|
||||
} H5P_simple_t;
|
||||
|
||||
typedef struct {
|
||||
H5P_class_t type; /*type of dimensionality object */
|
||||
union {
|
||||
H5P_simple_t simple;/*simple dimensionality information */
|
||||
} u;
|
||||
} H5P_t;
|
||||
|
||||
#define H5P_RESERVED_ATOMS 2
|
||||
|
||||
/* Private functions */
|
||||
herr_t H5P_init(void);
|
||||
hid_t H5P_create(hid_t owner_id, hobjtype_t type, const char *name);
|
||||
uint32 H5P_get_lrank(const H5P_sdim_t *sdim);
|
||||
herr_t H5P_get_ldims(const H5P_sdim_t *sdim, uint32 *dims);
|
||||
hbool_t H5P_is_simple(const H5P_dim_t *sdim);
|
||||
uintn H5P_nelem(const H5P_dim_t *space);
|
||||
herr_t H5P_release(hid_t oid);
|
||||
H5P_t *H5P_copy (const H5P_t *src);
|
||||
herr_t H5P_close (H5P_t *ds);
|
||||
size_t H5P_get_npoints (const H5P_t *ds);
|
||||
herr_t H5P_modify (H5F_t *f, H5G_entry_t *ent, const H5P_t *space);
|
||||
H5P_t *H5P_read (H5F_t *f, H5G_entry_t *ent);
|
||||
intn H5P_cmp (const H5P_t *ds1, const H5P_t *ds2);
|
||||
|
||||
intn H5P_get_lrank (const H5P_simple_t *sdim);
|
||||
herr_t H5P_get_ldims (const H5P_simple_t *sdim, intn *dims);
|
||||
hbool_t H5P_is_simple (const H5P_t *sdim);
|
||||
uintn H5P_nelem (const H5P_t *space);
|
||||
|
||||
#endif
|
||||
|
@ -24,33 +24,30 @@
|
||||
#include <H5Apublic.h>
|
||||
|
||||
/* Define atomic datatypes */
|
||||
#define H5P_SCALAR MAKE_ATOM(H5_DATASPACE,0) /* Atom for scalar dataspace */
|
||||
#define H5P_ALL MAKE_ATOM(H5_DATASPACE,1) /* Atom for "entire" dataspace */
|
||||
#define H5P_ALL (-2)
|
||||
|
||||
/* Different types of dataspaces */
|
||||
#define H5P_TYPE_UNKNOWN 0 /* Dataspace is not unitialized */
|
||||
#define H5P_TYPE_SIMPLE 1 /* Dataspace is simple */
|
||||
#define H5P_TYPE_COMPLEX 2 /* Dataspace is complex */
|
||||
typedef enum H5P_class_t {
|
||||
H5P_NO_CLASS =-1, /*error */
|
||||
H5P_SCALAR =0, /*scalar variable */
|
||||
H5P_SIMPLE =1, /*simple data space */
|
||||
H5P_COMPLEX =2 /*complex data space */
|
||||
} H5P_class_t;
|
||||
|
||||
typedef struct {
|
||||
uintn type; /* Type of dimensionality object */
|
||||
struct H5P_sdim_t *s; /* Pointer to simple dimensionality information */
|
||||
} H5P_dim_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Functions in H5P.c */
|
||||
uintn H5Pnelem(hid_t dim_id);
|
||||
uint32 H5Pget_lrank(hid_t dim_id);
|
||||
herr_t H5Pget_ldims(hid_t dim_id, uint32 *dims);
|
||||
hbool_t H5Pis_simple(hid_t dim_id);
|
||||
herr_t H5Pset_space(hid_t sid, uint32 rank, const uint32 *dims);
|
||||
hid_t H5Pcreate (H5P_class_t type);
|
||||
herr_t H5Pclose (hid_t space_id);
|
||||
size_t H5Pget_npoints (hid_t space_id);
|
||||
|
||||
/* Private functions which need to be globally visible */
|
||||
void H5P_term_interface (void);
|
||||
void H5P_destroy(void *dataspace);
|
||||
intn H5Pget_lrank(hid_t space_id);
|
||||
herr_t H5Pget_ldims(hid_t space_id, intn *dims);
|
||||
hbool_t H5Pis_simple(hid_t space_id);
|
||||
herr_t H5Pset_space(hid_t space_id, intn rank, const intn *dims);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
76
src/H5Tpkg.h
Normal file
76
src/H5Tpkg.h
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) 1997 NCSA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Programmer: Robb Matzke <matzke@llnl.gov>
|
||||
* Monday, December 8, 1997
|
||||
*
|
||||
* Purpose: This file contains declarations which are visible only within
|
||||
* the H5T package. Source files outside the H5T package should
|
||||
* include H5Tprivate.h instead.
|
||||
*/
|
||||
#ifndef H5T_PACKAGE
|
||||
#error "Do not include this file outside the H5T package!"
|
||||
#endif
|
||||
|
||||
#ifndef _H5Tpkg_H
|
||||
#define _H5Tpkg_H
|
||||
|
||||
#include <H5Tprivate.h>
|
||||
|
||||
typedef struct H5T_atomic_t {
|
||||
H5T_order_t order; /*byte order */
|
||||
size_t prec; /*precision in bits */
|
||||
size_t offset; /*bit position of lsb of value */
|
||||
intn lo_pad; /*type of lsb padding */
|
||||
intn hi_pad; /*type of msb padding */
|
||||
union {
|
||||
struct {
|
||||
H5T_sign_t sign; /*type of fixed-point sign */
|
||||
} i; /*integer; fixed-point types */
|
||||
|
||||
struct {
|
||||
size_t sign; /*bit position of sign bit */
|
||||
size_t epos; /*position of lsb of exponent */
|
||||
size_t esize; /*size of exponent in bits */
|
||||
uint64 ebias; /*exponent bias */
|
||||
size_t mpos; /*position of lsb of mantissa */
|
||||
size_t msize; /*size of mantissa */
|
||||
H5T_norm_t norm; /*normalization */
|
||||
intn pad; /*type of padding for internal bits */
|
||||
} f; /*floating-point types */
|
||||
|
||||
struct {
|
||||
H5T_cset_t cset; /*character set */
|
||||
H5T_str_t spad; /*space or null padding of extra bytes */
|
||||
} s;
|
||||
} u;
|
||||
} H5T_atomic_t;
|
||||
|
||||
typedef struct H5T_compnd_t {
|
||||
intn nalloc; /*num entries allocated in MEMB array */
|
||||
intn nmembs; /*number of members defined in struct */
|
||||
struct H5T_member_t *memb; /*array of struct members */
|
||||
} H5T_compnd_t;
|
||||
|
||||
struct H5T_t {
|
||||
hbool_t locked; /*if locked, then can't be modified */
|
||||
H5T_class_t type; /*which class of type is this? */
|
||||
size_t size; /*total size of an instance of this type*/
|
||||
union {
|
||||
H5T_atomic_t atomic; /*an atomic data type */
|
||||
H5T_compnd_t compnd; /*a compound data type (struct) */
|
||||
} u;
|
||||
};
|
||||
|
||||
typedef struct H5T_member_t {
|
||||
char *name; /*name of this member */
|
||||
size_t offset; /*offset from beginning of struct */
|
||||
intn ndims; /*member dimensionality */
|
||||
size_t dim[4]; /*size in each dimension */
|
||||
size_t perm[4];/*index permutation */
|
||||
struct H5T_t type; /*type of this member */
|
||||
} H5T_member_t;
|
||||
|
||||
|
||||
#endif
|
@ -1,13 +1,13 @@
|
||||
/****************************************************************************
|
||||
* 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. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
@ -22,40 +22,23 @@
|
||||
|
||||
/* Private headers needed by this file */
|
||||
#include <H5private.h>
|
||||
#include <H5Cprivate.h> /*for hobjtype_t defn*/
|
||||
#include <H5Gprivate.h> /*for H5G_entry_t */
|
||||
|
||||
#define H5T_RESERVED_ATOMS 8
|
||||
|
||||
/* Structure for storing information about a field in a compound datatype */
|
||||
typedef struct {
|
||||
char *name; /* Name of the field */
|
||||
uintn name_off; /* Offset of name in global small-data heap */
|
||||
uintn struct_off; /* Offset of field within structure */
|
||||
h5_atomic_type_t dt; /* Datatype of the field */
|
||||
hid_t dim_id; /* dimensionality ID of the field */
|
||||
} h5_field_info_t;
|
||||
typedef struct H5T_t H5T_t;
|
||||
|
||||
/* Structure for storing information about a compound datatype */
|
||||
typedef struct {
|
||||
uintn n; /* Number of fields */
|
||||
uintn mem_size; /* Size of the compound structure in memory */
|
||||
uintn disk_size; /* Size of the compound structure on disk */
|
||||
h5_field_info_t *flist; /* List of fields in the compound object */
|
||||
} h5_compound_info_t;
|
||||
herr_t H5T_init (void);
|
||||
|
||||
/* Structure for storing information any datatype */
|
||||
typedef struct {
|
||||
h5_atomic_type_t dt; /* Base type of this object */
|
||||
char *name; /* Name of datatype */
|
||||
h5_compound_info_t *ci; /* Information for compound datatypes */
|
||||
} h5_datatype_t;
|
||||
|
||||
/* Private functions */
|
||||
herr_t H5T_init(void);
|
||||
hid_t H5T_create(hid_t owner_id, hobjtype_t type, const char *name);
|
||||
hbool_t H5T_is_atomic(h5_datatype_t *type);
|
||||
uintn H5T_size(h5_datatype_t *dt, hbool_t mem_flag);
|
||||
intn H5T_arch(h5_datatype_t *dt);
|
||||
herr_t H5T_release(hid_t oid);
|
||||
herr_t H5T_init_interface (void);
|
||||
H5T_t *H5T_create (H5T_class_t type, size_t size);
|
||||
H5T_t *H5T_copy (const H5T_t *old_dt);
|
||||
herr_t H5T_close (H5T_t *dt);
|
||||
size_t H5T_get_size (const H5T_t *dt);
|
||||
intn H5T_cmp (const H5T_t *dt1, const H5T_t *dt2);
|
||||
|
||||
herr_t H5T_insert_member (H5T_t *parent, const char *name, off_t offset,
|
||||
const H5T_t *member);
|
||||
#endif
|
||||
|
121
src/H5Tpublic.h
121
src/H5Tpublic.h
@ -23,62 +23,89 @@
|
||||
#include <H5public.h>
|
||||
#include <H5Apublic.h>
|
||||
|
||||
/* Define atomic datatype bases */
|
||||
#define H5T_CHAR MAKE_ATOM(H5_DATATYPE,0)
|
||||
#define H5T_INT MAKE_ATOM(H5_DATATYPE,1)
|
||||
#define H5T_FLOAT MAKE_ATOM(H5_DATATYPE,2)
|
||||
#define H5T_DATE MAKE_ATOM(H5_DATATYPE,3)
|
||||
#define H5T_TIME MAKE_ATOM(H5_DATATYPE,4)
|
||||
#define H5T_SPTR MAKE_ATOM(H5_DATATYPE,5)
|
||||
#define H5T_PPTR MAKE_ATOM(H5_DATATYPE,6)
|
||||
#define H5T_COMPOUND MAKE_ATOM(H5_DATATYPE,7)
|
||||
/* These are the various classes of data types */
|
||||
typedef enum H5T_class_t {
|
||||
H5T_NO_CLASS =-1, /*error */
|
||||
H5T_FIXED =0, /*fixed-point types */
|
||||
H5T_FLOAT =1, /*floating-point types */
|
||||
H5T_DATE =2, /*date and time types */
|
||||
H5T_STRING =3, /*character string types */
|
||||
H5T_BITFIELD =4, /*bit field types */
|
||||
H5T_OPAQUE =5, /*opaque types */
|
||||
H5T_COMPOUND =6 /*compound types */
|
||||
} H5T_class_t;
|
||||
|
||||
/* Define atomic datatype architectures */
|
||||
#define H5T_BIGENDIAN 0
|
||||
#define H5T_LITTLEENDIAN 1
|
||||
/* Byte orders */
|
||||
typedef enum H5T_order_t {
|
||||
H5T_ORDER_ERROR =-1, /*error */
|
||||
H5T_ORDER_LE =0, /*little endian */
|
||||
H5T_ORDER_BE =1, /*bit endian */
|
||||
H5T_ORDER_VAX =2, /*VAX mixed endian */
|
||||
H5T_ORDER_NONE =3 /*no particular order (strings, bits,..)*/
|
||||
} H5T_order_t;
|
||||
|
||||
/* Define the machine's architecture */
|
||||
/*
|
||||
WARNING!
|
||||
This is _extremly_ crude is is only valid for very generic architectures,
|
||||
anything with a wierd size of integer or wacky floating-point format will
|
||||
_not_ work with this hack. It needs to be replaced with Robb's much more
|
||||
comprehensive code from H5detect.c. -QAK
|
||||
WARNING!
|
||||
*/
|
||||
#define H5T_ARCH_BIGENDIAN 0
|
||||
#define H5T_ARCH_LITTLEENDIAN 1
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define H5T_ARCH_TYPE H5T_ARCH_BIGENDIAN
|
||||
#else /* WORDS_BIGENDIAN */
|
||||
#define H5T_ARCH_TYPE H5T_ARCH_LITTLEENDIAN
|
||||
#endif /* WORDS_BIGENDIAN */
|
||||
/* Types of fixed-point sign schemes */
|
||||
typedef enum H5T_sign_t {
|
||||
H5T_SGN_ERROR =-1, /*error */
|
||||
H5T_SGN_NONE =0, /*this is an unsigned type */
|
||||
H5T_SGN_2 =1 /*two's complement */
|
||||
} H5T_sign_t;
|
||||
|
||||
typedef struct {
|
||||
hid_t base; /* Basic datatype */
|
||||
uint8 len; /* Length of base-type, in bytes */
|
||||
uint8 arch; /* Architecture of the base-type */
|
||||
} h5_atomic_type_t;
|
||||
/* Floating-point normalization schemes */
|
||||
typedef enum H5T_norm_t {
|
||||
H5T_NORM_ERROR =-1, /*error */
|
||||
H5T_NORM_IMPLIED =0, /*msb of mantissa isn't stored, always 1*/
|
||||
H5T_NORM_MSBSET =1, /*msb of mantissa is always 1 */
|
||||
H5T_NORM_NONE =2 /*not normalized */
|
||||
} H5T_norm_t;
|
||||
|
||||
/* Character set to use for text strings */
|
||||
typedef enum H5T_cset_t {
|
||||
H5T_CSET_ERROR =-1, /*error */
|
||||
H5T_CSET_ASCII =0 /*US ASCII */
|
||||
} H5T_cset_t;
|
||||
|
||||
/* Type of padding to use in character strings */
|
||||
typedef enum H5T_str_t {
|
||||
H5T_STR_ERROR =-1, /*error */
|
||||
H5T_STR_NULL =0, /*pad with null term like in C */
|
||||
H5T_STR_SPACE =1, /*pad with spaces like in Fortran */
|
||||
} H5T_str_t;
|
||||
|
||||
|
||||
|
||||
#define H5T_PAD_ZERO (-1) /*pad with all zeros */
|
||||
#define H5T_PAD_ONE (-2) /*pad with all ones */
|
||||
#define H5T_PAD_FROM(X) (X) /*pad with value of bit X */
|
||||
|
||||
/* The predefined types */
|
||||
extern hid_t H5T_NATIVE_CHAR;
|
||||
extern hid_t H5T_NATIVE_UCHAR;
|
||||
extern hid_t H5T_NATIVE_SHORT;
|
||||
extern hid_t H5T_NATIVE_USHORT;
|
||||
extern hid_t H5T_NATIVE_INT;
|
||||
extern hid_t H5T_NATIVE_UINT;
|
||||
extern hid_t H5T_NATIVE_LONG;
|
||||
extern hid_t H5T_NATIVE_ULONG;
|
||||
extern hid_t H5T_NATIVE_FLOAT;
|
||||
extern hid_t H5T_NATIVE_DOUBLE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Functions in H5T.c */
|
||||
uint32 H5Tget_num_fields(hid_t tid);
|
||||
hbool_t H5Tis_field_atomic(hid_t tid,uintn fidx);
|
||||
hbool_t H5Tis_atomic(hid_t tid);
|
||||
herr_t H5Tset_type(hid_t tid,hid_t base,uint8 len,uint8 arch);
|
||||
herr_t H5Tget_type(hid_t tid,hid_t *base,uint8 *len,uint8 *arch);
|
||||
uintn H5Tsize(hid_t tid, hbool_t mem_flag);
|
||||
intn H5Tarch(hid_t tid);
|
||||
herr_t H5Tadd_field (hid_t tid, const char *name, hid_t base, uint8 len,
|
||||
uint8 arch, hid_t space);
|
||||
herr_t H5Tget_fields(hid_t tid, hid_t *field_list);
|
||||
hid_t H5Tcreate (H5T_class_t type, size_t size);
|
||||
hid_t H5Tcopy (hid_t type_id);
|
||||
herr_t H5Tclose (hid_t type_id);
|
||||
hbool_t H5Tequal (hid_t type1_id, hid_t type2_id);
|
||||
|
||||
H5T_class_t H5Tget_class (hid_t type_id);
|
||||
size_t H5Tget_size (hid_t type_id);
|
||||
intn H5Tget_num_members (hid_t type_id);
|
||||
|
||||
herr_t H5Tinsert_member (hid_t parent_id, const char *name, off_t offset,
|
||||
hid_t member_id);
|
||||
|
||||
/* Private functions which need to be globally visible */
|
||||
void H5T_term_interface (void);
|
||||
void H5T_destroy(void *datatype);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
17
src/H5V.c
17
src/H5V.c
@ -14,6 +14,7 @@
|
||||
#define H5V_HYPER_NDIMS H5O_ISTORE_NDIMS
|
||||
#define PABLO_MASK H5V_mask
|
||||
static hbool_t interface_initialize_g = TRUE;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
static herr_t H5V_stride_optimize1 (size_t *np, size_t *elmt_size,
|
||||
size_t *size, intn *stride1);
|
||||
@ -48,7 +49,7 @@ static herr_t
|
||||
H5V_stride_optimize1 (size_t *np, size_t *elmt_size, size_t *size,
|
||||
intn *stride1)
|
||||
{
|
||||
FUNC_ENTER (H5V_stride_optimize1, NULL, FAIL);
|
||||
FUNC_ENTER (H5V_stride_optimize1, FAIL);
|
||||
|
||||
/*
|
||||
* This has to be true because if we optimize the dimensionality down to
|
||||
@ -97,7 +98,7 @@ static herr_t
|
||||
H5V_stride_optimize2 (size_t *np, size_t *elmt_size, size_t *size,
|
||||
intn *stride1, intn *stride2)
|
||||
{
|
||||
FUNC_ENTER (H5V_stride_optimize2, NULL, FAIL);
|
||||
FUNC_ENTER (H5V_stride_optimize2, FAIL);
|
||||
|
||||
/*
|
||||
* This has to be true because if we optimize the dimensionality down to
|
||||
@ -154,7 +155,7 @@ H5V_hyper_stride (size_t n, const size_t *size,
|
||||
size_t acc; /*accumulator */
|
||||
int i; /*counter */
|
||||
|
||||
FUNC_ENTER (H5V_hyper_stride, NULL, (abort(),0));
|
||||
FUNC_ENTER (H5V_hyper_stride, (abort(),0));
|
||||
|
||||
assert (n>=0 && n<H5V_HYPER_NDIMS);
|
||||
assert (size);
|
||||
@ -302,7 +303,7 @@ H5V_hyper_fill (size_t n, const size_t *_size,
|
||||
int i;
|
||||
#endif
|
||||
|
||||
FUNC_ENTER (H5V_hyper_fill, NULL, FAIL);
|
||||
FUNC_ENTER (H5V_hyper_fill, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (n>0 && n<=H5V_HYPER_NDIMS);
|
||||
@ -388,7 +389,7 @@ H5V_hyper_copy (size_t n, const size_t *_size,
|
||||
intn i;
|
||||
#endif
|
||||
|
||||
FUNC_ENTER (H5V_hyper_copy, NULL, FAIL);
|
||||
FUNC_ENTER (H5V_hyper_copy, FAIL);
|
||||
|
||||
/* check args */
|
||||
assert (n>0 && n<=H5V_HYPER_NDIMS);
|
||||
@ -451,7 +452,7 @@ H5V_stride_fill (size_t n, size_t elmt_size, const size_t *size,
|
||||
intn i, j; /*counters */
|
||||
hbool_t carry; /*subtraction carray value */
|
||||
|
||||
FUNC_ENTER (H5V_stride_fill, NULL, FAIL);
|
||||
FUNC_ENTER (H5V_stride_fill, FAIL);
|
||||
|
||||
H5V_vector_cpy (n, idx, size);
|
||||
nelmts = H5V_vector_reduce_product (n, size);
|
||||
@ -509,7 +510,7 @@ H5V_stride_copy (size_t n, size_t elmt_size, const size_t *size,
|
||||
intn i, j; /*counters */
|
||||
hbool_t carry; /*carray for subtraction*/
|
||||
|
||||
FUNC_ENTER (H5V_stride_copy, NULL, FAIL);
|
||||
FUNC_ENTER (H5V_stride_copy, FAIL);
|
||||
|
||||
H5V_vector_cpy (n, idx, size);
|
||||
nelmts = H5V_vector_reduce_product (n, size);
|
||||
@ -570,7 +571,7 @@ H5V_stride_copy2 (size_t nelmts, size_t elmt_size,
|
||||
intn i, j;
|
||||
hbool_t carry;
|
||||
|
||||
FUNC_ENTER (H5V_stride_copy2, NULL, FAIL);
|
||||
FUNC_ENTER (H5V_stride_copy2, FAIL);
|
||||
|
||||
H5V_vector_cpy (dst_n, dst_idx, dst_size);
|
||||
H5V_vector_cpy (src_n, src_idx, src_size);
|
||||
|
360
src/H5detect.c
360
src/H5detect.c
@ -1,20 +1,21 @@
|
||||
static char *FileHeader = "\n\
|
||||
/**/
|
||||
static const char *FileHeader = "\n\
|
||||
/*-------------------------------------------------------------------------\n\
|
||||
* Copyright (C) 1997 National Center for Supercomputing Applications. \n\
|
||||
* All rights reserved. \n\
|
||||
* \n\
|
||||
* Copyright (C) 1997 National Center for Supercomputing Applications. \n\
|
||||
* All rights reserved. \n\
|
||||
* \n\
|
||||
*-------------------------------------------------------------------------";
|
||||
/*
|
||||
*
|
||||
* Created: H5detect.c
|
||||
* 10 Aug 1997
|
||||
* Robb Matzke
|
||||
* 10 Aug 1997
|
||||
* Robb Matzke
|
||||
*
|
||||
* Purpose: This code was borrowed heavily from the `detect.c'
|
||||
* program in the AIO distribution from Lawrence
|
||||
* Livermore National Laboratory.
|
||||
* program in the AIO distribution from Lawrence
|
||||
* Livermore National Laboratory.
|
||||
*
|
||||
* Detects machine byte order and floating point
|
||||
* Detects machine byte order and floating point
|
||||
* format and generates a C source file (native.c)
|
||||
* to describe those paramters.
|
||||
*
|
||||
@ -50,8 +51,7 @@ static char *FileHeader = "\n\
|
||||
* was detected.
|
||||
*/
|
||||
typedef struct detected_t {
|
||||
char *typename;
|
||||
char *varname;
|
||||
const char *varname;
|
||||
int size;
|
||||
int padding;
|
||||
int perm[32];
|
||||
@ -61,11 +61,11 @@ typedef struct detected_t {
|
||||
} detected_t;
|
||||
|
||||
static void print_results (int nd, detected_t *d);
|
||||
static void iprint (detected_t*, int);
|
||||
static void print_known_formats (detected_t*, int);
|
||||
static void iprint (detected_t*);
|
||||
static void print_known_formats (detected_t*);
|
||||
static int byte_cmp (int, void*, void*);
|
||||
static int bit_cmp (int, int*, void*, void*);
|
||||
static void fix_order (int, int, int, int*, char**);
|
||||
static void fix_order (int, int, int, int*, const char **);
|
||||
static void fix_padding (detected_t*);
|
||||
static int imp_bit (int, int*, void*, void*);
|
||||
static int find_bias (int, int, int, int*, void*);
|
||||
@ -95,31 +95,31 @@ static void print_header (void);
|
||||
|
||||
static detected_t Known[] = {
|
||||
/* Single-byte quantities */
|
||||
{"char", "Byte addressable",
|
||||
{"Byte addressable",
|
||||
1, 0, LE_1, INTEGER},
|
||||
|
||||
/* Little-endian fixed-point */
|
||||
{"int16", "Little-endian",
|
||||
{"Little-endian",
|
||||
2, 0, LE_2, INTEGER},
|
||||
{"int32", "Little-endian",
|
||||
{"Little-endian",
|
||||
4, 0, LE_4, INTEGER},
|
||||
|
||||
/* Big-endian fixed-point */
|
||||
{"int16", "Big-endian",
|
||||
{"Big-endian",
|
||||
2, 0, BE_2, INTEGER},
|
||||
{"int32", "Big-endian",
|
||||
{"Big-endian",
|
||||
4, 0, BE_4, INTEGER},
|
||||
|
||||
/* Little-endian IEEE floating-point */
|
||||
{"float32", "Little-endian IEEE",
|
||||
{"Little-endian IEEE",
|
||||
4, 0, LE_4, 31, 0, 23, 1, 23, 8, 127},
|
||||
{"float64", "Little-endian IEEE",
|
||||
{"Little-endian IEEE",
|
||||
8, 0, LE_8, 63, 0, 52, 1, 52, 11, 1023},
|
||||
|
||||
/* Big-endian IEEE floating-point */
|
||||
{"float32", "Big-endian IEEE",
|
||||
{"Big-endian IEEE",
|
||||
4, 0, BE_4, 31, 0, 23, 1, 23, 8, 127},
|
||||
{"float64", "Big-endian IEEE",
|
||||
{"Big-endian IEEE",
|
||||
8, 0, BE_8, 63, 0, 52, 1, 52, 11, 1023},
|
||||
};
|
||||
|
||||
@ -129,47 +129,45 @@ static detected_t Known[] = {
|
||||
*
|
||||
* Purpose: This macro takes a type like `int' and a base name like
|
||||
* `nati' and detects the byte order. The VAR is used to
|
||||
* construct the names of the C variables defined.
|
||||
* construct the names of the C variables defined.
|
||||
*
|
||||
* Return: void
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* matzke@llnl.gov
|
||||
* Jun 12 1996
|
||||
* Jun 12 1996
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Robb Matzke, 4 Nov 1996
|
||||
* Robb Matzke, 4 Nov 1996
|
||||
* The INFO.perm now contains `-1' for bytes that aren't used and
|
||||
* are always zero. This happens on the Cray for `short' where
|
||||
* sizeof(short) is 8, but only the low-order 4 bytes are ever used.
|
||||
*
|
||||
* Robb Matzke, 4 Nov 1996
|
||||
* Robb Matzke, 4 Nov 1996
|
||||
* Added a `padding' field to indicate how many zero bytes appear to
|
||||
* the left (N) or right (-N) of the value.
|
||||
*
|
||||
* Robb Matzke, 5 Nov 1996
|
||||
* Robb Matzke, 5 Nov 1996
|
||||
* Removed HFILE and CFILE arguments.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#define DETECT_I(TYPE,TYPE_S,VAR,VAR_S,INFO) { \
|
||||
#define DETECT_I(TYPE,VAR,INFO) { \
|
||||
TYPE _v; \
|
||||
int _i, _j; \
|
||||
unsigned char *_x; \
|
||||
memset (&INFO, 0, sizeof(INFO)); \
|
||||
INFO.typename = TYPE_S; \
|
||||
INFO.varname = VAR_S; \
|
||||
INFO.varname = #VAR; \
|
||||
INFO.size = sizeof(TYPE); \
|
||||
for (_i=sizeof(TYPE),_v=0; _i>0; --_i) _v = (_v<<8) + _i; \
|
||||
for (_i=sizeof(TYPE),_v=0; _i>0; --_i) _v = (_v<<8) + _i; \
|
||||
for (_i=0,_x=(unsigned char *)&_v; _i<sizeof(TYPE); _i++) { \
|
||||
_j = (*_x++)-1; \
|
||||
assert (_j<(signed)sizeof(TYPE)); \
|
||||
assert (_j<(signed)sizeof(TYPE)); \
|
||||
INFO.perm[_i] = _j; \
|
||||
} \
|
||||
fix_padding (&(INFO)); \
|
||||
if (!strncmp(TYPE_S, "unsigned", 8)) INFO.sign = 0; \
|
||||
else INFO.sign = 1; \
|
||||
INFO.sign = ('U'!=*(#VAR)); \
|
||||
}
|
||||
|
||||
|
||||
@ -191,22 +189,21 @@ static detected_t Known[] = {
|
||||
* Modifications:
|
||||
*
|
||||
* Robb Matzke, 14 Aug 1996
|
||||
* The byte order detection has been changed because on the Cray
|
||||
* the last pass causes a rounding to occur that causes the least
|
||||
* significant mantissa byte to change unexpectedly.
|
||||
* The byte order detection has been changed because on the Cray
|
||||
* the last pass causes a rounding to occur that causes the least
|
||||
* significant mantissa byte to change unexpectedly.
|
||||
*
|
||||
* Robb Matzke, 5 Nov 1996
|
||||
* Robb Matzke, 5 Nov 1996
|
||||
* Removed HFILE and CFILE arguments.
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#define DETECT_F(TYPE,TYPE_S,VAR,VAR_S,INFO) { \
|
||||
#define DETECT_F(TYPE,VAR,INFO) { \
|
||||
TYPE _v1, _v2, _v3; \
|
||||
int _i, _j, _first=(-1), _last=(-1); \
|
||||
char *_mesg; \
|
||||
int _i, _j, _first=(-1), _last=(-1); \
|
||||
char *_mesg; \
|
||||
\
|
||||
memset (&INFO, 0, sizeof(INFO)); \
|
||||
INFO.typename = TYPE_S; \
|
||||
INFO.varname = VAR_S; \
|
||||
INFO.varname = #VAR; \
|
||||
INFO.size = sizeof(TYPE); \
|
||||
INFO.padding = 0; \
|
||||
\
|
||||
@ -215,13 +212,13 @@ static detected_t Known[] = {
|
||||
_v3 = _v1; _v1 += _v2; _v2 /= 256.0; \
|
||||
if ((_j=byte_cmp(sizeof(TYPE), &_v3, &_v1))>=0) { \
|
||||
if (0==_i || INFO.perm[_i-1]!=_j) { \
|
||||
INFO.perm[_i] = _j; \
|
||||
_last = _i; \
|
||||
INFO.perm[_i] = _j; \
|
||||
_last = _i; \
|
||||
if (_first<0) _first = _i; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
fix_order (sizeof(TYPE), _first, _last, INFO.perm, &_mesg); \
|
||||
fix_order (sizeof(TYPE), _first, _last, INFO.perm, (const char**)&_mesg); \
|
||||
\
|
||||
/* Implicit mantissa bit */ \
|
||||
_v1 = 0.5; \
|
||||
@ -247,7 +244,7 @@ static detected_t Known[] = {
|
||||
INFO.esize = INFO.sign - INFO.epos; \
|
||||
\
|
||||
_v1 = 1.0; \
|
||||
INFO.bias = find_bias (INFO.epos, INFO.esize, INFO.imp, INFO.perm, &_v1); \
|
||||
INFO.bias = find_bias (INFO.epos, INFO.esize, INFO.imp, INFO.perm, &_v1); \
|
||||
}
|
||||
|
||||
|
||||
@ -269,107 +266,101 @@ static detected_t Known[] = {
|
||||
static void
|
||||
print_results (int nd, detected_t *d) {
|
||||
|
||||
int i, j;
|
||||
int i;
|
||||
|
||||
printf ("#define DEFAULT_INTEGER_FIELDS {FALSE,0,0,0,0,0}\n\n");
|
||||
printf ("#define FALSE 0\n");
|
||||
printf ("#define TRUE 1\n");
|
||||
/* Include files */
|
||||
printf ("\
|
||||
#define H5T_PACKAGE /*suppress error about including H5Tpkg.h*/
|
||||
\n\
|
||||
#include <H5private.h>\n\
|
||||
#include <H5Eprivate.h>\n\
|
||||
#include <H5MMprivate.h>\n\
|
||||
#include <H5Tpkg.h>\n\
|
||||
\n\
|
||||
static hbool_t interface_initialize_g = FALSE;\n\
|
||||
#define INTERFACE_INIT NULL\n\
|
||||
\n");
|
||||
|
||||
|
||||
printf ("\ntypedef struct {\n");
|
||||
printf (" uintn class, bytes, padding, size, align;\n");
|
||||
printf (" uintn order[32], sign, imp, mloc, msize, eloc, esize;\n");
|
||||
printf (" uint32 bias;\n");
|
||||
printf ("};\n\n");
|
||||
/* Global definitions for each type */
|
||||
for (i=0; i<nd; i++) {
|
||||
printf ("hid_t H5T_NATIVE_%s;\n", d[i].varname);
|
||||
}
|
||||
|
||||
/* Function declaration */
|
||||
printf ("\n\
|
||||
herr_t\n\
|
||||
H5T_init (void)\n\
|
||||
{\n\
|
||||
H5T_t *dt = NULL;\n\
|
||||
static intn ncalls = 0;\n\
|
||||
\n\
|
||||
FUNC_ENTER (H5T_init, FAIL);\n\
|
||||
\n\
|
||||
if (ncalls++) return SUCCEED; /*already initialized*/\n\
|
||||
\n");
|
||||
|
||||
for (i=0; i<nd; i++) {
|
||||
printf ("\n/*\n");
|
||||
iprint (d+i, 0);
|
||||
print_known_formats (d+i, 0);
|
||||
printf (" */\n");
|
||||
printf ("const H5T_desc_t H5T_%s[1] = {{\n",
|
||||
|
||||
/* Print a comment to describe this section of definitions. */
|
||||
printf ("\n /*\n");
|
||||
iprint (d+i);
|
||||
print_known_formats (d+i);
|
||||
printf (" */\n");
|
||||
|
||||
/* The part common to fixed and floating types */
|
||||
printf ("\
|
||||
dt = H5MM_xcalloc (1, sizeof(H5T_t));\n\
|
||||
dt->locked = TRUE;\n\
|
||||
dt->type = H5T_%s;\n\
|
||||
dt->size = %d;\n\
|
||||
dt->u.atomic.order = H5T_ORDER_%s;\n\
|
||||
dt->u.atomic.prec = %d;\n\
|
||||
dt->u.atomic.lo_pad = H5T_PAD_ZERO;\n\
|
||||
dt->u.atomic.hi_pad = H5T_PAD_ZERO;\n",
|
||||
d[i].msize?"FLOAT":"FIXED", /*class */
|
||||
d[i].size+abs (d[i].padding), /*size */
|
||||
d[i].perm[0]?"BE":"LE", /*byte order */
|
||||
8*d[i].size); /*precision */
|
||||
|
||||
if (0==d[i].msize) {
|
||||
/* The part unique to fixed point types */
|
||||
printf ("\
|
||||
dt->u.atomic.u.i.sign = H5T_SGN_%s;\n",
|
||||
d[i].sign?"2":"NONE");
|
||||
} else {
|
||||
/* The part unique to floating point types */
|
||||
printf ("\
|
||||
dt->u.atomic.u.f.sign = %d;\n\
|
||||
dt->u.atomic.u.f.epos = %d;\n\
|
||||
dt->u.atomic.u.f.esize = %d;\n\
|
||||
dt->u.atomic.u.f.ebias = 0x%08x;\n\
|
||||
dt->u.atomic.u.f.mpos = %d;\n\
|
||||
dt->u.atomic.u.f.msize = %d;\n\
|
||||
dt->u.atomic.u.f.norm = H5T_NORM_%s;\n\
|
||||
dt->u.atomic.u.f.pad = H5T_PAD_ZERO;\n",
|
||||
d[i].sign, /*sign location */
|
||||
d[i].epos, /*exponent loc */
|
||||
d[i].esize, /*exponent size */
|
||||
d[i].bias, /*exponent bias */
|
||||
d[i].mpos, /*mantissa loc */
|
||||
d[i].msize, /*mantissa size */
|
||||
d[i].imp?"IMPLIED":"NONE"); /*normalization */
|
||||
}
|
||||
|
||||
/* Atomize the type */
|
||||
printf ("\
|
||||
if ((H5T_NATIVE_%s = H5Aregister_atom (H5_DATATYPE, dt))<0) {\n\
|
||||
/* Can't initialize type system - atom registration failure */\n\
|
||||
HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL);\n\
|
||||
}\n",
|
||||
d[i].varname);
|
||||
printf (" /* Class */ %s,\n",
|
||||
d[i].msize?"H5T_FLOAT":"H5T_FIXED");
|
||||
printf (" /* Number of bytes */ %d,\n", d[i].size);
|
||||
printf (" /* Zero padding */ %d,\n", d[i].padding);
|
||||
printf (" /* sizeof() */ %d,\n",
|
||||
d[i].size + abs (d[i].padding));
|
||||
|
||||
/* alignment isn't detected yet */
|
||||
printf (" /* Alignment */ %d,\n",
|
||||
d[i].size + abs (d[i].padding));
|
||||
|
||||
printf (" /* Byte order */ {");
|
||||
for (j=0; j<32; j++) {
|
||||
if (j && 0==j%8) printf ("\n ");
|
||||
printf ("%3d%s", j<d[i].size?d[i].perm[j]:-1, j+1<32?",":"");
|
||||
}
|
||||
printf ("},\n");
|
||||
|
||||
if (d[i].msize) {
|
||||
printf (" /* Float sign loc */ %d,\n", d[i].sign);
|
||||
printf (" /* Float implicit bit */ %s,\n",
|
||||
d[i].imp?"TRUE":"FALSE");
|
||||
printf (" /* Float mantissa loc */ %d,\n", d[i].mpos);
|
||||
printf (" /* Float matnissa size */ %d,\n", d[i].msize);
|
||||
printf (" /* Float exponent loc */ %d,\n", d[i].epos);
|
||||
printf (" /* Float exponent size */ %d,\n", d[i].esize);
|
||||
printf (" /* Float exponent bias */ 0x%x,\n", d[i].bias);
|
||||
} else {
|
||||
printf (" /* Signed? */ %s,\n",
|
||||
d[i].sign?"TRUE":"FALSE");
|
||||
printf (" DEFAULT_INTEGER_FIELDS,\n");
|
||||
}
|
||||
printf ("}};\n\n");
|
||||
|
||||
}
|
||||
|
||||
printf (" FUNC_LEAVE (SUCCEED);\n}\n");
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: tprint
|
||||
*
|
||||
* Purpose: Prints a binary number beginning with the most
|
||||
* significant bit and continuing to the least
|
||||
* significant bit.
|
||||
*
|
||||
* If PERM is the null pointer then it isn't used and
|
||||
* _A is assumed to be in big endian order.
|
||||
*
|
||||
* Return: void
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* matzke@llnl.gov
|
||||
* Jun 13, 1996
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#if 0
|
||||
static void
|
||||
tprint (int nbytes, int *perm, void *_a) {
|
||||
|
||||
int i, j;
|
||||
unsigned char *a = (unsigned char *)_a;
|
||||
unsigned char b;
|
||||
|
||||
for (i=0; i<nbytes; i++) {
|
||||
if (perm) {
|
||||
assert (perm[i]<nbytes);
|
||||
b = a[perm[i]];
|
||||
} else {
|
||||
b = a[i];
|
||||
}
|
||||
for (j=0; j<8; j++,b<<=1) putchar (b & 0x80 ? '1' : '0');
|
||||
if (i+1<nbytes) {
|
||||
putchar (' ');
|
||||
if (0==(i+1)%4) putchar (' ');
|
||||
}
|
||||
}
|
||||
putchar ('\n');
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: iprint
|
||||
@ -388,14 +379,14 @@ tprint (int nbytes, int *perm, void *_a) {
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
iprint (detected_t *d, int indent) {
|
||||
iprint (detected_t *d) {
|
||||
|
||||
int i, j, k;
|
||||
|
||||
/*
|
||||
* Print the byte ordering above the bit fields.
|
||||
*/
|
||||
printf ("%*s * ", indent, "");
|
||||
printf (" * ");
|
||||
for (i=d->size-1; i>=0; --i) {
|
||||
printf ("%4d", d->perm[i]);
|
||||
if (i>0) fputs (" ", stdout);
|
||||
@ -406,7 +397,7 @@ iprint (detected_t *d, int indent) {
|
||||
/*
|
||||
* Print the bit fields
|
||||
*/
|
||||
printf ("%*s * ", indent, "");
|
||||
printf (" * ");
|
||||
for (i=d->size-1,k=d->size*8-1; i>=0; --i) {
|
||||
for (j=7; j>=0; --j) {
|
||||
if (k==d->sign && d->msize) {
|
||||
@ -415,8 +406,12 @@ iprint (detected_t *d, int indent) {
|
||||
putchar ('E');
|
||||
} else if (k>=d->mpos && k<d->mpos+d->msize) {
|
||||
putchar ('M');
|
||||
} else {
|
||||
} else if (d->msize) {
|
||||
putchar ('?'); /*unknown floating point bit*/
|
||||
} else if (d->sign) {
|
||||
putchar ('I');
|
||||
} else {
|
||||
putchar ('U');
|
||||
}
|
||||
--k;
|
||||
}
|
||||
@ -431,7 +426,7 @@ iprint (detected_t *d, int indent) {
|
||||
* Is there an implicit bit in the mantissa.
|
||||
*/
|
||||
if (d->msize) {
|
||||
printf ("%*s * Implicit bit? %s\n", indent, "", d->imp?"yes":"no");
|
||||
printf (" * Implicit bit? %s\n", d->imp?"yes":"no");
|
||||
}
|
||||
}
|
||||
|
||||
@ -439,7 +434,7 @@ iprint (detected_t *d, int indent) {
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: print_known_formats
|
||||
*
|
||||
* Purpose: Prints archetecture names for the specified format
|
||||
* Purpose: Prints archetecture names for the specified format
|
||||
* description, if any.
|
||||
*
|
||||
* Return: void
|
||||
@ -453,7 +448,7 @@ iprint (detected_t *d, int indent) {
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
print_known_formats (detected_t *d, int indent) {
|
||||
print_known_formats (detected_t *d) {
|
||||
|
||||
int i, j, diff;
|
||||
int n=sizeof(Known)/sizeof(Known[0]);
|
||||
@ -465,7 +460,7 @@ print_known_formats (detected_t *d, int indent) {
|
||||
}
|
||||
if (diff) continue;
|
||||
|
||||
/* if (d->sign != Known[i].sign) continue;*/
|
||||
/* if (d->sign != Known[i].sign) continue;*/
|
||||
if (d->mpos != Known[i].mpos) continue;
|
||||
if (d->msize != Known[i].msize) continue;
|
||||
if (d->imp != Known[i].imp) continue;
|
||||
@ -473,8 +468,7 @@ print_known_formats (detected_t *d, int indent) {
|
||||
if (d->esize != Known[i].esize) continue;
|
||||
if (d->bias != Known[i].bias) continue;
|
||||
|
||||
printf ("%*s * %s %s\n",
|
||||
indent, "", Known[i].varname, Known[i].typename);
|
||||
printf (" * %s\n", Known[i].varname);
|
||||
}
|
||||
}
|
||||
|
||||
@ -514,7 +508,7 @@ byte_cmp (int n, void *_a, void *_b) {
|
||||
* Function: bit_cmp
|
||||
*
|
||||
* Purpose: Compares two bit vectors and returns the index for the
|
||||
* first bit that differs between the two vectors. The
|
||||
* first bit that differs between the two vectors. The
|
||||
* size of the vector is NBYTES. PERM is a mapping from
|
||||
* actual order to little endian.
|
||||
*
|
||||
@ -559,7 +553,7 @@ bit_cmp (int nbytes, int *perm, void *_a, void *_b) {
|
||||
* creates a permutation vector that maps the actual order
|
||||
* of a floating point number to little-endian.
|
||||
*
|
||||
* This function assumes that the mantissa byte ordering
|
||||
* This function assumes that the mantissa byte ordering
|
||||
* implies the total ordering.
|
||||
*
|
||||
* Return: void
|
||||
@ -573,7 +567,7 @@ bit_cmp (int nbytes, int *perm, void *_a, void *_b) {
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
fix_order (int n, int first, int last, int *perm, char **mesg) {
|
||||
fix_order (int n, int first, int last, int *perm, const char **mesg) {
|
||||
|
||||
int i;
|
||||
|
||||
@ -623,7 +617,7 @@ fix_order (int n, int first, int last, int *perm, char **mesg) {
|
||||
* from the permutation, and the `padding' field is set to an
|
||||
* appropriate value.
|
||||
*
|
||||
* If N bytes of padding appear to the left (lower address) of
|
||||
* If N bytes of padding appear to the left (lower address) of
|
||||
* the value, then `padding=N'. If N bytes of padding appear
|
||||
* to the right of the value then `padding=(-N)'.
|
||||
*
|
||||
@ -681,7 +675,7 @@ fix_padding (detected_t *d) {
|
||||
* floating point values stored in _A and _B then the function
|
||||
* returns non-zero.
|
||||
*
|
||||
* This function assumes that the exponent occupies higher
|
||||
* This function assumes that the exponent occupies higher
|
||||
* order bits than the mantissa and that the most significant
|
||||
* bit of the mantissa is next to the least signficant bit
|
||||
* of the exponent.
|
||||
@ -690,7 +684,7 @@ fix_padding (detected_t *d) {
|
||||
* Return: Success: Non-zero if the most significant bit
|
||||
* of the mantissa is discarded (ie, the
|
||||
* mantissa has an implicit `one' as the
|
||||
* most significant bit). Otherwise,
|
||||
* most significant bit). Otherwise,
|
||||
* returns zero.
|
||||
*
|
||||
* Failure: exit(1)
|
||||
@ -701,7 +695,7 @@ fix_padding (detected_t *d) {
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Robb Matzke, 6 Nov 1996
|
||||
* Robb Matzke, 6 Nov 1996
|
||||
* Fixed a bug that occurs with non-implicit architectures.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
@ -716,7 +710,7 @@ imp_bit (int n, int *perm, void *_a, void *_b) {
|
||||
|
||||
/*
|
||||
* Look for the least significant bit that has changed between
|
||||
* A and B. This is the least significant bit of the exponent.
|
||||
* A and B. This is the least significant bit of the exponent.
|
||||
*/
|
||||
changed = bit_cmp (n, perm, a, b);
|
||||
assert (changed>=0);
|
||||
@ -750,7 +744,7 @@ imp_bit (int n, int *perm, void *_a, void *_b) {
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Robb Matzke, 6 Nov 1996
|
||||
* Robb Matzke, 6 Nov 1996
|
||||
* Fixed a bug with non-implicit architectures returning the
|
||||
* wrong exponent bias.
|
||||
*
|
||||
@ -803,11 +797,11 @@ print_header (void) {
|
||||
char real_name[30], *comma;
|
||||
char host_name[256];
|
||||
int i, n;
|
||||
char *s;
|
||||
static char *month_name[] = {
|
||||
const char *s;
|
||||
static const char *month_name[] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
static char *purpose = "\
|
||||
static const char *purpose = "\
|
||||
This machine-generated source code contains\n\
|
||||
information about the various integer and\n\
|
||||
floating point numeric formats found on this\n\
|
||||
@ -819,7 +813,7 @@ Each of the numeric formats listed below are\n\
|
||||
printed from most significant bit to least\n\
|
||||
significant bit even though the actual bytes\n\
|
||||
might be stored in a different order in\n\
|
||||
memory. The integers above each binary byte\n\
|
||||
memory. The integers above each binary byte\n\
|
||||
indicate the relative order of the bytes in\n\
|
||||
memory; little-endian machines have\n\
|
||||
decreasing numbers while big-endian machines\n\
|
||||
@ -830,11 +824,12 @@ letters with `S' for the mantissa sign bit,\n\
|
||||
`M' for the mantissa magnitude, and `E' for\n\
|
||||
the exponent. The exponent has an associated\n\
|
||||
bias which can be subtracted to find the\n\
|
||||
true exponent. The radix point is assumed\n\
|
||||
to be before the first `M' bit. Any bit\n\
|
||||
not falling into one of these categories\n\
|
||||
is printed as a question mark, as are all\n\
|
||||
bits of integer quantities.\n\
|
||||
true exponent. The radix point is assumed\n\
|
||||
to be before the first `M' bit. Any bit\n\
|
||||
of a floating-point value not falling into one\n\
|
||||
of these categories is printed as a question\n\
|
||||
mark. Bits of fixed-point types are printed as\n\
|
||||
`I' for 2's complement and `U' for magnitude.\n\
|
||||
\n\
|
||||
If the most significant bit of the normalized\n\
|
||||
mantissa (always a `1' except for `0.0') is\n\
|
||||
@ -842,7 +837,7 @@ not stored then an `implicit=yes' appears\n\
|
||||
under the field description. In thie case,\n\
|
||||
the radix point is still assumed to be\n\
|
||||
before the first `M' but after the implicit\n\
|
||||
bit.";
|
||||
bit.\n";
|
||||
|
||||
/*
|
||||
* The real name is the first item from the passwd gecos field.
|
||||
@ -869,7 +864,8 @@ bit.";
|
||||
/*
|
||||
* The file header: warning, copyright notice, build information.
|
||||
*/
|
||||
printf ("/*\n * DO NOT EDIT THIS FILE--IT IS MACHINE GENERATED!\n */\n\n");
|
||||
printf ("/*\n * DO NOT EDIT OR DISTRIBUTE THIS FILE -- "
|
||||
"IT IS MACHINE GENERATED!\n */\n\n");
|
||||
puts (FileHeader); /*the copyright notice--see top of this file*/
|
||||
|
||||
printf (" *\n * Created:\t\t%s %2d, %4d\n",
|
||||
@ -886,7 +882,7 @@ bit.";
|
||||
printf (" *\n * Purpose:\t\t");
|
||||
for (s=purpose; *s; s++) {
|
||||
putchar (*s);
|
||||
if ('\n'==*s) printf (" *\t\t\t");
|
||||
if ('\n'==*s && s[1]) printf (" *\t\t\t");
|
||||
}
|
||||
|
||||
printf (" *\n * Modifications:\n *\n");
|
||||
@ -925,16 +921,16 @@ main (int argc, char *argv[]) {
|
||||
|
||||
print_header();
|
||||
|
||||
DETECT_I (signed char, "signed char", natsc, "natsc", d[nd]); nd++;
|
||||
DETECT_I (unsigned char, "unsigned char", natuc, "natuc", d[nd]); nd++;
|
||||
DETECT_I (short, "short", nats, "natss", d[nd]); nd++;
|
||||
DETECT_I (unsigned short, "unsigned short", nats, "natus", d[nd]); nd++;
|
||||
DETECT_I (int, "int", nati, "natsi", d[nd]); nd++;
|
||||
DETECT_I (unsigned int, "unsigned int", nati, "natui", d[nd]); nd++;
|
||||
DETECT_I (long, "long", natl, "natsl", d[nd]); nd++;
|
||||
DETECT_I (unsigned long, "unsigned long", natl, "natul", d[nd]); nd++;
|
||||
DETECT_F (float, "float", natf, "natf", d[nd]); nd++;
|
||||
DETECT_F (double, "double", natd, "natd", d[nd]); nd++;
|
||||
DETECT_I (signed char, CHAR, d[nd]); nd++;
|
||||
DETECT_I (unsigned char, UCHAR, d[nd]); nd++;
|
||||
DETECT_I (short, SHORT, d[nd]); nd++;
|
||||
DETECT_I (unsigned short, USHORT, d[nd]); nd++;
|
||||
DETECT_I (int, INT, d[nd]); nd++;
|
||||
DETECT_I (unsigned int, UINT, d[nd]); nd++;
|
||||
DETECT_I (long, LONG, d[nd]); nd++;
|
||||
DETECT_I (unsigned long, ULONG, d[nd]); nd++;
|
||||
DETECT_F (float, FLOAT, d[nd]); nd++;
|
||||
DETECT_F (double, DOUBLE, d[nd]); nd++;
|
||||
|
||||
print_results (nd, d);
|
||||
exit (0);
|
||||
|
@ -100,7 +100,7 @@
|
||||
* File addresses.
|
||||
*/
|
||||
typedef struct {
|
||||
uint64 offset;
|
||||
uint64 offset; /*offset within an HDF5 file */
|
||||
} haddr_t;
|
||||
|
||||
#define NO_ADDR NULL
|
||||
@ -369,7 +369,8 @@ extern char *strdup (const char *s);
|
||||
* profiling.
|
||||
*
|
||||
* Notes: Every file must have a file-scope variable called
|
||||
* `initialize_interface'.
|
||||
* `initialize_interface_g' of type hbool_t which is initialized
|
||||
* to FALSE.
|
||||
*
|
||||
* Don't use local variable initializers which contain
|
||||
* calls to other library functions since the initializer
|
||||
@ -401,12 +402,20 @@ extern char *strdup (const char *s);
|
||||
* initializing functions. Infinite recursion is no longer a
|
||||
* danger.
|
||||
*
|
||||
* Robb Matzke, 3 Dec 1997
|
||||
* The interface initialization function is no longer passed as an
|
||||
* argument unless the `FUNC_ENTER_INIT' form is called. Instead, the
|
||||
* function comes from the `INTERFACE_INIT' constant which must be
|
||||
* defined in every source file.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
extern hbool_t library_initialize_g; /*good thing C's lazy about extern!*/
|
||||
extern hbool_t thread_initialize_g; /*don't decl interface_initialize_g */
|
||||
|
||||
#define FUNC_ENTER(func_name,interface_init_func,err) { \
|
||||
#define FUNC_ENTER(func_name,err) FUNC_ENTER_INIT(func_name,INTERFACE_INIT,err)
|
||||
|
||||
#define FUNC_ENTER_INIT(func_name,interface_init_func,err) { \
|
||||
CONSTR (FUNC, #func_name); \
|
||||
PABLO_SAVE (ID_ ## func_name); \
|
||||
\
|
||||
|
@ -110,6 +110,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Functions in H5.c */
|
||||
herr_t H5init (void);
|
||||
herr_t H5dont_atexit(void);
|
||||
herr_t H5version(uintn *majnum, uintn *minnum, uintn *relnum, uintn *patnum);
|
||||
|
||||
|
@ -17,11 +17,14 @@ PROGS=debug
|
||||
LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5C.c H5D.c H5Dconv.c H5E.c H5F.c H5Fcore.c \
|
||||
H5Ffamily.c H5Fistore.c H5Flow.c H5Fsec2.c H5Fsplit.c H5Fstdio.c \
|
||||
H5G.c H5Gent.c H5Gnode.c H5Gshad.c H5Gstab.c H5H.c H5M.c H5MF.c \
|
||||
H5MM.c H5O.c H5Ocont.c H5Oistore.c H5Oname.c H5Onull.c H5Osdtyp.c \
|
||||
H5Osdim.c H5Ostab.c H5Ostdst.c H5P.c H5T.c H5V.c
|
||||
H5MM.c H5O.c H5Ocont.c H5Ocstore.c H5Oefl.c H5Oistore.c H5Oname.c \
|
||||
H5Onull.c H5Osdtyp.c H5Osdim.c H5Ostab.c H5P.c H5T.c H5Tinit.c H5V.c
|
||||
|
||||
LIB_OBJ=$(LIB_SRC:.c=.o)
|
||||
|
||||
# Temporary files
|
||||
MOSTLYCLEAN=H5detect.o H5detect H5Tinit.o H5Tinit.c
|
||||
|
||||
# Source and object files for programs...
|
||||
PROG_SRC=debug.c
|
||||
PROG_OBJ=$(PROG_SRC:.c=.o)
|
||||
@ -36,7 +39,14 @@ PUB_HDR=H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5Cpublic.h \
|
||||
PRIVATE_HDR=H5private.h H5Aprivate.h H5ACprivate.h H5Bprivate.h \
|
||||
H5Cprivate.h H5Dprivate.h H5Eprivate.h H5Fprivate.h H5Gprivate.h \
|
||||
H5Gpkg.h H5Hprivate.h H5Mprivate.h H5MFprivate.h H5MMprivate.h \
|
||||
H5Oprivate.h H5Pprivate.h H5Tprivate.h H5Vprivate.h
|
||||
H5Oprivate.h H5Pprivate.h H5Tprivate.h H5Tpkg.h H5Vprivate.h
|
||||
|
||||
# Number format detection
|
||||
H5Tinit.c: H5detect
|
||||
./H5detect >H5Tinit.c
|
||||
|
||||
H5detect: H5detect.o
|
||||
$(CC) $(CFLAGS) -o $@ H5detect.o
|
||||
|
||||
# How to build the programs...
|
||||
debug: debug.o $(LIB)
|
||||
|
27
src/debug.c
27
src/debug.c
@ -53,20 +53,6 @@ main (int argc, char *argv[])
|
||||
herr_t status = SUCCEED;
|
||||
haddr_t extra;
|
||||
|
||||
H5F_addr_reset (&addr);
|
||||
H5F_addr_reset (&extra);
|
||||
|
||||
/*
|
||||
* Parse command arguments.
|
||||
*/
|
||||
if (argc>2) {
|
||||
printf ("New address: %s\n", argv[2]);
|
||||
addr.offset = HDstrtol (argv[2], NULL, 0);
|
||||
}
|
||||
if (argc>3) {
|
||||
extra.offset = HDstrtol (argv[3], NULL, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Open the file and get the file descriptor.
|
||||
*/
|
||||
@ -79,6 +65,19 @@ main (int argc, char *argv[])
|
||||
HDexit (2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse command arguments.
|
||||
*/
|
||||
H5F_addr_reset (&addr);
|
||||
H5F_addr_reset (&extra);
|
||||
if (argc>2) {
|
||||
printf ("New address: %s\n", argv[2]);
|
||||
addr.offset = HDstrtol (argv[2], NULL, 0);
|
||||
}
|
||||
if (argc>3) {
|
||||
extra.offset = HDstrtol (argv[3], NULL, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the signature at the specified file position.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user