mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[svn-r303] Changes since 19980228
---------------------- ./html/Dataspaces.html ./html/Errors.html ./html/Files.html ./html/H5.api.html ./html/review1.html ./src/H5private.h ./src/H5public.h ./test/dsets.c ./test/dtypes.c Removed all the types like `int32' and `intn' into private headers since they violate the naming scheme and pollute application name space. Besides, our test files only use them in a handful of places and it's probably useless to export them to the app. The app is always written in terms of standard numeric types or its own numeric types and probably never in terms of HDF5 numeric types. If it were, then the user would have to copy from their type to hdf5 type for almost every hdf5 API function call! Same goes for return values. I also removed SUCCEED/FAIL from the API since apps should be checking against zero anyway. if (FAIL==(space=H5Screate_simple(...))) /*wrong*/ if ((space=H5Fcreate_simple(...)<0)) /*right*/ ./src/H5.c Changed arguments of H5version() from `uintn' to `unsigned'. ./src/H5Tpublic.h ./src/H5T.c Changed return type of H5Tget_nmembers() from `intn' to `int' ./src/H5A.c ./src/H5Aprivate.h ./src/H5Apublic.h Changed `H5Asearch_func_t' to `H5A_search_func_t' and moved its definition from the public to the private header file. ./html/H5.format.html Documented changes made to the external file list (H5O_EFL) message. ./src/H5D.c ./src/H5Dprivate.h ./src/H5E.c ./src/H5Epublic.h ./src/H5O.c ./src/H5Oefl.c ./src/H5Oprivate.h ./src/H5P.c ./src/H5Ppublic.h Added partial support for external raw data files. HDF5 can now describe external raw data files by listing the file names, offsets, and size for a dataset. However, we will restrict a dataset to be stored "contiguously" when the external file list is viewed as a single address space. The current implementation is unable to read/write to external files--that will come later this week as will documentation. For now, take a look at ./test/external.c, particularly the calls to H5Pset_external(). ./test/Makefile.in ./test/external.c [NEW] ./MANIFEST Added tests for external storage. Note: the read test is supposed to fail at this point since reading external datasets is not implemented yet. There is no write test. ./src/H5S.c ./src/H5Sprivate.h ./src/H5Ssimp.c Added H5S_get_npoints_max() to return the maximum possible number of data points in a data space. Added an extra argument to H5S_get_dims() which returns the maximum dims. ./src/H5F.c ./src/H5Fprivate.h ./src/H5Fpublic.h ./src/H5M.c [DEPRICATED] ./src/H5Mpublic.h [DEPRICATED] Changed `template' to `property list' in lots of places. ./src/H5Osdspace.c Removed an extra `\n' from a print statement. ./src/H5S_public.h Changed H5S_UNLIMITED to the maximum size_t value. ./test/extend.c "Extendable" is spelled "extendible". ./src/H5Farray.c ./src/H5V.c ./src/H5Vprivate.h ./test/hyperslab.c Strides are now type ssize_t instead of int. These have nothing to do with the sample granularity arguments for hyperslabs, which are also called "strides" in the code. ./test/tstab.c Changed assumptions about default address and length sizes.
This commit is contained in:
parent
808a5e6be1
commit
7bdea74ca9
1
MANIFEST
1
MANIFEST
@ -165,6 +165,7 @@
|
||||
./test/dspace.c
|
||||
./test/dtypes.c
|
||||
./test/extend.c
|
||||
./test/external.c
|
||||
./test/hyperslab.c
|
||||
./test/istore.c
|
||||
./test/testhdf5.c
|
||||
|
62
src/H5.c
62
src/H5.c
@ -272,45 +272,45 @@ H5dont_atexit(void)
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
} /* end H5dont_atexit() */
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5version -- Checks the version of the library
|
||||
USAGE
|
||||
herr_t H5version(majnum, minnum, relnum, patnum)
|
||||
uintn *majnum; OUT: The major revision number of the HDF5 library
|
||||
uintn *minnum; OUT: The minor revision number of the HDF5 library
|
||||
uintn *relnum; OUT: The release revision number of the HDF5 library
|
||||
uintn *patnum; OUT: The patch revision number of the HDF5 library
|
||||
|
||||
RETURNS
|
||||
SUCCEED/FAIL
|
||||
DESCRIPTION
|
||||
Checks the version numbers of the library.
|
||||
|
||||
--------------------------------------------------------------------------*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5version
|
||||
*
|
||||
* Purpose: Returns the library version numbers through arguments. MAJNUM
|
||||
* will be the major revision number of the library, MINNUM the
|
||||
* minor revision number, RELNUM the release revision number,
|
||||
* and PATNUM the patch revision number.
|
||||
*
|
||||
* Note: When printing an HDF5 version number it should be printed as
|
||||
* `printf ("HDF5-%d.%d.%d%c", maj, min, rel, 'a'+patch)'.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Unknown
|
||||
*
|
||||
* Modifications:
|
||||
* Robb Matzke, 4 Mar 1998
|
||||
* Now use "normal" data types for the interface. Any of the arguments
|
||||
* may be null pointers
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5version(uintn *majnum, uintn *minnum, uintn *relnum, uintn *patnum)
|
||||
H5version(unsigned *majnum, unsigned *minnum, unsigned *relnum,
|
||||
unsigned *patnum)
|
||||
{
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5version, FAIL);
|
||||
|
||||
/* Check args and all the boring stuff. */
|
||||
if (majnum == NULL || minnum == NULL || relnum == NULL || patnum == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL,
|
||||
"null pointer argument");
|
||||
|
||||
/* Set the version information */
|
||||
*majnum = HDF5_MAJOR_VERSION;
|
||||
*minnum = HDF5_MINOR_VERSION;
|
||||
*relnum = HDF5_RELEASE_VERSION;
|
||||
*patnum = HDF5_PATCH_VERSION;
|
||||
if (majnum) *majnum = HDF5_MAJOR_VERSION;
|
||||
if (minnum) *minnum = HDF5_MINOR_VERSION;
|
||||
if (relnum) *relnum = HDF5_RELEASE_VERSION;
|
||||
if (patnum) *patnum = HDF5_PATCH_VERSION;
|
||||
|
||||
done:
|
||||
if (ret_value == FAIL) { /* Error condition cleanup */
|
||||
|
||||
} /* end if */
|
||||
/* Normal function cleanup */
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
@ -671,7 +671,7 @@ H5A_dec_ref(hid_t atm)
|
||||
*******************************************************************************/
|
||||
void *
|
||||
H5A_search(group_t grp, /* IN: Group to search for the object in */
|
||||
H5Asearch_func_t func, /* IN: Ptr to the comparison function */
|
||||
H5A_search_func_t func, /* IN: Ptr to the comparison function */
|
||||
const void *key /* IN: pointer to key to compare against */
|
||||
)
|
||||
{
|
||||
|
@ -89,6 +89,9 @@ typedef struct atom_group_struct_tag {
|
||||
atom_info_t **atom_list; /*pointer to an array of ptrs to atoms */
|
||||
} atom_group_t;
|
||||
|
||||
/* Type of the function to compare objects & keys */
|
||||
typedef intn (*H5A_search_func_t) (const void * obj, const void * key);
|
||||
|
||||
/* Private Functions in H5A.c */
|
||||
intn H5A_init_group (group_t grp, intn hash_size, uintn reserved,
|
||||
herr_t (*free_func)(void *));
|
||||
@ -97,7 +100,7 @@ hid_t H5A_register (group_t grp, void *object);
|
||||
void *H5A_object (hid_t atm);
|
||||
group_t H5A_group (hid_t atm);
|
||||
void *H5A_remove (hid_t atm);
|
||||
void *H5A_search (group_t grp, H5Asearch_func_t func, const void *key);
|
||||
void *H5A_search (group_t grp, H5A_search_func_t func, const void *key);
|
||||
void H5A_term_interface (void);
|
||||
intn H5A_dec_ref (hid_t atm);
|
||||
hid_t H5A_inc_ref (hid_t atm);
|
||||
|
@ -44,10 +44,7 @@ typedef enum {
|
||||
} group_t;
|
||||
|
||||
/* Type of atoms to return to users */
|
||||
typedef int32 hid_t;
|
||||
|
||||
/* Type of the function to compare objects & keys */
|
||||
typedef intn (*H5Asearch_func_t) (const void * obj, const void * key);
|
||||
typedef int hid_t;
|
||||
|
||||
/* # of bits to use for Group ID in each atom (change if MAXGROUP>16) */
|
||||
#define GROUP_BITS 8
|
||||
|
253
src/H5D.c
253
src/H5D.c
@ -16,18 +16,19 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#include <H5private.h> /* Generic Functions */
|
||||
#include <H5Aprivate.h> /* Atoms */
|
||||
#include <H5ACprivate.h> /* Cache */
|
||||
#include <H5Pprivate.h> /* Templates */
|
||||
#include <H5Dprivate.h> /* Dataset functions */
|
||||
#include <H5Eprivate.h> /* Error handling */
|
||||
#include <H5Gprivate.h> /* Group headers */
|
||||
#include <H5Mprivate.h> /* Meta data */
|
||||
#include <H5MFprivate.h> /* File space allocation header */
|
||||
#include <H5MMprivate.h> /* Memory management */
|
||||
#include <H5Mprivate.h> /* Meta-Object API */
|
||||
#include <H5Oprivate.h> /* Object headers */
|
||||
#include <H5private.h> /* Generic Functions */
|
||||
#include <H5Aprivate.h> /* Atoms */
|
||||
#include <H5ACprivate.h> /* Cache */
|
||||
#include <H5Dprivate.h> /* Dataset functions */
|
||||
#include <H5Eprivate.h> /* Error handling */
|
||||
#include <H5Gprivate.h> /* Group headers */
|
||||
#include <H5Hprivate.h> /* Name heap */
|
||||
#include <H5Mprivate.h> /* Meta data */
|
||||
#include <H5MFprivate.h> /* File space allocation header */
|
||||
#include <H5MMprivate.h> /* Memory management */
|
||||
#include <H5Mprivate.h> /* Meta-Object API */
|
||||
#include <H5Oprivate.h> /* Object headers */
|
||||
#include <H5Pprivate.h> /* Property lists */
|
||||
|
||||
#define PABLO_MASK H5D_mask
|
||||
|
||||
@ -35,35 +36,37 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
* A dataset is the following struct.
|
||||
*/
|
||||
struct H5D_t {
|
||||
H5G_entry_t ent; /*cached object header stuff */
|
||||
H5T_t *type; /*datatype of this dataset */
|
||||
H5S_t *space; /*dataspace of this dataset */
|
||||
H5D_create_t create_parms; /*creation parameters */
|
||||
H5O_layout_t layout; /*data layout */
|
||||
H5G_entry_t ent; /*cached object header stuff */
|
||||
H5T_t *type; /*datatype of this dataset */
|
||||
H5S_t *space; /*dataspace of this dataset */
|
||||
H5D_create_t *create_parms; /*creation parameters */
|
||||
H5O_layout_t layout; /*data layout */
|
||||
};
|
||||
|
||||
/* Default dataset creation template */
|
||||
const H5D_create_t H5D_create_dflt =
|
||||
{
|
||||
/* Default dataset creation property list */
|
||||
const H5D_create_t H5D_create_dflt = {
|
||||
H5D_CONTIGUOUS, /* Layout */
|
||||
1, /* Chunk dimensions */
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, /* Chunk size. These default values.... */
|
||||
1, 1, 1, 1, 1, 1, 1, 1, /*...are quite useless. Larger chunks.. */
|
||||
1, 1, 1, 1, 1, 1, 1, 1, /*...produce fewer, but larger I/O...... */
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, /* Chunk size. These default values....*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, /*...are quite useless. Larger chunks..*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, /*...produce fewer, but larger I/O......*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1}, /*...requests. */
|
||||
{H5F_ADDR_UNDEF, /* External file list heap address */
|
||||
0, /*...slots allocated */
|
||||
0, /*...slots used */
|
||||
NULL} /*...slot array */
|
||||
};
|
||||
|
||||
/* Default dataset transfer template */
|
||||
const H5D_xfer_t H5D_xfer_dflt =
|
||||
{
|
||||
/* Default dataset transfer property list */
|
||||
const H5D_xfer_t H5D_xfer_dflt = {
|
||||
0, /* Place holder - remove this later */
|
||||
};
|
||||
|
||||
/* Interface initialization? */
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
static hbool_t interface_initialize_g = FALSE;
|
||||
#define INTERFACE_INIT H5D_init_interface
|
||||
static herr_t H5D_init_interface(void);
|
||||
static void H5D_term_interface(void);
|
||||
static herr_t H5D_init_interface(void);
|
||||
static void H5D_term_interface(void);
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
@ -143,7 +146,7 @@ H5D_term_interface(void)
|
||||
*
|
||||
* Errors:
|
||||
* ARGS BADTYPE Not a data space.
|
||||
* ARGS BADTYPE Not a dataset creation template.
|
||||
* ARGS BADTYPE Not a dataset creation plist.
|
||||
* ARGS BADTYPE Not a file.
|
||||
* ARGS BADTYPE Not a type.
|
||||
* ARGS BADVALUE No name.
|
||||
@ -190,7 +193,7 @@ H5Dcreate(hid_t file_id, const char *name, hid_t type_id, hid_t space_id,
|
||||
if (H5P_DATASET_CREATE != H5Pget_class(create_parms_id) ||
|
||||
NULL == (create_parms = H5A_object(create_parms_id))) {
|
||||
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
|
||||
"not a dataset creation template");
|
||||
"not a dataset creation property list");
|
||||
}
|
||||
} else {
|
||||
create_parms = &H5D_create_dflt;
|
||||
@ -198,13 +201,14 @@ H5Dcreate(hid_t file_id, const char *name, hid_t type_id, hid_t space_id,
|
||||
|
||||
/* build and open the new dataset */
|
||||
if (NULL == (new_dset = H5D_create(f, name, type, space, create_parms))) {
|
||||
HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create dataset");
|
||||
HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
|
||||
"unable to create dataset");
|
||||
}
|
||||
/* Register the new datatype and get an ID for it */
|
||||
if ((ret_value = H5A_register(H5_DATASET, new_dset)) < 0) {
|
||||
H5D_close(new_dset);
|
||||
HRETURN_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL,
|
||||
"can't register dataset");
|
||||
"unable to register dataset");
|
||||
}
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
@ -322,7 +326,7 @@ H5Dclose(hid_t dataset_id)
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, January 28, 1998
|
||||
* Wednesday, January 28, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -364,14 +368,14 @@ H5Dget_space (hid_t dataset_id)
|
||||
*
|
||||
* Purpose: Returns a copy of the file data type for a dataset.
|
||||
*
|
||||
* Return: Success: ID for a copy of the data type. The data
|
||||
* Return: Success: ID for a copy of the data type. The data
|
||||
* type should be released by calling
|
||||
* H5Tclose().
|
||||
*
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, February 3, 1998
|
||||
* Tuesday, February 3, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -411,16 +415,16 @@ H5Dget_type (hid_t dataset_id)
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Dget_create_parms
|
||||
*
|
||||
* Purpose: Returns a copy of the dataset creation template.
|
||||
* Purpose: Returns a copy of the dataset creation property list.
|
||||
*
|
||||
* Return: Success: ID for a copy of the dataset creation
|
||||
* template. The template should be released by
|
||||
* calling H5Pclose().
|
||||
* property list. The template should be
|
||||
* released by calling H5Pclose().
|
||||
*
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, February 3, 1998
|
||||
* Tuesday, February 3, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -441,18 +445,18 @@ H5Dget_create_parms (hid_t dataset_id)
|
||||
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset");
|
||||
}
|
||||
|
||||
/* Copy the creation template */
|
||||
/* Copy the creation property list */
|
||||
if (NULL==(copied_parms=H5P_copy (H5P_DATASET_CREATE,
|
||||
&(dataset->create_parms)))) {
|
||||
dataset->create_parms))) {
|
||||
HRETURN_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
|
||||
"unable to copy the creation template");
|
||||
"unable to copy the creation property list");
|
||||
}
|
||||
|
||||
/* Create an atom */
|
||||
if ((ret_value=H5A_register ((group_t)(H5_TEMPLATE_0+H5P_DATASET_CREATE),
|
||||
copied_parms))<0) {
|
||||
HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL,
|
||||
"unable to register creation template");
|
||||
"unable to register creation property list");
|
||||
}
|
||||
|
||||
FUNC_LEAVE (ret_value);
|
||||
@ -653,7 +657,7 @@ H5Dwrite(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id,
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, January 30, 1998
|
||||
* Friday, January 30, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -740,9 +744,9 @@ H5D_t *
|
||||
H5D_create(H5F_t *f, const char *name, const H5T_t *type, const H5S_t *space,
|
||||
const H5D_create_t *create_parms)
|
||||
{
|
||||
H5D_t *new_dset = NULL;
|
||||
H5D_t *ret_value = NULL;
|
||||
intn i;
|
||||
H5D_t *new_dset = NULL;
|
||||
H5D_t *ret_value = NULL;
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER(H5D_create, NULL);
|
||||
|
||||
@ -758,43 +762,41 @@ H5D_create(H5F_t *f, const char *name, const H5T_t *type, const H5S_t *space,
|
||||
H5F_addr_undef(&(new_dset->ent.header));
|
||||
new_dset->type = H5T_copy(type);
|
||||
new_dset->space = H5S_copy(space);
|
||||
new_dset->create_parms = *create_parms;
|
||||
|
||||
/*
|
||||
* Create (open for write access) an object header.
|
||||
*/
|
||||
if (H5O_create(f, 0, &(new_dset->ent)) < 0) {
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
||||
"unable to create dataset object header");
|
||||
}
|
||||
/* Update the type and space header messages */
|
||||
if (H5O_modify(&(new_dset->ent), H5O_DTYPE, 0, 0, new_dset->type) < 0 ||
|
||||
H5S_modify(&(new_dset->ent), new_dset->space) < 0) {
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
||||
"can't update type or space header messages");
|
||||
}
|
||||
new_dset->create_parms = H5P_copy (H5P_DATASET_CREATE, create_parms);
|
||||
|
||||
/* Total raw data size */
|
||||
new_dset->layout.type = new_dset->create_parms.layout;
|
||||
new_dset->layout.type = new_dset->create_parms->layout;
|
||||
new_dset->layout.ndims = H5S_get_ndims(space) + 1;
|
||||
assert(new_dset->layout.ndims <= NELMTS(new_dset->layout.dim));
|
||||
new_dset->layout.dim[new_dset->layout.ndims - 1] = H5T_get_size(type);
|
||||
|
||||
switch (new_dset->create_parms.layout) {
|
||||
switch (new_dset->create_parms->layout) {
|
||||
case H5D_CONTIGUOUS:
|
||||
if (H5S_get_dims(space, new_dset->layout.dim) < 0) {
|
||||
if (H5S_get_dims(space, new_dset->layout.dim, NULL) < 0) {
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
||||
"unable to initialize contiguous storage");
|
||||
}
|
||||
if (new_dset->create_parms->efl.nused>0) {
|
||||
size_t max_points = H5S_get_npoints_max (space);
|
||||
if (max_points*H5T_get_size (type) >
|
||||
H5O_efl_total_size (&(new_dset->create_parms->efl))) {
|
||||
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
|
||||
"max size exceeds external storage size");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case H5D_CHUNKED:
|
||||
if (new_dset->create_parms.chunk_ndims != H5S_get_ndims(space)) {
|
||||
if (new_dset->create_parms->chunk_ndims != H5S_get_ndims(space)) {
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL,
|
||||
"dimensionality of chunks doesn't match the data space");
|
||||
}
|
||||
if (new_dset->create_parms->efl.nused>0) {
|
||||
HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL,
|
||||
"external storage not supported with chunked layout");
|
||||
}
|
||||
for (i = 0; i < new_dset->layout.ndims - 1; i++) {
|
||||
new_dset->layout.dim[i] = new_dset->create_parms.chunk_size[i];
|
||||
new_dset->layout.dim[i] = new_dset->create_parms->chunk_size[i];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -802,14 +804,52 @@ H5D_create(H5F_t *f, const char *name, const H5T_t *type, const H5S_t *space,
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet");
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize storage
|
||||
*/
|
||||
if (H5F_arr_create(f, &(new_dset->layout)) < 0 ||
|
||||
H5O_modify(&(new_dset->ent), H5O_LAYOUT, 0, 0,
|
||||
&(new_dset->layout)) < 0) {
|
||||
/* Create (open for write access) an object header */
|
||||
if (H5O_create(f, 0, &(new_dset->ent)) < 0) {
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
||||
"unable to initialize storage");
|
||||
"unable to create dataset object header");
|
||||
}
|
||||
|
||||
/* Update the type and space header messages */
|
||||
if (H5O_modify(&(new_dset->ent), H5O_DTYPE, 0, H5O_FLAG_CONSTANT,
|
||||
new_dset->type) < 0 ||
|
||||
H5S_modify(&(new_dset->ent), new_dset->space) < 0) {
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
||||
"can't update type or space header messages");
|
||||
}
|
||||
|
||||
/* Initialize storage */
|
||||
if (0==new_dset->create_parms->efl.nused) {
|
||||
if (H5F_arr_create(f, &(new_dset->layout)) < 0) {
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
||||
"unable to initialize storage");
|
||||
}
|
||||
} else {
|
||||
H5F_addr_undef (&(new_dset->layout.addr));
|
||||
}
|
||||
if (H5O_modify (&(new_dset->ent), H5O_LAYOUT, 0, H5O_FLAG_CONSTANT,
|
||||
&(new_dset->layout)) < 0) {
|
||||
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
|
||||
"unable to update layout message");
|
||||
}
|
||||
if (new_dset->create_parms->efl.nused>0) {
|
||||
size_t heap_size = H5H_ALIGN (1);
|
||||
for (i=0; i<new_dset->create_parms->efl.nused; i++) {
|
||||
size_t n = strlen (new_dset->create_parms->efl.slot[i].name)+1;
|
||||
heap_size += H5H_ALIGN (n);
|
||||
}
|
||||
if (H5H_create (f, H5H_LOCAL, heap_size,
|
||||
&(new_dset->create_parms->efl.heap_addr))<0 ||
|
||||
H5H_insert (f, &(new_dset->create_parms->efl.heap_addr),
|
||||
1, "")<0) {
|
||||
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
|
||||
"unable to create external file list name heap");
|
||||
}
|
||||
if (H5O_modify (&(new_dset->ent), H5O_EFL, 0, H5O_FLAG_CONSTANT,
|
||||
&(new_dset->create_parms->efl))<0) {
|
||||
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
|
||||
"unable to update external file list message");
|
||||
}
|
||||
}
|
||||
|
||||
/* Give the dataset a name */
|
||||
@ -822,10 +862,12 @@ H5D_create(H5F_t *f, const char *name, const H5T_t *type, const H5S_t *space,
|
||||
|
||||
done:
|
||||
if (!ret_value && new_dset) {
|
||||
if (new_dset->type)
|
||||
H5T_close(new_dset->type);
|
||||
if (new_dset->space)
|
||||
H5S_close(new_dset->space);
|
||||
if (new_dset->type) H5T_close(new_dset->type);
|
||||
if (new_dset->space) H5S_close(new_dset->space);
|
||||
if (new_dset->create_parms) {
|
||||
H5P_close (H5P_DATASET_CREATE, new_dset->create_parms);
|
||||
new_dset->create_parms = NULL;
|
||||
}
|
||||
if (H5F_addr_defined(&(new_dset->ent.header))) {
|
||||
H5O_close(&(new_dset->ent));
|
||||
}
|
||||
@ -854,7 +896,7 @@ H5D_create(H5F_t *f, const char *name, const H5T_t *type, const H5S_t *space,
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5D_t *
|
||||
H5D_t *
|
||||
H5D_open(H5F_t *f, const char *name)
|
||||
{
|
||||
H5D_t *dataset = NULL; /*the dataset which was found */
|
||||
@ -868,7 +910,7 @@ H5D_open(H5F_t *f, const char *name)
|
||||
assert(name && *name);
|
||||
|
||||
dataset = H5MM_xcalloc(1, sizeof(H5D_t));
|
||||
dataset->create_parms = H5D_create_dflt;
|
||||
dataset->create_parms = H5P_copy (H5P_DATASET_CREATE, &H5D_create_dflt);
|
||||
H5F_addr_undef(&(dataset->ent.header));
|
||||
|
||||
/* Open the dataset object */
|
||||
@ -878,16 +920,18 @@ H5D_open(H5F_t *f, const char *name)
|
||||
if (H5O_open(f, &(dataset->ent)) < 0) {
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open");
|
||||
}
|
||||
|
||||
/* Get the type and space */
|
||||
if (NULL==(dataset->type=H5O_read(&(dataset->ent), H5O_DTYPE, 0, NULL)) ||
|
||||
NULL==(dataset->space=H5S_read(f, &(dataset->ent)))) {
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
||||
"unable to load type or space info from dataset header");
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the raw data layout info. It's actually stored in two locations:
|
||||
* the storage message of the dataset (dataset->storage) and certain
|
||||
* values are copied to the dataset create template so the user can query
|
||||
* values are copied to the dataset create plist so the user can query
|
||||
* them.
|
||||
*/
|
||||
if (NULL==H5O_read(&(dataset->ent), H5O_LAYOUT, 0, &(dataset->layout))) {
|
||||
@ -896,19 +940,19 @@ H5D_open(H5F_t *f, const char *name)
|
||||
}
|
||||
switch (dataset->layout.type) {
|
||||
case H5D_CONTIGUOUS:
|
||||
dataset->create_parms.layout = H5D_CONTIGUOUS;
|
||||
dataset->create_parms->layout = H5D_CONTIGUOUS;
|
||||
break;
|
||||
|
||||
case H5D_CHUNKED:
|
||||
/*
|
||||
* Chunked storage. The creation template's dimension is one less than
|
||||
* Chunked storage. The creation plist's dimension is one less than
|
||||
* the chunk dimension because the chunk includes a dimension for the
|
||||
* individual bytes of the data type.
|
||||
*/
|
||||
dataset->create_parms.layout = H5D_CHUNKED;
|
||||
dataset->create_parms.chunk_ndims = dataset->layout.ndims - 1;
|
||||
dataset->create_parms->layout = H5D_CHUNKED;
|
||||
dataset->create_parms->chunk_ndims = dataset->layout.ndims - 1;
|
||||
for (i = 0; i < dataset->layout.ndims - 1; i++) {
|
||||
dataset->create_parms.chunk_size[i] = dataset->layout.dim[i];
|
||||
dataset->create_parms->chunk_size[i] = dataset->layout.dim[i];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -917,6 +961,14 @@ H5D_open(H5F_t *f, const char *name)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet");
|
||||
}
|
||||
|
||||
/* Get the external file list message, which might not exist */
|
||||
if (!H5F_addr_defined (&(dataset->layout.addr)) &&
|
||||
NULL==H5O_read (&(dataset->ent), H5O_EFL, 0,
|
||||
&(dataset->create_parms->efl))) {
|
||||
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
|
||||
"storage address is undefined an no external file list");
|
||||
}
|
||||
|
||||
/* Success */
|
||||
ret_value = dataset;
|
||||
|
||||
@ -925,10 +977,15 @@ H5D_open(H5F_t *f, const char *name)
|
||||
if (H5F_addr_defined(&(dataset->ent.header))) {
|
||||
H5O_close(&(dataset->ent));
|
||||
}
|
||||
if (dataset->type)
|
||||
if (dataset->type) {
|
||||
H5T_close(dataset->type);
|
||||
if (dataset->space)
|
||||
}
|
||||
if (dataset->space) {
|
||||
H5S_close(dataset->space);
|
||||
}
|
||||
if (dataset->create_parms) {
|
||||
H5P_close (H5P_DATASET_CREATE, dataset->create_parms);
|
||||
}
|
||||
dataset->ent.file = NULL;
|
||||
H5MM_xfree(dataset);
|
||||
}
|
||||
@ -972,7 +1029,8 @@ H5D_close(H5D_t *dataset)
|
||||
* these fails, so we just continue.
|
||||
*/
|
||||
free_failed = (H5T_close(dataset->type) < 0 ||
|
||||
H5S_close(dataset->space) < 0);
|
||||
H5S_close(dataset->space) < 0 ||
|
||||
H5P_close (H5P_DATASET_CREATE, dataset->create_parms));
|
||||
|
||||
/* Close the dataset object */
|
||||
H5O_close(&(dataset->ent));
|
||||
@ -1070,6 +1128,10 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
|
||||
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
|
||||
"src and dest data spaces have different sizes");
|
||||
}
|
||||
if (dataset->create_parms->efl.nused>0) {
|
||||
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL,
|
||||
"reading externally-stored data is not implemented yet");
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the size of the request and allocate scratch buffers.
|
||||
@ -1213,6 +1275,10 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
|
||||
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
|
||||
"src and dest data spaces have different sizes");
|
||||
}
|
||||
if (dataset->create_parms->efl.nused>0) {
|
||||
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL,
|
||||
"writing externally-stored data is not implemente yet");
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the size of the request and allocate scratch buffers.
|
||||
@ -1290,7 +1356,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Friday, January 30, 1998
|
||||
* Friday, January 30, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -1307,6 +1373,11 @@ H5D_extend (H5D_t *dataset, const size_t *size)
|
||||
assert (dataset);
|
||||
assert (size);
|
||||
|
||||
if (dataset->create_parms->efl.nused>0) {
|
||||
HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL,
|
||||
"extending externally-stored data is not implemente yet");
|
||||
}
|
||||
|
||||
/* This is only allowed for data spaces with chunked layout */
|
||||
if (H5D_CHUNKED!=dataset->layout.type) {
|
||||
HRETURN_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL,
|
||||
|
@ -31,14 +31,15 @@
|
||||
/* Set the minimum object header size to create objects with */
|
||||
#define H5D_MINHDR_SIZE 512
|
||||
|
||||
/* Dataset creation template */
|
||||
/* Dataset creation property list */
|
||||
typedef struct H5D_create_t {
|
||||
H5D_layout_t layout;
|
||||
intn chunk_ndims;
|
||||
size_t chunk_size[32];
|
||||
H5D_layout_t layout; /*storage layout */
|
||||
intn chunk_ndims; /*chunk dimensionality */
|
||||
size_t chunk_size[32]; /*chunk size if chunked storage */
|
||||
H5O_efl_t efl; /*external file list */
|
||||
} H5D_create_t;
|
||||
|
||||
/* Dataset transfer template */
|
||||
/* Dataset transfer property list */
|
||||
typedef struct H5D_xfer_t {
|
||||
int _placeholder; /*unused--delete this later */
|
||||
} H5D_xfer_t;
|
||||
|
@ -54,6 +54,7 @@ static const H5E_major_mesg_t H5E_major_mesg_g[] = {
|
||||
{H5E_DATASET, "Dataset interface"},
|
||||
{H5E_STORAGE, "Data storage layer"},
|
||||
{H5E_TEMPLATE, "Property list interface"},
|
||||
{H5E_EFL, "External file list"},
|
||||
};
|
||||
|
||||
static const H5E_minor_mesg_t H5E_minor_mesg_g[] = {
|
||||
|
@ -45,7 +45,8 @@ typedef enum H5E_major_t {
|
||||
H5E_DATASPACE, /*Dataspace */
|
||||
H5E_DATASET, /*Dataset */
|
||||
H5E_STORAGE, /*data storage */
|
||||
H5E_TEMPLATE /*Templates */
|
||||
H5E_TEMPLATE, /*Property lists */
|
||||
H5E_EFL /*External file list */
|
||||
} H5E_major_t;
|
||||
|
||||
/* Declare an enumerated type which holds all the valid minor HDF error codes */
|
||||
|
14
src/H5F.c
14
src/H5F.c
@ -40,11 +40,11 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
#include <H5private.h> /*library functions */
|
||||
#include <H5Aprivate.h> /*atoms */
|
||||
#include <H5ACprivate.h> /*cache */
|
||||
#include <H5Pprivate.h> /*templates */
|
||||
#include <H5Eprivate.h> /*error handling */
|
||||
#include <H5Eprivate.h> /*error handling */
|
||||
#include <H5Gprivate.h> /*symbol tables */
|
||||
#include <H5Mprivate.h> /*meta data */
|
||||
#include <H5MMprivate.h> /*core memory management */
|
||||
#include <H5MMprivate.h> /*core memory management */
|
||||
#include <H5Pprivate.h> /*property lists */
|
||||
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
@ -62,7 +62,7 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
/*-------------------- Locally scoped variables -----------------------------*/
|
||||
|
||||
/*
|
||||
* Define the default file creation template.
|
||||
* Define the default file creation property list.
|
||||
*/
|
||||
const H5F_create_t H5F_create_dflt = {
|
||||
0, /* Default user-block size */
|
||||
@ -87,8 +87,8 @@ const H5F_create_t H5F_create_dflt = {
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the default file access template. The template is initialized by
|
||||
* H5F_init_interface().
|
||||
* Define the default file access property list. The template is initialized
|
||||
* by H5F_init_interface().
|
||||
*/
|
||||
H5F_access_t H5F_access_dflt;
|
||||
|
||||
@ -141,7 +141,7 @@ H5F_init_interface(void)
|
||||
"unable to initialize interface");
|
||||
}
|
||||
|
||||
/* Initialize the default file access template */
|
||||
/* Initialize the default file access property list */
|
||||
H5F_access_dflt.driver = H5F_LOW_DFLT;
|
||||
#if (H5F_LOW_DFLT == H5F_LOW_SEC2)
|
||||
/* Nothing to initialize */
|
||||
|
@ -116,8 +116,8 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
|
||||
void *_buf/*out*/)
|
||||
{
|
||||
uint8 *buf = (uint8 *)_buf; /*cast for arithmetic */
|
||||
intn file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */
|
||||
intn mem_stride[H5O_LAYOUT_NDIMS]; /*strides through memory*/
|
||||
ssize_t file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */
|
||||
ssize_t mem_stride[H5O_LAYOUT_NDIMS]; /*strides through memory*/
|
||||
size_t hslab_size[H5O_LAYOUT_NDIMS]; /*hyperslab size */
|
||||
size_t idx[H5O_LAYOUT_NDIMS]; /*multi-dim counter */
|
||||
size_t mem_start, file_start; /*byte offsets to start */
|
||||
@ -250,8 +250,8 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout,
|
||||
const void *_buf)
|
||||
{
|
||||
const uint8 *buf = (const uint8 *)_buf; /*cast for arithmetic */
|
||||
intn file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */
|
||||
intn mem_stride[H5O_LAYOUT_NDIMS]; /*strides through memory*/
|
||||
ssize_t file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */
|
||||
ssize_t mem_stride[H5O_LAYOUT_NDIMS]; /*strides through memory*/
|
||||
size_t hslab_size[H5O_LAYOUT_NDIMS]; /*hyperslab size */
|
||||
size_t idx[H5O_LAYOUT_NDIMS]; /*multi-dim counter */
|
||||
size_t mem_start, file_start; /*byte offsets to start */
|
||||
|
@ -209,7 +209,7 @@
|
||||
#define NBYTEDECODE(s, d, n) { HDmemcpy(d,s,n); p+=n }
|
||||
|
||||
/*
|
||||
* File-creation template.
|
||||
* File-creation property list.
|
||||
*/
|
||||
typedef struct H5F_create_t {
|
||||
size_t userblock_size; /* Size of the file user block in bytes */
|
||||
@ -225,7 +225,7 @@ typedef struct H5F_create_t {
|
||||
} H5F_create_t;
|
||||
|
||||
/*
|
||||
* File-access template.
|
||||
* File-access property list.
|
||||
*/
|
||||
typedef struct H5F_access_t {
|
||||
H5F_driver_t driver; /* Low level file driver */
|
||||
@ -391,8 +391,8 @@ 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 */
|
||||
H5F_create_t create_parms; /* File-creation template */
|
||||
H5F_access_t access_parms; /* File-access template */
|
||||
H5F_create_t create_parms; /* File-creation property list */
|
||||
H5F_access_t access_parms; /* File-access property list */
|
||||
struct H5G_entry_t *root_ent; /* Root symbol table entry */
|
||||
} H5F_file_t;
|
||||
|
||||
|
@ -58,6 +58,8 @@ typedef enum H5F_driver_t {
|
||||
H5F_LOW_FAMILY = 5 /*split addr space over many files */
|
||||
} H5F_driver_t;
|
||||
|
||||
/* Unlimited file size for H5Pset_external() */
|
||||
#define H5F_UNLIMITED ((size_t)(-1L))
|
||||
|
||||
/* Parallel styles passed to H5Pset_mpi() */
|
||||
#ifdef HAVE_PARALLEL
|
||||
@ -71,9 +73,9 @@ extern "C" {
|
||||
|
||||
/* Functions in H5F.c */
|
||||
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);
|
||||
hid_t H5Fcreate (const char *filename, unsigned flags, hid_t create_plist,
|
||||
hid_t access_plist);
|
||||
hid_t H5Fopen (const char *filename, unsigned flags, hid_t access_plist);
|
||||
herr_t H5Fclose (hid_t fid);
|
||||
hid_t H5Fget_create_template (hid_t fid);
|
||||
hid_t H5Fget_access_template (hid_t file_id);
|
||||
|
@ -45,13 +45,12 @@ static char RcsId[] = "@(#)$Revision$";
|
||||
|
||||
#include <H5private.h> /* Generic functions */
|
||||
#include <H5Aprivate.h> /* Atom interface */
|
||||
#include <H5Pprivate.h> /* Template interface */
|
||||
#include <H5Dprivate.h> /* Dataset interface */
|
||||
#include <H5Eprivate.h> /*error handling */
|
||||
#include <H5Sprivate.h> /* Dataspace functions */
|
||||
#include <H5Tprivate.h> /* Datatype interface */
|
||||
#include <H5Mprivate.h> /* Meta-object interface */
|
||||
#include <H5Pprivate.h> /* Template interface */
|
||||
#include <H5Pprivate.h> /* Property list interface */
|
||||
|
||||
#define PABLO_MASK H5M_mask
|
||||
|
||||
|
@ -28,11 +28,11 @@ extern "C" {
|
||||
hid_t H5Maccess (hid_t oid);
|
||||
hid_t H5Mcopy (hid_t oid);
|
||||
hid_t H5Mfind_name (hid_t oid, group_t type, const char *name);
|
||||
uint32 H5Mname_len (hid_t oid);
|
||||
unsigned 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, group_t type, const char *name);
|
||||
hid_t H5Mindex (hid_t oid, group_t type, uint32 idx);
|
||||
hid_t H5Mindex (hid_t oid, group_t type, unsigned idx);
|
||||
hid_t H5Mflush (hid_t oid);
|
||||
herr_t H5Mdelete (hid_t oid);
|
||||
hid_t H5Mget_file (hid_t oid);
|
||||
|
@ -57,9 +57,9 @@ static const H5O_class_t *const message_type_g[] = {
|
||||
NULL, /*0x0004 Not assigned */
|
||||
NULL, /*0x0005 Not assigned */
|
||||
NULL, /*0x0006 Data storage -- compact object */
|
||||
NULL, /*0x0007 Data storage -- external object */
|
||||
H5O_EFL, /*0x0007 Data storage -- external data files */
|
||||
H5O_LAYOUT, /*0x0008 Data Layout */
|
||||
H5O_EFL, /*0x0009 External File List */
|
||||
NULL, /*0x0009 Not assigned */
|
||||
NULL, /*0x000A Not assigned */
|
||||
NULL, /*0x000B Data storage -- compressed object */
|
||||
NULL, /*0x000C Attribute list */
|
||||
|
322
src/H5Oefl.c
322
src/H5Oefl.c
@ -1,16 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 1997 NCSA
|
||||
* All rights reserved.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Programmer: Robb Matzke <matzke@llnl.gov>
|
||||
* Tuesday, November 25, 1997
|
||||
* Tuesday, November 25, 1997
|
||||
*/
|
||||
#include <H5private.h>
|
||||
#include <H5Eprivate.h>
|
||||
#include <H5Hprivate.h>
|
||||
#include <H5MMprivate.h>
|
||||
#include <H5Oprivate.h>
|
||||
|
||||
#define PABLO_MASK H5O_efl_mask
|
||||
#define PABLO_MASK H5O_efl_mask
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_efl_decode(H5F_t *f, size_t raw_size, const uint8 *p);
|
||||
@ -23,34 +24,35 @@ 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 */
|
||||
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 */
|
||||
H5O_efl_decode, /*decode message */
|
||||
H5O_efl_encode, /*encode message */
|
||||
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 */
|
||||
sizeof(H5O_efl_t), /*native message size */
|
||||
H5O_efl_decode, /*decode message */
|
||||
H5O_efl_encode, /*encode message */
|
||||
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
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_decode
|
||||
* Function: H5O_efl_decode
|
||||
*
|
||||
* Purpose: Decode an external file list message and return a pointer to
|
||||
* the message (and some other data).
|
||||
* 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.
|
||||
* Return: Success: Ptr to a new message struct.
|
||||
*
|
||||
* Failure: NULL
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -59,42 +61,61 @@ static hbool_t interface_initialize_g = FALSE;
|
||||
static void *
|
||||
H5O_efl_decode(H5F_t *f, size_t raw_size, const uint8 *p)
|
||||
{
|
||||
H5O_efl_t *mesg = NULL;
|
||||
int i;
|
||||
H5O_efl_t *mesg = NULL;
|
||||
int i;
|
||||
const char *s = NULL;
|
||||
|
||||
FUNC_ENTER(H5O_efl_decode, NULL);
|
||||
|
||||
/* check args */
|
||||
/* Check args */
|
||||
assert(f);
|
||||
assert(p);
|
||||
|
||||
/* decode */
|
||||
/* Decode the header */
|
||||
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);
|
||||
#ifndef NDEBUG
|
||||
assert (H5F_addr_defined (&(mesg->heap_addr)));
|
||||
s = H5H_peek (f, &(mesg->heap_addr), 0);
|
||||
assert (s && !*s);
|
||||
#endif
|
||||
UINT16DECODE(p, mesg->nalloc);
|
||||
assert(mesg->nalloc>0);
|
||||
UINT16DECODE(p, mesg->nused);
|
||||
assert(mesg->nused <= mesg->nalloc);
|
||||
p += 4; /*reserved*/
|
||||
|
||||
mesg->offset = H5MM_xmalloc(mesg->nalloc * sizeof(size_t));
|
||||
for (i = 0; i < mesg->nused; i++) {
|
||||
UINT32DECODE(p, mesg->offset[i]);
|
||||
/* Decode the file list */
|
||||
mesg->slot = H5MM_xcalloc(mesg->nalloc, sizeof(H5O_efl_entry_t));
|
||||
for (i=0; i<mesg->nused; i++) {
|
||||
/* Name */
|
||||
H5F_decode_length (f, p, mesg->slot[i].name_offset);
|
||||
s = H5H_peek (f, &(mesg->heap_addr), mesg->slot[i].name_offset);
|
||||
assert (s && *s);
|
||||
mesg->slot[i].name = H5MM_xstrdup (s);
|
||||
|
||||
/* File offset */
|
||||
H5F_decode_length (f, p, mesg->slot[i].offset);
|
||||
|
||||
/* Size */
|
||||
H5F_decode_length (f, p, mesg->slot[i].size);
|
||||
assert (mesg->slot[i].size>0);
|
||||
}
|
||||
|
||||
FUNC_LEAVE(mesg);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_encode
|
||||
* Function: H5O_efl_encode
|
||||
*
|
||||
* Purpose: Encodes a message
|
||||
* Purpose: Encodes a message.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -103,8 +124,10 @@ H5O_efl_decode(H5F_t *f, size_t raw_size, const uint8 *p)
|
||||
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;
|
||||
const H5O_efl_t *mesg = (const H5O_efl_t *)_mesg;
|
||||
int i;
|
||||
size_t offset;
|
||||
|
||||
|
||||
FUNC_ENTER(H5O_efl_encode, FAIL);
|
||||
|
||||
@ -114,76 +137,106 @@ H5O_efl_encode(H5F_t *f, size_t raw_size, uint8 *p, const void *_mesg)
|
||||
assert(raw_size == H5O_ALIGN (H5O_efl_size(f, _mesg)));
|
||||
assert(p);
|
||||
|
||||
/* encode */
|
||||
/* Encode header */
|
||||
assert (H5F_addr_defined (&(mesg->heap_addr)));
|
||||
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]);
|
||||
assert (mesg->nalloc>0);
|
||||
UINT16ENCODE(p, mesg->nused); /*yes, twice*/
|
||||
assert (mesg->nused>0 && mesg->nused<=mesg->nalloc);
|
||||
UINT16ENCODE(p, mesg->nused);
|
||||
*p++ = 0;
|
||||
*p++ = 0;
|
||||
*p++ = 0;
|
||||
*p++ = 0;
|
||||
|
||||
/* Encode file list */
|
||||
for (i=0; i<mesg->nused; i++) {
|
||||
/*
|
||||
* If the name has not been added to the heap yet then do so now.
|
||||
*/
|
||||
if (0==mesg->slot[i].name_offset) {
|
||||
offset = H5H_insert (f, &(mesg->heap_addr),
|
||||
strlen (mesg->slot[i].name)+1,
|
||||
mesg->slot[i].name);
|
||||
if ((size_t)(-1)==offset) {
|
||||
HRETURN_ERROR (H5E_EFL, H5E_CANTINIT, FAIL,
|
||||
"unable to insert URL into name heap");
|
||||
}
|
||||
mesg->slot[i].name_offset = offset;
|
||||
}
|
||||
|
||||
/* Encode the file info */
|
||||
H5F_encode_length (f, p, mesg->slot[i].name_offset);
|
||||
H5F_encode_length (f, p, mesg->slot[i].offset);
|
||||
H5F_encode_length (f, p, mesg->slot[i].size);
|
||||
}
|
||||
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_copy
|
||||
* Function: H5O_efl_copy
|
||||
*
|
||||
* Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
|
||||
* necessary.
|
||||
* Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
|
||||
* necessary.
|
||||
*
|
||||
* Return: Success: Ptr to _DEST
|
||||
* Return: Success: Ptr to _DEST
|
||||
*
|
||||
* Failure: NULL
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
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;
|
||||
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 = H5MM_xcalloc(1, sizeof(H5O_efl_t));
|
||||
dest->slot = H5MM_xmalloc(mesg->nalloc * sizeof(H5O_efl_entry_t));
|
||||
} else if (NULL==dest->slot || dest->nalloc<mesg->nalloc) {
|
||||
H5MM_xfree(dest->slot);
|
||||
dest->slot = H5MM_xmalloc(mesg->nalloc * sizeof(H5O_efl_entry_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];
|
||||
dest->slot[i] = mesg->slot[i];
|
||||
dest->slot[i].name = H5MM_xstrdup (mesg->slot[i].name);
|
||||
}
|
||||
|
||||
FUNC_LEAVE((void *) dest);
|
||||
FUNC_LEAVE((void *)dest);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_size
|
||||
* 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.
|
||||
* 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. This
|
||||
* function doesn't count unused slots.
|
||||
*
|
||||
* Return: Success: Message data size in bytes.
|
||||
* Return: Success: Message data size in bytes.
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -192,8 +245,8 @@ H5O_efl_copy(const void *_mesg, void *_dest)
|
||||
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;
|
||||
const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg;
|
||||
size_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER(H5O_efl_size, FAIL);
|
||||
|
||||
@ -201,26 +254,30 @@ H5O_efl_size(H5F_t *f, const void *_mesg)
|
||||
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 */
|
||||
ret_value = H5F_SIZEOF_ADDR(f) + /*heap address */
|
||||
2 + /*slots allocated*/
|
||||
2 + /*num slots used*/
|
||||
4 + /*reserved */
|
||||
mesg->nused * (H5F_SIZEOF_SIZE(f) + /*name offset */
|
||||
H5F_SIZEOF_SIZE(f) + /*file offset */
|
||||
H5F_SIZEOF_SIZE(f)); /*file size */
|
||||
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_reset
|
||||
* Function: H5O_efl_reset
|
||||
*
|
||||
* Purpose: Frees internal pointers and resets the message to an
|
||||
* initialial state.
|
||||
* Purpose: Frees internal pointers and resets the message to an
|
||||
* initialial state.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -229,7 +286,9 @@ H5O_efl_size(H5F_t *f, const void *_mesg)
|
||||
static herr_t
|
||||
H5O_efl_reset(void *_mesg)
|
||||
{
|
||||
H5O_efl_t *mesg = (H5O_efl_t *) _mesg;
|
||||
H5O_efl_t *mesg = (H5O_efl_t *) _mesg;
|
||||
int i;
|
||||
|
||||
|
||||
FUNC_ENTER(H5O_efl_reset, FAIL);
|
||||
|
||||
@ -237,23 +296,70 @@ H5O_efl_reset(void *_mesg)
|
||||
assert(mesg);
|
||||
|
||||
/* reset */
|
||||
for (i=0; i<mesg->nused; i++) {
|
||||
mesg->slot[i].name = H5MM_xfree (mesg->slot[i].name);
|
||||
}
|
||||
H5F_addr_undef (&(mesg->heap_addr));
|
||||
mesg->nused = mesg->nalloc = 0;
|
||||
mesg->offset = H5MM_xfree(mesg->offset);
|
||||
mesg->slot = H5MM_xfree(mesg->slot);
|
||||
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_debug
|
||||
* Function: H5O_efl_total_size
|
||||
*
|
||||
* Purpose: Prints debugging info for a message.
|
||||
* Purpose: Return the total size of the external file list by summing
|
||||
* the sizes of all of the files.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: Total reserved size for external data.
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: 0
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, March 3, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
size_t
|
||||
H5O_efl_total_size (H5O_efl_t *efl)
|
||||
{
|
||||
int i;
|
||||
size_t ret_value = 0, tmp;
|
||||
|
||||
FUNC_ENTER (H5O_efl_total_size, 0);
|
||||
|
||||
if (efl->nused>0 &&
|
||||
H5O_EFL_UNLIMITED==efl->slot[efl->nused-1].size) {
|
||||
ret_value = H5O_EFL_UNLIMITED;
|
||||
} else {
|
||||
for (i=0; i<efl->nused; i++, ret_value=tmp) {
|
||||
tmp = ret_value + efl->slot[i].size;
|
||||
if (tmp<=ret_value) {
|
||||
HRETURN_ERROR (H5E_EFL, H5E_OVERFLOW, 0,
|
||||
"total external storage size overflowed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FUNC_LEAVE (ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_debug
|
||||
*
|
||||
* Purpose: Prints debugging info for a message.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
*
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, November 25, 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
@ -261,11 +367,11 @@ H5O_efl_reset(void *_mesg)
|
||||
*/
|
||||
static herr_t
|
||||
H5O_efl_debug(H5F_t *f, const void *_mesg, FILE * stream, intn indent,
|
||||
intn fwidth)
|
||||
intn fwidth)
|
||||
{
|
||||
const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg;
|
||||
char buf[64];
|
||||
intn i;
|
||||
const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg;
|
||||
char buf[64];
|
||||
intn i;
|
||||
|
||||
FUNC_ENTER(H5O_efl_debug, FAIL);
|
||||
|
||||
@ -277,19 +383,33 @@ H5O_efl_debug(H5F_t *f, const void *_mesg, FILE * stream, intn indent,
|
||||
assert(fwidth >= 0);
|
||||
|
||||
fprintf(stream, "%*s%-*s ", indent, "", fwidth,
|
||||
"Heap address:");
|
||||
"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);
|
||||
"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]));
|
||||
sprintf (buf, "File %d", i);
|
||||
fprintf (stream, "%*s%s:\n", indent, "", buf);
|
||||
|
||||
fprintf(stream, "%*s%-*s \"%s\"\n", indent+3, "", MAX (fwidth-3, 0),
|
||||
"Name:",
|
||||
mesg->slot[i].name);
|
||||
|
||||
fprintf(stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0),
|
||||
"Name offset:",
|
||||
(unsigned long)(mesg->slot[i].name_offset));
|
||||
|
||||
fprintf (stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0),
|
||||
"Offset of data in file:",
|
||||
(unsigned long)(mesg->slot[i].offset));
|
||||
|
||||
fprintf (stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0),
|
||||
"Bytes reserved for data:",
|
||||
(unsigned long)(mesg->slot[i].size));
|
||||
}
|
||||
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
|
@ -126,6 +126,28 @@ extern const H5O_class_t H5O_DTYPE[1];
|
||||
|
||||
/* operates on an H5T_t struct */
|
||||
|
||||
/*
|
||||
* External File List Message
|
||||
*/
|
||||
#define H5O_EFL_ID 0x0007 /*external file list id */
|
||||
#define H5O_EFL_ALLOC 16 /*number of slots to alloc at once */
|
||||
#define H5O_EFL_UNLIMITED H5F_UNLIMITED /*max possible file size */
|
||||
extern const H5O_class_t H5O_EFL[1]; /*external file list class */
|
||||
|
||||
typedef struct H5O_efl_entry_t {
|
||||
size_t name_offset; /*offset of name within heap */
|
||||
char *name; /*malloc'd name */
|
||||
size_t offset; /*offset of data within file */
|
||||
size_t size; /*size allocated within file */
|
||||
} H5O_efl_entry_t;
|
||||
|
||||
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 */
|
||||
H5O_efl_entry_t *slot; /*array of external file entries */
|
||||
} H5O_efl_t;
|
||||
|
||||
/*
|
||||
* Data Layout Message
|
||||
*/
|
||||
@ -140,19 +162,6 @@ typedef struct H5O_layout_t {
|
||||
size_t dim[H5O_LAYOUT_NDIMS]; /*size of data or chunk */
|
||||
} H5O_layout_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.
|
||||
*/
|
||||
@ -191,6 +200,7 @@ typedef struct H5O_stab_t {
|
||||
haddr_t heap_addr; /*address of name heap */
|
||||
} H5O_stab_t;
|
||||
|
||||
/* General message operators */
|
||||
herr_t H5O_create (H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/);
|
||||
herr_t H5O_open (H5F_t *f, H5G_entry_t *ent);
|
||||
herr_t H5O_close (H5G_entry_t *ent);
|
||||
@ -203,4 +213,8 @@ herr_t H5O_remove (H5G_entry_t *ent, const H5O_class_t *type, intn sequence);
|
||||
herr_t H5O_reset (const H5O_class_t *type, void *native);
|
||||
herr_t H5O_debug (H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
|
||||
intn fwidth);
|
||||
|
||||
/* EFL operators */
|
||||
size_t H5O_efl_total_size (H5O_efl_t *efl);
|
||||
|
||||
#endif
|
||||
|
@ -296,7 +296,7 @@ H5O_sdspace_debug(H5F_t *f, const void *mesg, FILE * stream,
|
||||
if (H5S_UNLIMITED==sdim->max[u]) {
|
||||
fprintf (stream, "%sINF", u?", ":"");
|
||||
} else {
|
||||
fprintf (stream, "%s%lu\n", u?", ":"",
|
||||
fprintf (stream, "%s%lu", u?", ":"",
|
||||
(unsigned long) (sdim->max[u]));
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,12 @@ herr_t H5Pset_layout (hid_t tid, H5D_layout_t layout);
|
||||
H5D_layout_t H5Pget_layout (hid_t tid);
|
||||
herr_t H5Pset_chunk (hid_t tid, int ndims, const size_t dim[]);
|
||||
int H5Pget_chunk (hid_t tid, int max_ndims, size_t dim[]/*out*/);
|
||||
herr_t H5Pset_external (hid_t plist_id, const char *name, size_t offset,
|
||||
size_t size);
|
||||
int H5Pget_external_count (hid_t plist_id);
|
||||
herr_t H5Pget_external (hid_t plist_id, int idx, size_t name_size,
|
||||
char *name/*out*/, size_t *offset/*out*/,
|
||||
size_t *size/*out*/);
|
||||
H5F_driver_t H5Pget_driver (hid_t tid);
|
||||
herr_t H5Pset_stdio (hid_t tid);
|
||||
herr_t H5Pget_stdio (hid_t tid);
|
||||
|
@ -93,8 +93,10 @@ typedef struct H5S_tconv_t {
|
||||
H5S_t *H5S_copy (const H5S_t *src);
|
||||
herr_t H5S_close (H5S_t *ds);
|
||||
size_t H5S_get_npoints (const H5S_t *ds);
|
||||
size_t H5S_get_npoints_max(const H5S_t *ds);
|
||||
intn H5S_get_ndims (const H5S_t *ds);
|
||||
intn H5S_get_dims (const H5S_t *ds, size_t dims[]/*out*/);
|
||||
intn H5S_get_dims (const H5S_t *ds, size_t dims[]/*out*/,
|
||||
size_t max_dims[]/*out*/);
|
||||
herr_t H5S_modify (H5G_entry_t *ent, const H5S_t *space);
|
||||
H5S_t *H5S_read (H5F_t *f, H5G_entry_t *ent);
|
||||
intn H5S_cmp (const H5S_t *ds1, const H5S_t *ds2);
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
/* Define atomic datatypes */
|
||||
#define H5S_ALL (-2)
|
||||
#define H5S_UNLIMITED 0
|
||||
#define H5S_UNLIMITED ((size_t)(-1L))
|
||||
|
||||
/* Different types of dataspaces */
|
||||
typedef enum H5S_class_t {
|
||||
|
@ -243,7 +243,7 @@ H5S_simp_mscat (const void *tconv_buf, size_t elmt_size,
|
||||
"hyperslab sampling is not implemented yet");
|
||||
}
|
||||
}
|
||||
if (H5S_get_dims (mem_space, mem_size)<0) {
|
||||
if (H5S_get_dims (mem_space, mem_size, NULL)<0) {
|
||||
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
|
||||
"unable to retrieve data space dimensions");
|
||||
}
|
||||
@ -348,7 +348,7 @@ H5S_simp_mgath (const void *buf, size_t elmt_size,
|
||||
"hyperslab sampling is not implemented yet");
|
||||
}
|
||||
}
|
||||
if (H5S_get_dims (mem_space, mem_size)<0) {
|
||||
if (H5S_get_dims (mem_space, mem_size, NULL)<0) {
|
||||
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
|
||||
"unable to retrieve data space dimensions");
|
||||
}
|
||||
|
@ -1774,7 +1774,7 @@ H5Tset_strpad(hid_t type_id, H5T_str_t strpad)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
intn
|
||||
int
|
||||
H5Tget_nmembers(hid_t type_id)
|
||||
{
|
||||
|
||||
|
@ -206,7 +206,7 @@ size_t H5Tget_ebias (hid_t type_id);
|
||||
H5T_norm_t H5Tget_norm (hid_t type_id);
|
||||
H5T_pad_t H5Tget_inpad (hid_t type_id);
|
||||
H5T_str_t H5Tget_strpad (hid_t type_id);
|
||||
intn H5Tget_nmembers (hid_t type_id);
|
||||
int H5Tget_nmembers (hid_t type_id);
|
||||
char *H5Tget_member_name (hid_t type_id, int membno);
|
||||
size_t H5Tget_member_offset (hid_t type_id, int membno);
|
||||
int H5Tget_member_dims (hid_t type_id, int membno, size_t dims[]/*out*/,
|
||||
|
50
src/H5V.c
50
src/H5V.c
@ -41,7 +41,7 @@ static hbool_t interface_initialize_g = TRUE;
|
||||
*/
|
||||
herr_t
|
||||
H5V_stride_optimize1(intn *np, size_t *elmt_size, size_t *size,
|
||||
intn *stride1)
|
||||
ssize_t *stride1)
|
||||
{
|
||||
FUNC_ENTER(H5V_stride_optimize1, FAIL);
|
||||
|
||||
@ -54,10 +54,10 @@ H5V_stride_optimize1(intn *np, size_t *elmt_size, size_t *size,
|
||||
/*
|
||||
* Combine adjacent memory accesses
|
||||
*/
|
||||
while (*np && stride1[*np - 1] == *elmt_size) {
|
||||
*elmt_size *= size[*np - 1];
|
||||
while (*np && stride1[*np-1] == *elmt_size) {
|
||||
*elmt_size *= size[*np-1];
|
||||
if (--*np) {
|
||||
stride1[*np - 1] += size[*np] * stride1[*np];
|
||||
stride1[*np-1] += size[*np] * stride1[*np];
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ H5V_stride_optimize1(intn *np, size_t *elmt_size, size_t *size,
|
||||
*/
|
||||
herr_t
|
||||
H5V_stride_optimize2(intn *np, size_t *elmt_size, size_t *size,
|
||||
intn *stride1, intn *stride2)
|
||||
ssize_t *stride1, ssize_t *stride2)
|
||||
{
|
||||
FUNC_ENTER(H5V_stride_optimize2, FAIL);
|
||||
|
||||
@ -101,12 +101,12 @@ H5V_stride_optimize2(intn *np, size_t *elmt_size, size_t *size,
|
||||
/*
|
||||
* Combine adjacent memory accesses
|
||||
*/
|
||||
while (*np && stride1[*np - 1] == *elmt_size &&
|
||||
stride2[*np - 1] == *elmt_size) {
|
||||
*elmt_size *= size[*np - 1];
|
||||
while (*np && stride1[*np-1] == *elmt_size &&
|
||||
stride2[*np-1] == *elmt_size) {
|
||||
*elmt_size *= size[*np-1];
|
||||
if (--*np) {
|
||||
stride1[*np - 1] += size[*np] * stride1[*np];
|
||||
stride2[*np - 1] += size[*np] * stride2[*np];
|
||||
stride1[*np-1] += size[*np] * stride1[*np];
|
||||
stride2[*np-1] += size[*np] * stride2[*np];
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ H5V_stride_optimize2(intn *np, size_t *elmt_size, size_t *size,
|
||||
size_t
|
||||
H5V_hyper_stride(intn n, const size_t *size,
|
||||
const size_t *total_size, const size_t *offset,
|
||||
intn *stride/*out*/)
|
||||
ssize_t *stride/*out*/)
|
||||
{
|
||||
size_t skip; /*starting point byte offset */
|
||||
size_t acc; /*accumulator */
|
||||
@ -165,9 +165,9 @@ H5V_hyper_stride(intn n, const size_t *size,
|
||||
/* others */
|
||||
for (i = n - 2, acc = 1; i >= 0; --i) {
|
||||
size_t tmp = acc * (total_size[i+1] - size[i+1]);
|
||||
assert (tmp<((size_t)1<<(8*sizeof(intn)-1)));
|
||||
stride[i] = (intn)tmp;
|
||||
acc *= total_size[i + 1];
|
||||
assert (tmp<((size_t)1<<(8*sizeof(ssize_t)-1)));
|
||||
stride[i] = (size_t)tmp; /*overflow checked*/
|
||||
acc *= total_size[i+1];
|
||||
skip += acc * (offset ? offset[i] : 0);
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ H5V_hyper_fill(intn n, const size_t *_size,
|
||||
{
|
||||
uint8 *dst = (uint8 *) _dst; /*cast for ptr arithmetic */
|
||||
size_t size[H5V_HYPER_NDIMS]; /*a modifiable copy of _size */
|
||||
intn dst_stride[H5V_HYPER_NDIMS]; /*destination stride info */
|
||||
ssize_t dst_stride[H5V_HYPER_NDIMS]; /*destination stride info */
|
||||
size_t dst_start; /*byte offset to start of stride*/
|
||||
size_t elmt_size = 1; /*bytes per element */
|
||||
herr_t status; /*function return status */
|
||||
@ -373,8 +373,8 @@ H5V_hyper_copy(intn n, const size_t *_size,
|
||||
const uint8 *src = (const uint8 *)_src; /*cast for ptr arithmtc */
|
||||
uint8 *dst = (uint8 *) _dst; /*cast for ptr arithmtc */
|
||||
size_t size[H5V_HYPER_NDIMS]; /*a modifiable _size */
|
||||
intn src_stride[H5V_HYPER_NDIMS]; /*source stride info */
|
||||
intn dst_stride[H5V_HYPER_NDIMS]; /*dest stride info */
|
||||
ssize_t src_stride[H5V_HYPER_NDIMS]; /*source stride info */
|
||||
ssize_t dst_stride[H5V_HYPER_NDIMS]; /*dest stride info */
|
||||
size_t dst_start, src_start; /*offset to start at */
|
||||
size_t elmt_size = 1; /*element size in bytes */
|
||||
herr_t status; /*return status */
|
||||
@ -436,7 +436,7 @@ H5V_hyper_copy(intn n, const size_t *_size,
|
||||
*/
|
||||
herr_t
|
||||
H5V_stride_fill(intn n, size_t elmt_size, const size_t *size,
|
||||
const intn *stride, void *_dst, uint8 fill_value)
|
||||
const ssize_t *stride, void *_dst, uint8 fill_value)
|
||||
{
|
||||
uint8 *dst = (uint8 *) _dst; /*cast for ptr arithmetic */
|
||||
size_t idx[H5V_HYPER_NDIMS]; /*1-origin indices */
|
||||
@ -457,10 +457,8 @@ H5V_stride_fill(intn n, size_t elmt_size, const size_t *size,
|
||||
for (j = n - 1, carry = TRUE; j >= 0 && carry; --j) {
|
||||
dst += stride[j];
|
||||
|
||||
if (--idx[j])
|
||||
carry = FALSE;
|
||||
else
|
||||
idx[j] = size[j];
|
||||
if (--idx[j]) carry = FALSE;
|
||||
else idx[j] = size[j];
|
||||
}
|
||||
}
|
||||
|
||||
@ -492,8 +490,8 @@ H5V_stride_fill(intn n, size_t elmt_size, const size_t *size,
|
||||
*/
|
||||
herr_t
|
||||
H5V_stride_copy(intn n, size_t elmt_size, const size_t *size,
|
||||
const intn *dst_stride, void *_dst,
|
||||
const intn *src_stride, const void *_src)
|
||||
const ssize_t *dst_stride, void *_dst,
|
||||
const ssize_t *src_stride, const void *_src)
|
||||
{
|
||||
uint8 *dst = (uint8 *) _dst; /*cast for ptr arithmetic*/
|
||||
const uint8 *src = (const uint8 *) _src; /*cast for ptr arithmetic*/
|
||||
@ -547,11 +545,11 @@ herr_t
|
||||
H5V_stride_copy2(size_t nelmts, size_t elmt_size,
|
||||
|
||||
/* destination */
|
||||
intn dst_n, const size_t *dst_size, const intn *dst_stride,
|
||||
intn dst_n, const size_t *dst_size, const ssize_t *dst_stride,
|
||||
void *_dst,
|
||||
|
||||
/* source */
|
||||
intn src_n, const size_t *src_size, const intn *src_stride,
|
||||
intn src_n, const size_t *src_size, const ssize_t *src_stride,
|
||||
const void *_src)
|
||||
{
|
||||
uint8 *dst = (uint8 *) _dst;
|
||||
|
@ -29,7 +29,7 @@
|
||||
#define H5V_ZERO NULL
|
||||
|
||||
size_t H5V_hyper_stride(intn n, const size_t *size, const size_t *total_size,
|
||||
const size_t *offset, intn *stride);
|
||||
const size_t *offset, ssize_t *stride);
|
||||
hbool_t H5V_hyper_disjointp(intn n, const size_t *offset1,
|
||||
const size_t *size1, const size_t *offset2,
|
||||
const size_t *size2);
|
||||
@ -42,18 +42,18 @@ herr_t H5V_hyper_copy(intn n, const size_t *size,
|
||||
void *_dst, const size_t *src_total_size,
|
||||
const size_t *src_offset, const void *_src);
|
||||
herr_t H5V_stride_fill(intn n, size_t elmt_size, const size_t *size,
|
||||
const intn *stride, void *_dst, uint8 fill_value);
|
||||
const ssize_t *stride, void *_dst, uint8 fill_value);
|
||||
herr_t H5V_stride_copy(intn n, size_t elmt_size, const size_t *_size,
|
||||
const intn *dst_stride, void *_dst,
|
||||
const intn *src_stride, const void *_src);
|
||||
const ssize_t *dst_stride, void *_dst,
|
||||
const ssize_t *src_stride, const void *_src);
|
||||
herr_t H5V_stride_copy2(size_t nelmts, size_t elmt_size, intn dst_n,
|
||||
const size_t *dst_size, const intn *dst_stride,
|
||||
const size_t *dst_size, const ssize_t *dst_stride,
|
||||
void *_dst, intn src_n, const size_t *src_size,
|
||||
const intn *src_stride, const void *_src);
|
||||
const ssize_t *src_stride, const void *_src);
|
||||
herr_t H5V_stride_optimize1(intn *np, size_t *elmt_size, size_t *size,
|
||||
intn *stride1);
|
||||
ssize_t *stride1);
|
||||
herr_t H5V_stride_optimize2(intn *np, size_t *elmt_size, size_t *size,
|
||||
intn *stride1, intn *stride2);
|
||||
ssize_t *stride1, ssize_t *stride2);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
@ -106,6 +106,79 @@
|
||||
# define TRUE (!FALSE)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Numeric data types
|
||||
*/
|
||||
typedef char char8;
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uchar8, uint8;
|
||||
|
||||
#if SIZEOF_SHORT==2
|
||||
typedef short int16;
|
||||
typedef unsigned short uint16;
|
||||
#else
|
||||
typedef int int16; /*not really */
|
||||
typedef unsigned uint16; /*not really */
|
||||
#endif
|
||||
|
||||
#if SIZEOF_INT==4
|
||||
typedef int int32;
|
||||
typedef unsigned int uint32;
|
||||
#elif SIZEOF_LONG==4
|
||||
typedef long int32;
|
||||
typedef unsigned long uint32;
|
||||
#else
|
||||
typedef int int32; /*not really */
|
||||
typedef unsigned uint32; /*not really */
|
||||
#endif
|
||||
|
||||
#if SIZEOF_INT==8
|
||||
typedef int int64;
|
||||
typedef unsigned uint64;
|
||||
#elif SIZEOF_LONG==8
|
||||
typedef long int64;
|
||||
typedef unsigned long uint64;
|
||||
#elif SIZEOF_LONG_LONG==8
|
||||
typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
#else
|
||||
# error "no 64-bit integer type"
|
||||
#endif
|
||||
|
||||
#if SIZEOF_FLOAT==4
|
||||
typedef float float32;
|
||||
#else
|
||||
typedef float float32; /*not really */
|
||||
#endif
|
||||
|
||||
#if SIZEOF_FLOAT==8
|
||||
typedef float float64;
|
||||
#elif SIZEOF_DOUBLE==8
|
||||
typedef double float64;
|
||||
#else
|
||||
# error "no 64-bit floating point type"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define a type for generic integers. Use this instead of `int' to
|
||||
* show that some thought went into the algorithm.
|
||||
*/
|
||||
typedef int intn;
|
||||
typedef unsigned uintn;
|
||||
|
||||
/*
|
||||
* Status return values for the `herr_t' type.
|
||||
* Since some unix/c routines use 0 and -1 (or more precisely, non-negative
|
||||
* vs. negative) as their return code, and some assumption had been made in
|
||||
* the code about that, it is important to keep these constants the same
|
||||
* values. When checking the success or failure of an integer-valued
|
||||
* function, remember to compare against zero and not one of these two
|
||||
* values.
|
||||
*/
|
||||
#define SUCCEED 0
|
||||
#define FAIL (-1)
|
||||
#define UFAIL (unsigned)(-1)
|
||||
|
||||
/*
|
||||
* File addresses.
|
||||
*/
|
||||
@ -113,6 +186,8 @@ typedef struct {
|
||||
uint64 offset; /*offset within an HDF5 file */
|
||||
} haddr_t;
|
||||
|
||||
#define H5F_ADDR_UNDEF {((uint64)(-1L))}
|
||||
|
||||
/*
|
||||
* Some compilers have problems declaring auto variables that point
|
||||
* to string constants. Use the CONSTR() macro so it's easy to fix
|
||||
|
@ -24,79 +24,17 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Data types
|
||||
* Status return values. Failed integer functions in HDF5 result almost
|
||||
* always in a negative value (unsigned failing functions sometimes return
|
||||
* zero for failure) while successfull return is non-negative (often zero).
|
||||
* The negative failure value is most commonly -1, but don't bet on it. The
|
||||
* proper way to detect failure is something like:
|
||||
*
|
||||
* if ((dset = H5Dopen (file, name))<0) {
|
||||
* fprintf (stderr, "unable to open the requested dataset\n");
|
||||
* }
|
||||
*/
|
||||
typedef char char8;
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uchar8, uint8;
|
||||
|
||||
#if SIZEOF_SHORT==2
|
||||
typedef short int16;
|
||||
typedef unsigned short uint16;
|
||||
#else
|
||||
typedef int int16; /*not really */
|
||||
typedef unsigned uint16; /*not really */
|
||||
#endif
|
||||
|
||||
#if SIZEOF_INT==4
|
||||
typedef int int32;
|
||||
typedef unsigned int uint32;
|
||||
#elif SIZEOF_LONG==4
|
||||
typedef long int32;
|
||||
typedef unsigned long uint32;
|
||||
#else
|
||||
typedef int int32; /*not really */
|
||||
typedef unsigned uint32; /*not really */
|
||||
#endif
|
||||
|
||||
#if SIZEOF_INT==8
|
||||
typedef int int64;
|
||||
typedef unsigned uint64;
|
||||
#elif SIZEOF_LONG==8
|
||||
typedef long int64;
|
||||
typedef unsigned long uint64;
|
||||
#elif SIZEOF_LONG_LONG==8
|
||||
typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
#else
|
||||
# error "no 64-bit integer type"
|
||||
#endif
|
||||
|
||||
#if SIZEOF_FLOAT==4
|
||||
typedef float float32;
|
||||
#else
|
||||
typedef float float32; /*not really */
|
||||
#endif
|
||||
|
||||
#if SIZEOF_FLOAT==8
|
||||
typedef float float64;
|
||||
#elif SIZEOF_DOUBLE==8
|
||||
typedef double float64;
|
||||
#else
|
||||
# error "no 64-bit floating point type"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define a type for generic integers. Use this instead of `int' to
|
||||
* show that some thought went into the algorithm.
|
||||
*/
|
||||
typedef int intn;
|
||||
typedef unsigned uintn;
|
||||
|
||||
/*
|
||||
* Status return values.
|
||||
* Since some unix/c routines use 0 and -1 (or more precisely, non-negative
|
||||
* vs. negative) as their return code, and some assumption had been made in
|
||||
* the code about that, it is important to keep these constants the same
|
||||
* values. When checking the success or failure of an integer-valued
|
||||
* function, remember to compare against zero and not one of these two
|
||||
* values.
|
||||
*/
|
||||
typedef intn herr_t;
|
||||
|
||||
#define SUCCEED 0
|
||||
#define FAIL (-1)
|
||||
#define UFAIL (unsigned)(-1)
|
||||
typedef int herr_t;
|
||||
|
||||
/*
|
||||
* Boolean type.
|
||||
@ -111,7 +49,8 @@ extern "C" {
|
||||
herr_t H5open (void);
|
||||
herr_t H5close (void);
|
||||
herr_t H5dont_atexit (void);
|
||||
herr_t H5version (uintn *majnum, uintn *minnum, uintn *relnum, uintn *patnum);
|
||||
herr_t H5version (unsigned *majnum, unsigned *minnum, unsigned *relnum,
|
||||
unsigned *patnum);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ CPPFLAGS=-I. -I../src @CPPFLAGS@
|
||||
|
||||
# These are our main targets. They should be listed in the order to be
|
||||
# executed, generally most specific tests to least specific tests.
|
||||
PROGS=testhdf5 hyperslab istore dtypes dsets cmpd_dset extend
|
||||
PROGS=testhdf5 hyperslab istore dtypes dsets cmpd_dset extend external
|
||||
TESTS=$(PROGS)
|
||||
|
||||
# Temporary files
|
||||
@ -23,7 +23,7 @@ MOSTLYCLEAN=cmpd_dset.h5 dataset.h5 extend.h5 istore.h5 tfile1.h5 tfile2.h5 \
|
||||
# other source lists are for the individual tests, the files of which may
|
||||
# overlap with other tests.
|
||||
PROG_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5s.c dtypes.c \
|
||||
hyperslab.c istore.c dsets.c cmpd_dset.c extend.c
|
||||
hyperslab.c istore.c dsets.c cmpd_dset.c extend.c external.c
|
||||
PROG_OBJ=$(PROG_SRC:.c=.o)
|
||||
|
||||
TESTHDF5_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5s.c
|
||||
@ -47,6 +47,9 @@ CMPD_DSET_OBJ=$(CMPD_DSET_SRC:.c=.o)
|
||||
EXTEND_SRC=extend.c
|
||||
EXTEND_OBJ=$(EXTEND_SRC:.c=.o)
|
||||
|
||||
EXTERNAL_SRC=external.c
|
||||
EXTERNAL_OBJ=$(EXTERNAL_SRC:.c=.o)
|
||||
|
||||
# Private header files (not to be installed)...
|
||||
PRIVATE_HDR=testhdf5.h
|
||||
|
||||
@ -72,4 +75,7 @@ cmpd_dset: $(CMPD_DSET_OBJ) ../src/libhdf5.a
|
||||
extend: $(EXTEND_OBJ) ../src/libhdf5.a
|
||||
$(CC) $(CFLAGS) -o $@ $(EXTEND_OBJ) ../src/libhdf5.a $(LIBS)
|
||||
|
||||
external: $(EXTERNAL_OBJ) ../src/libhdf5.a
|
||||
$(CC) $(CFLAGS) -o $@ $(EXTERNAL_OBJ) ../src/libhdf5.a $(LIBS)
|
||||
|
||||
@CONCLUDE@
|
||||
|
42
test/dsets.c
42
test/dsets.c
@ -31,9 +31,9 @@
|
||||
*
|
||||
* Purpose: Attempts to create a dataset.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: -1
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, December 9, 1997
|
||||
@ -56,7 +56,7 @@ test_create(hid_t file)
|
||||
dims[0] = 256;
|
||||
dims[1] = 512;
|
||||
space = H5Screate_simple(2, dims, NULL);
|
||||
assert(space != FAIL);
|
||||
assert(space>=0);
|
||||
|
||||
/*
|
||||
* Create a dataset using the default dataset creation properties. We're
|
||||
@ -171,10 +171,10 @@ test_create(hid_t file)
|
||||
goto error;
|
||||
}
|
||||
puts(" PASSED");
|
||||
return SUCCEED;
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return FAIL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -184,9 +184,9 @@ test_create(hid_t file)
|
||||
* multi-dimensional array without data type or data space
|
||||
* conversions, without compression, and stored contiguously.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: -1
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, December 10, 1997
|
||||
@ -217,7 +217,7 @@ test_simple_io(hid_t file)
|
||||
dims[0] = 100;
|
||||
dims[1] = 200;
|
||||
space = H5Screate_simple(2, dims, NULL);
|
||||
assert(space != FAIL);
|
||||
assert(space>=0);
|
||||
|
||||
/* Create the dataset */
|
||||
dataset = H5Dcreate(file, DSET_SIMPLE_IO_NAME, H5T_NATIVE_INT, space,
|
||||
@ -264,10 +264,10 @@ test_simple_io(hid_t file)
|
||||
H5Dclose(dataset);
|
||||
|
||||
puts(" PASSED");
|
||||
return SUCCEED;
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return FAIL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -275,9 +275,9 @@ test_simple_io(hid_t file)
|
||||
*
|
||||
* Purpose: Test some simple data type conversion stuff.
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: FAIL
|
||||
* Failure: -1
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, January 14, 1998
|
||||
@ -289,8 +289,8 @@ test_simple_io(hid_t file)
|
||||
static herr_t
|
||||
test_tconv(hid_t file)
|
||||
{
|
||||
uint8 *out=NULL, *in=NULL;
|
||||
intn i;
|
||||
char *out=NULL, *in=NULL;
|
||||
int i;
|
||||
size_t dims[1];
|
||||
hid_t space, dataset, type;
|
||||
herr_t status;
|
||||
@ -303,13 +303,17 @@ test_tconv(hid_t file)
|
||||
printf("%-70s", "Testing data type conversion");
|
||||
|
||||
/* Initialize the dataset */
|
||||
for (i = 0; i < 1000000; i++)
|
||||
((int32 *) out)[i] = 0x11223344;
|
||||
for (i = 0; i < 1000000; i++) {
|
||||
out[i*4+0] = 0x11;
|
||||
out[i*4+1] = 0x22;
|
||||
out[i*4+2] = 0x33;
|
||||
out[i*4+3] = 0x44;
|
||||
}
|
||||
|
||||
/* Create the data space */
|
||||
dims[0] = 1000000;
|
||||
space = H5Screate_simple (1, dims, NULL);
|
||||
assert(space != FAIL);
|
||||
assert(space >= 0);
|
||||
|
||||
/* Create the data set */
|
||||
dataset = H5Dcreate(file, DSET_TCONV_NAME, H5T_NATIVE_INT32, space,
|
||||
@ -351,7 +355,7 @@ test_tconv(hid_t file)
|
||||
H5Tclose(type);
|
||||
|
||||
puts(" PASSED");
|
||||
return SUCCEED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -375,7 +379,7 @@ main(void)
|
||||
{
|
||||
hid_t file;
|
||||
herr_t status;
|
||||
intn nerrors = 0;
|
||||
int nerrors = 0;
|
||||
|
||||
status = H5open ();
|
||||
assert (status>=0);
|
||||
|
@ -89,7 +89,10 @@ test_classes(void)
|
||||
static herr_t
|
||||
test_copy(void)
|
||||
{
|
||||
hid_t a_copy;
|
||||
hid_t a_copy;
|
||||
herr_t status;
|
||||
herr_t (*func)(void*) = NULL;
|
||||
void *client_data = NULL;
|
||||
|
||||
printf("%-70s", "Testing H5Tcopy()");
|
||||
|
||||
@ -109,7 +112,14 @@ test_copy(void)
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
if (H5Tclose(H5T_NATIVE_CHAR) >= 0) {
|
||||
|
||||
/* Temporarily turn off error reporting. */
|
||||
H5Eget_auto (&func, &client_data);
|
||||
H5Eset_auto (NULL, NULL);
|
||||
status = H5Tclose (H5T_NATIVE_CHAR);
|
||||
H5Eset_auto (func, client_data);
|
||||
|
||||
if (status >= 0) {
|
||||
puts("*FAILED*");
|
||||
if (!isatty(1)) {
|
||||
AT();
|
||||
@ -159,7 +169,7 @@ test_compound(void)
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
/* Add a coupld fields */
|
||||
/* Add a couple fields */
|
||||
status = H5Tinsert(complex_id, "real", HOFFSET(tmp, re),
|
||||
H5T_NATIVE_DOUBLE);
|
||||
if (status < 0) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Programmer: Robb Matzke <matzke@llnl.gov>
|
||||
* Friday, January 30, 1998
|
||||
*
|
||||
* Purpose: Tests extendable datasets.
|
||||
* Purpose: Tests extendible datasets.
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <hdf5.h>
|
||||
@ -17,7 +17,7 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
*
|
||||
* Purpose: Tests extendable datasets
|
||||
* Purpose: Tests extendible datasets
|
||||
*
|
||||
* Return: Success: exit(0)
|
||||
*
|
||||
|
550
test/external.c
Normal file
550
test/external.c
Normal file
@ -0,0 +1,550 @@
|
||||
/*
|
||||
* Copyright (C) 1998 NCSA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Programmer: Robb Matzke <matzke@llnl.gov>
|
||||
* Tuesday, March 3, 1998
|
||||
*
|
||||
* Purpose: Tests datasets stored in external raw files.
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <hdf5.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: display_error_cb
|
||||
*
|
||||
* Purpose: Displays the error stack after printing "*FAILED*".
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, March 4, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
display_error_cb (void *client_data)
|
||||
{
|
||||
puts ("*FAILED*");
|
||||
H5Eprint (stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_1
|
||||
*
|
||||
* Purpose: Describes various external datasets in an HDF5 file without
|
||||
* actually creating the external raw files.
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, March 3, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
test_1 (void)
|
||||
{
|
||||
hid_t file, plist, space, dset, grp;
|
||||
herr_t status;
|
||||
size_t size[2], max_size[2];
|
||||
herr_t (*func)(void*) = NULL;
|
||||
void *client_data = NULL;
|
||||
int n;
|
||||
|
||||
|
||||
/*
|
||||
* Create the file and an initial group. This causes messages about
|
||||
* debugging to be emitted before we start playing games with what the
|
||||
* output looks like.
|
||||
*/
|
||||
file = H5Fcreate ("extern_1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
assert (file>=0);
|
||||
grp = H5Gcreate (file, "emit-diagnostics", 8);
|
||||
H5Gclose (grp);
|
||||
|
||||
printf ("Testing external storage descriptions...\n");
|
||||
|
||||
/*
|
||||
* A single external file for a non-extendible dataset.
|
||||
*/
|
||||
do {
|
||||
printf ("%-70s", "...fixed-size data space, exact storage");
|
||||
fflush (stdout);
|
||||
plist = H5Pcreate (H5P_DATASET_CREATE);
|
||||
assert (plist>=0);
|
||||
status = H5Pset_external (plist, "ext1.data", 0, 400);
|
||||
assert (status>=0);
|
||||
|
||||
size[0] = max_size[0] = 100;
|
||||
space = H5Screate_simple (1, size, max_size);
|
||||
assert (space>=0);
|
||||
|
||||
/* Create the dataset, the `dset1' name is used later too */
|
||||
dset = H5Dcreate (file, "dset1", H5T_NATIVE_INT32, space, plist);
|
||||
if (dset<0) break;
|
||||
H5Dclose (dset);
|
||||
puts (" PASSED");
|
||||
} while (0);
|
||||
H5Sclose (space);
|
||||
H5Pclose (plist);
|
||||
|
||||
/*
|
||||
* A single external file which is too small to represent all the data.
|
||||
*/
|
||||
do {
|
||||
printf ("%-70s", "...external storage is too small");
|
||||
fflush (stdout);
|
||||
plist = H5Pcreate (H5P_DATASET_CREATE);
|
||||
assert (plist>=0);
|
||||
status = H5Pset_external (plist, "ext1.data", 0, 399);
|
||||
assert (status>=0);
|
||||
|
||||
size[0] = max_size[0] = 100;
|
||||
space = H5Screate_simple (1, size, max_size);
|
||||
assert (space>=0);
|
||||
|
||||
H5Eget_auto (&func, &client_data);
|
||||
H5Eset_auto (NULL, NULL);
|
||||
dset = H5Dcreate (file, "dset2", H5T_NATIVE_INT32, space, plist);
|
||||
H5Eset_auto (func, client_data);
|
||||
|
||||
if (dset>=0) {
|
||||
puts ("*FAILED*");
|
||||
printf (" Small external file succeeded instead of failing\n");
|
||||
H5Dclose (dset);
|
||||
break;
|
||||
}
|
||||
puts (" PASSED");
|
||||
} while (0);
|
||||
H5Sclose (space);
|
||||
H5Pclose (plist);
|
||||
|
||||
/*
|
||||
* A single external file which is large enough to represent the current
|
||||
* data and large enough to represent the eventual size of the data.
|
||||
*/
|
||||
do {
|
||||
printf ("%-70s", "...extendible dataspace, exact external size");
|
||||
fflush (stdout);
|
||||
plist = H5Pcreate (H5P_DATASET_CREATE);
|
||||
assert (plist>=0);
|
||||
status = H5Pset_external (plist, "ext1.data", 0, 800);
|
||||
assert (status>=0);
|
||||
|
||||
size[0] = 100;
|
||||
max_size[0] = 200;
|
||||
space = H5Screate_simple (1, size, max_size);
|
||||
assert (space>=0);
|
||||
|
||||
dset = H5Dcreate (file, "dset3", H5T_NATIVE_INT32, space, plist);
|
||||
if (dset<0) break;
|
||||
H5Dclose (dset);
|
||||
puts (" PASSED");
|
||||
} while (0);
|
||||
H5Sclose (space);
|
||||
H5Pclose (plist);
|
||||
|
||||
|
||||
/*
|
||||
* A single external file which is large enough for the current data size
|
||||
* but not large enough for the eventual size.
|
||||
*/
|
||||
do {
|
||||
printf ("%-70s", "...extendible dataspace, "
|
||||
"external storage is too small");
|
||||
fflush (stdout);
|
||||
plist = H5Pcreate (H5P_DATASET_CREATE);
|
||||
assert (plist>=0);
|
||||
status = H5Pset_external (plist, "ext1.data", 0, 799);
|
||||
assert (status>=0);
|
||||
|
||||
size[0] = 100;
|
||||
max_size[0] = 200;
|
||||
space = H5Screate_simple (1, size, max_size);
|
||||
assert (space>=0);
|
||||
|
||||
H5Eget_auto (&func, &client_data);
|
||||
H5Eset_auto (NULL, NULL);
|
||||
dset = H5Dcreate (file, "dset4", H5T_NATIVE_INT32, space, plist);
|
||||
H5Eset_auto (func, client_data);
|
||||
|
||||
if (dset>=0) {
|
||||
puts ("*FAILED*");
|
||||
printf (" Small external file succeeded instead of failing\n");
|
||||
H5Dclose (dset);
|
||||
break;
|
||||
}
|
||||
puts (" PASSED");
|
||||
} while (0);
|
||||
H5Sclose (space);
|
||||
H5Pclose (plist);
|
||||
|
||||
/*
|
||||
* A single external file of unlimited size and an unlimited data space.
|
||||
*/
|
||||
do {
|
||||
printf ("%-70s", "...unlimited dataspace, unlimited external storage");
|
||||
fflush (stdout);
|
||||
plist = H5Pcreate (H5P_DATASET_CREATE);
|
||||
assert (plist>=0);
|
||||
status = H5Pset_external (plist, "ext1.data", 0, H5F_UNLIMITED);
|
||||
assert (status>=0);
|
||||
|
||||
size[0] = 100;
|
||||
max_size[0] = H5S_UNLIMITED;
|
||||
space = H5Screate_simple (1, size, max_size);
|
||||
assert (space>=0);
|
||||
|
||||
/* Create the dataset, the `dset5' name is used later too */
|
||||
dset = H5Dcreate (file, "dset5", H5T_NATIVE_INT32, space, plist);
|
||||
if (dset<0) break;
|
||||
H5Dclose (dset);
|
||||
puts (" PASSED");
|
||||
} while (0);
|
||||
H5Sclose (space);
|
||||
H5Pclose (plist);
|
||||
|
||||
/*
|
||||
* Open one of the previous datasets and make sure it looks the same as
|
||||
* when we wrote it.
|
||||
*/
|
||||
do {
|
||||
char name[256];
|
||||
size_t file_offset;
|
||||
size_t file_size;
|
||||
|
||||
printf ("%-70s", "...opening a dataset and reading the storage info");
|
||||
fflush (stdout);
|
||||
|
||||
dset = H5Dopen (file, "dset1");
|
||||
assert (dset>=0);
|
||||
plist = H5Dget_create_parms (dset);
|
||||
assert (plist>=0);
|
||||
|
||||
n = H5Pget_external_count (plist);
|
||||
if (n<0) break;
|
||||
if (1!=n) {
|
||||
puts ("*FAILED*");
|
||||
printf (" Returned external count is wrong.\n");
|
||||
break;
|
||||
}
|
||||
strcpy (name+sizeof(name)-4, "...");
|
||||
status = H5Pget_external (plist, 0, sizeof(name)-4, name,
|
||||
&file_offset, &file_size);
|
||||
if (status<0) {
|
||||
printf (" Unable to read first extern file info.\n");
|
||||
break;
|
||||
} else if (file_offset!=0) {
|
||||
puts ("*FAILED*");
|
||||
printf (" Wrong file offset.\n");
|
||||
break;
|
||||
} else if (file_size!=400) {
|
||||
puts ("*FAILED*");
|
||||
printf (" Wrong file size.\n");
|
||||
break;
|
||||
}
|
||||
puts (" PASSED");
|
||||
} while (0);
|
||||
H5Pclose (plist);
|
||||
H5Dclose (dset);
|
||||
|
||||
/*
|
||||
* Open one of the previous unlimited datasets and make sure it looks the
|
||||
* same as when we wrote it.
|
||||
*/
|
||||
do {
|
||||
char name[256];
|
||||
size_t file_offset;
|
||||
size_t file_size;
|
||||
|
||||
printf ("%-70s", "...opening an unlimited dataset and reading the "
|
||||
"storage info");
|
||||
fflush (stdout);
|
||||
|
||||
dset = H5Dopen (file, "dset5");
|
||||
assert (dset>=0);
|
||||
plist = H5Dget_create_parms (dset);
|
||||
assert (plist>=0);
|
||||
|
||||
n = H5Pget_external_count (plist);
|
||||
if (n<0) break;
|
||||
if (1!=n) {
|
||||
puts ("*FAILED*");
|
||||
printf (" Returned external count is wrong.\n");
|
||||
break;
|
||||
}
|
||||
strcpy (name+sizeof(name)-4, "...");
|
||||
status = H5Pget_external (plist, 0, sizeof(name)-4, name,
|
||||
&file_offset, &file_size);
|
||||
if (status<0) {
|
||||
printf (" Unable to read first extern file info.\n");
|
||||
break;
|
||||
} else if (file_offset!=0) {
|
||||
puts ("*FAILED*");
|
||||
printf (" Wrong file offset.\n");
|
||||
break;
|
||||
} else if (H5F_UNLIMITED!=file_size) {
|
||||
puts ("*FAILED*");
|
||||
printf (" Wrong file size.\n");
|
||||
break;
|
||||
}
|
||||
puts (" PASSED");
|
||||
} while (0);
|
||||
H5Pclose (plist);
|
||||
H5Dclose (dset);
|
||||
|
||||
/*
|
||||
* Multiple external files for a dataset.
|
||||
*/
|
||||
do {
|
||||
printf ("%-70s", "...multiple external files");
|
||||
fflush (stdout);
|
||||
plist = H5Pcreate (H5P_DATASET_CREATE);
|
||||
assert (plist>=0);
|
||||
status = H5Pset_external (plist, "ext1.data", 0, 100);
|
||||
assert (status>=0);
|
||||
status = H5Pset_external (plist, "ext2.data", 0, 100);
|
||||
assert (status>=0);
|
||||
status = H5Pset_external (plist, "ext3.data", 0, 100);
|
||||
assert (status>=0);
|
||||
status = H5Pset_external (plist, "ext4.data", 0, 100);
|
||||
assert (status>=0);
|
||||
|
||||
size[0] = max_size[0] = 100;
|
||||
space = H5Screate_simple (1, size, max_size);
|
||||
assert (space>=0);
|
||||
|
||||
dset = H5Dcreate (file, "dset6", H5T_NATIVE_INT32, space, plist);
|
||||
if (dset<0) break;
|
||||
H5Dclose (dset);
|
||||
puts (" PASSED");
|
||||
} while (0);
|
||||
H5Sclose (space);
|
||||
H5Pclose (plist);
|
||||
|
||||
/*
|
||||
* It should be impossible to define an unlimited external file and then
|
||||
* follow it with another external file.
|
||||
*/
|
||||
do {
|
||||
printf ("%-70s", "...external file following unlimited file");
|
||||
fflush (stdout);
|
||||
plist = H5Pcreate (H5P_DATASET_CREATE);
|
||||
assert (plist>=0);
|
||||
status = H5Pset_external (plist, "ext1.data", 0, H5F_UNLIMITED);
|
||||
assert (status>=0);
|
||||
|
||||
/* Next function should fail */
|
||||
H5Eget_auto (&func, &client_data);
|
||||
H5Eset_auto (NULL, NULL);
|
||||
status = H5Pset_external (plist, "ext2.data", 0, 100);
|
||||
H5Eset_auto (func, client_data);
|
||||
if (status>=0) {
|
||||
puts ("*FAILED*");
|
||||
puts (" H5Pset_external() succeeded when it should have failed");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check the number of files */
|
||||
n = H5Pget_external_count (plist);
|
||||
if (n<0) break;
|
||||
if (1!=n) {
|
||||
puts ("*FAILED*");
|
||||
puts (" Wrong external file count returned.");
|
||||
}
|
||||
puts (" PASSED");
|
||||
} while (0);
|
||||
H5Pclose (plist);
|
||||
|
||||
/*
|
||||
* It should be impossible to create a set of external files whose total
|
||||
* size overflows a size_t integer.
|
||||
*/
|
||||
do {
|
||||
printf ("%-70s", "...address overflow in external files");
|
||||
fflush (stdout);
|
||||
plist = H5Pcreate (H5P_DATASET_CREATE);
|
||||
assert (plist>=0);
|
||||
status = H5Pset_external (plist, "ext1.data", 0, H5F_UNLIMITED-1);
|
||||
assert (status>=0);
|
||||
|
||||
/* Next function should fail */
|
||||
H5Eget_auto (&func, &client_data);
|
||||
H5Eset_auto (NULL, NULL);
|
||||
status = H5Pset_external (plist, "ext2.data", 0, 100);
|
||||
H5Eset_auto (func, client_data);
|
||||
if (status>=0) {
|
||||
puts ("*FAILED*");
|
||||
puts (" H5Pset_external() succeeded when it should have failed");
|
||||
break;
|
||||
}
|
||||
puts (" PASSED");
|
||||
} while (0);
|
||||
H5Pclose (plist);
|
||||
|
||||
|
||||
|
||||
/* END OF TESTS */
|
||||
H5Fclose (file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: test_2
|
||||
*
|
||||
* Purpose: Tests reading from an external file set.
|
||||
*
|
||||
* Return: Success: 0
|
||||
*
|
||||
* Failure: -1
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, March 4, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
test_2 (void)
|
||||
{
|
||||
hid_t file, plist, space, dset, grp;
|
||||
herr_t status;
|
||||
int fd,i, j;
|
||||
ssize_t n;
|
||||
char fname[64];
|
||||
int part[25], whole[100];
|
||||
size_t size;
|
||||
|
||||
/* Write the data to external files */
|
||||
printf ("Writing external data...\n");
|
||||
for (i=0; i<4; i++) {
|
||||
for (j=0; j<25; j++) {
|
||||
part[j] = i*25+j;
|
||||
}
|
||||
|
||||
sprintf (fname, "extern_%d.raw", i+1);
|
||||
fd = open (fname, O_RDWR|O_CREAT|O_TRUNC, 0666);
|
||||
assert (fd>=0);
|
||||
n = write (fd, part, sizeof(part));
|
||||
assert (n==sizeof(part));
|
||||
close (fd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create the file and an initial group. This causes messages about
|
||||
* debugging to be emitted before we start playing games with what the
|
||||
* output looks like.
|
||||
*/
|
||||
file = H5Fcreate ("extern_2.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
assert (file>=0);
|
||||
grp = H5Gcreate (file, "emit-diagnostics", 8);
|
||||
H5Gclose (grp);
|
||||
printf ("Testing external data reading...\n");
|
||||
|
||||
/* Create the external file list */
|
||||
plist = H5Pcreate (H5P_DATASET_CREATE);
|
||||
assert (plist>=0);
|
||||
status = H5Pset_external (plist, "extern_1.raw", 0, sizeof(part));
|
||||
assert (status>=0);
|
||||
status = H5Pset_external (plist, "extern_2.raw", 0, sizeof(part));
|
||||
assert (status>=0);
|
||||
status = H5Pset_external (plist, "extern_3.raw", 0, sizeof(part));
|
||||
assert (status>=0);
|
||||
status = H5Pset_external (plist, "extern_4.raw", 0, sizeof(part));
|
||||
assert (status>=0);
|
||||
|
||||
/* Create the data space */
|
||||
size = 100;
|
||||
space = H5Screate_simple (1, &size, NULL);
|
||||
assert (space>=0);
|
||||
|
||||
/* Create the dataset */
|
||||
dset = H5Dcreate (file, "dset1", H5T_NATIVE_INT, space, plist);
|
||||
assert (dset>=0);
|
||||
|
||||
/*
|
||||
* Read the entire dataset and compare with the original
|
||||
*/
|
||||
do {
|
||||
/* Read from the dataset */
|
||||
printf ("%-70s", "...reading entire dataset");
|
||||
fflush (stdout);
|
||||
status = H5Dread (dset, H5T_NATIVE_INT, space, space,
|
||||
H5P_DEFAULT, whole);
|
||||
if (status<0) {
|
||||
puts (" Failed to read dataset");
|
||||
break;
|
||||
}
|
||||
|
||||
for (i=0; i<100; i++) {
|
||||
if (whole[i]!=i) {
|
||||
puts ("*FAILED*");
|
||||
puts (" Incorrect value(s) read.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
puts (" PASSED");
|
||||
} while (0);
|
||||
|
||||
H5Dclose (dset);
|
||||
H5Pclose (plist);
|
||||
H5Sclose (space);
|
||||
H5Fclose (file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
*
|
||||
* Purpose: Runs external dataset tests.
|
||||
*
|
||||
* Return: Success: exit(0)
|
||||
*
|
||||
* Failure: exit(non-zero)
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Tuesday, March 3, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
herr_t status;
|
||||
int nerrors=0;
|
||||
|
||||
H5Eset_auto (display_error_cb, NULL);
|
||||
|
||||
status = test_1 ();
|
||||
nerrors += (status<0 ? 1 : 0);
|
||||
|
||||
status = test_2 ();
|
||||
nerrors += (status<0 ? 1 : 0);
|
||||
|
||||
if (0==nerrors) {
|
||||
printf ("All external storage tests passed.\n");
|
||||
}
|
||||
|
||||
exit (nerrors?1:0);
|
||||
}
|
1347
test/hyperslab.c
1347
test/hyperslab.c
File diff suppressed because it is too large
Load Diff
@ -171,7 +171,7 @@ main(int argc, char *argv[])
|
||||
H5version(&major, &minor, &release, &patch);
|
||||
|
||||
print_func("\nFor help use: testhdf5 -help\n");
|
||||
print_func("Linked with HDF %u.%u.%u%c\n\n", (unsigned) major,
|
||||
print_func("Linked with hdf5-%u.%u.%u%c\n\n", (unsigned) major,
|
||||
(unsigned) minor, (unsigned) release, 'a' + patch);
|
||||
for (CLLoop = 1; CLLoop < argc; CLLoop++) {
|
||||
if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-verbose") == 0) ||
|
||||
|
@ -32,8 +32,8 @@ static char RcsId[] = "$Revision$";
|
||||
#include <H5Mprivate.h>
|
||||
|
||||
#define F1_USERBLOCK_SIZE 0
|
||||
#define F1_OFFSET_SIZE 4
|
||||
#define F1_LENGTH_SIZE 4
|
||||
#define F1_OFFSET_SIZE sizeof(size_t)
|
||||
#define F1_LENGTH_SIZE sizeof(size_t)
|
||||
#define F1_SYM_LEAF_K 4
|
||||
#define F1_SYM_INTERN_K 16
|
||||
#define FILE1 "tfile1.h5"
|
||||
|
Loading…
Reference in New Issue
Block a user