[svn-r194] Changes since 19980128

----------------------

./src/H5P.c
	Removed H5Pcreate()

./src/H5Psimp.c
	Copy int[] return value from H5P_get_hyperslab() to size_t[]
	argument to pass to other hyperslab functions.

./test/dsets.c
	Added a call to H5Eprint() to help track down Alberts O2k bug.
This commit is contained in:
Robb Matzke 1998-01-28 23:11:58 -05:00
parent d4a3224c0f
commit d51c454c82
4 changed files with 104 additions and 76 deletions

View File

@ -133,67 +133,6 @@ H5Pcreate_simple(int rank, size_t dims[])
FUNC_LEAVE(ret_value);
}
#ifdef OLD_WAY
/*-------------------------------------------------------------------------
* Function: H5Pcreate
*
* Purpose: Creates a new data space object and opens it for access.
*
* Return: Success: The ID for the new data space object.
*
* Failure: FAIL
*
* Errors:
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
hid_t
H5Pcreate(H5P_class_t type)
{
H5P_t *ds = NULL;
hid_t ret_value = FAIL;
FUNC_ENTER(H5Pcreate, FAIL);
ds = H5MM_xcalloc(1, sizeof(H5P_t));
ds->type = type;
switch (type) {
case H5P_SCALAR:
/*void */
break;
case H5P_SIMPLE:
ds->u.simple.rank = 0;
break;
case H5P_COMPLEX:
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL,
"complex types are not supported yet");
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"unknown data space type");
}
/* Register the new data space and get an ID for it */
if ((ret_value = H5A_register(H5_DATASPACE, ds)) < 0) {
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL,
"unable to register data space for ID");
}
done:
if (ret_value < 0) {
H5MM_xfree(ds);
}
FUNC_LEAVE(ret_value);
}
#endif /* OLD_WAY */
/*-------------------------------------------------------------------------
* Function: H5Pclose
*
@ -1026,11 +965,13 @@ H5Pset_hyperslab(hid_t sid, const intn *start, const intn *count, const intn *st
if (H5_DATASPACE != H5A_group(sid) || (space = H5A_object(sid)) == NULL)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space");
if (start == NULL || count==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid hyperslab selected");
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"invalid hyperslab selected");
/* We can't modify other types of dataspaces currently, so error out */
if (space->type!=H5P_SIMPLE)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL,"unknown dataspace type");
HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL,
"unknown dataspace type");
/* Set up stride values for later use */
tmp_stride= H5MM_xmalloc(space->u.simple.rank*sizeof(intn));
@ -1039,13 +980,16 @@ H5Pset_hyperslab(hid_t sid, const intn *start, const intn *count, const intn *st
}
/* Range check arguments */
for(u=0; u<space->u.simple.rank; u++)
{
if(start[u]<0 || start[u]>=space->u.simple.size[u])
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL,"hyperslab bounds out of range");
if(start[u]+(SIGN(count[u])*(ABS(count[u])-1)*tmp_stride[u])<0 || start[u]+(SIGN(count[u])*(ABS(count[u])-1)*tmp_stride[u])>=space->u.simple.size[u])
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL,"hyperslab bounds out of range");
} /* end for */
for (u=0; u<space->u.simple.rank; u++) {
if (start[u]<0 || start[u]>=space->u.simple.size[u])
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL,
"hyperslab bounds out of range");
if (start[u]+(SIGN(count[u])*(ABS(count[u])-1)*tmp_stride[u])<0 ||
(start[u]+(SIGN(count[u])*(ABS(count[u])-1)*tmp_stride[u])>=
space->u.simple.size[u]))
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL,
"hyperslab bounds out of range");
} /* end for */
/* Allocate space for the hyperslab information */
if (NULL==space->h.start) {

View File

@ -36,9 +36,6 @@ extern "C" {
#endif
/* Functions in H5P.c */
#ifdef OLD_WAY
hid_t H5Pcreate (H5P_class_t type);
#endif /* OLD_WAY */
hid_t H5Pcreate_simple (int rank, size_t dims[]);
herr_t H5Pclose (hid_t space_id);
size_t H5Pget_npoints (hid_t space_id);
@ -49,7 +46,7 @@ herr_t H5Pset_space (hid_t space_id, int rank, const size_t *dims);
herr_t H5Pset_hyperslab(hid_t sid, const int *start, const int *count,
const int *stride);
int H5Pget_hyperslab (hid_t sid, int offset[]/*out*/,
int size[]/*out*/, int stride[]/*out*/);
int size[]/*out*/, int stride[]/*out*/);
#ifdef __cplusplus
}

View File

@ -93,6 +93,11 @@ H5P_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout,
size_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
size_t zero[H5O_LAYOUT_NDIMS]; /*zero */
size_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
#ifndef LATER
intn file_offset_signed[H5O_LAYOUT_NDIMS];
intn hsize_signed[H5O_LAYOUT_NDIMS];
intn sample_signed[H5O_LAYOUT_NDIMS];
#endif
intn space_ndims; /*dimensionality of space*/
intn i; /*counters */
@ -120,11 +125,26 @@ H5P_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout,
* currently pass sample information into H5F_arr_read() much less
* H5F_istore_read().
*/
if ((space_ndims=H5P_get_hyperslab (file_space, file_offset, hsize,
sample))<0) {
#ifdef LATER
if ((space_ndims=H5P_get_hyperslab (file_space, file_offset,
hsize, sample))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
"unable to retrieve hyperslab parameters");
#else
if ((space_ndims=H5P_get_hyperslab (file_space, file_offset_signed,
hsize_signed, sample_signed))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
"unable to retrieve hyperslab parameters");
}
for (i=0; i<space_ndims; i++) {
assert (file_offset_signed[i]>=0);
file_offset[i] = file_offset_signed[i];
assert (hsize_signed[i]>0);
hsize[i] = hsize_signed[i];
assert (sample_signed[i]>0);
sample[i] = sample_signed[i];
}
#endif
for (i=0; i<space_ndims; i++) {
if (sample[i]!=1) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, 0,
@ -177,6 +197,11 @@ H5P_simp_mscat (const void *tconv_buf, size_t elmt_size,
size_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
size_t zero[H5O_LAYOUT_NDIMS]; /*zero */
size_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
#ifndef LATER
intn mem_offset_signed[H5O_LAYOUT_NDIMS];
intn hsize_signed[H5O_LAYOUT_NDIMS];
intn sample_signed[H5O_LAYOUT_NDIMS];
#endif
intn space_ndims; /*dimensionality of space*/
intn i; /*counters */
@ -202,11 +227,27 @@ H5P_simp_mscat (const void *tconv_buf, size_t elmt_size,
* only handle hyperslabs with unit sample because there's currently no
* way to pass sample information to H5V_hyper_copy().
*/
#ifdef LATER
if ((space_ndims=H5P_get_hyperslab (mem_space, mem_offset, hsize,
sample))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to retrieve hyperslab parameters");
}
#else
if ((space_ndims=H5P_get_hyperslab (mem_space, mem_offset_signed,
hsize_signed, sample_signed))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to retrieve hyperslab parameters");
}
for (i=0; i<space_ndims; i++) {
assert (mem_offset_signed[i]>=0);
mem_offset[i] = mem_offset_signed[i];
assert (hsize_signed[i]>0);
hsize[i] = hsize_signed[i];
assert (sample_signed[i]>0);
sample[i] = sample_signed[i];
}
#endif
for (i=0; i<space_ndims; i++) {
if (sample[i]!=1) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
@ -267,6 +308,11 @@ H5P_simp_mgath (const void *buf, size_t elmt_size,
size_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
size_t zero[H5O_LAYOUT_NDIMS]; /*zero */
size_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
#ifndef LATER
intn mem_offset_signed[H5O_LAYOUT_NDIMS];
intn hsize_signed[H5O_LAYOUT_NDIMS];
intn sample_signed[H5O_LAYOUT_NDIMS];
#endif
intn space_ndims; /*dimensionality of space*/
intn i; /*counters */
@ -292,11 +338,27 @@ H5P_simp_mgath (const void *buf, size_t elmt_size,
* only handle hyperslabs with unit sample because there's currently no
* way to pass sample information to H5V_hyper_copy().
*/
#ifdef LATER
if ((space_ndims=H5P_get_hyperslab (mem_space, mem_offset, hsize,
sample))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
"unable to retrieve hyperslab parameters");
}
#else
if ((space_ndims=H5P_get_hyperslab (mem_space, mem_offset_signed,
hsize_signed, sample_signed))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to retrieve hyperslab parameters");
}
for (i=0; i<space_ndims; i++) {
assert (mem_offset_signed[i]>=0);
mem_offset[i] = mem_offset_signed[i];
assert (hsize_signed[i]>0);
hsize[i] = hsize_signed[i];
assert (sample_signed[i]>0);
sample[i] = sample_signed[i];
}
#endif
for (i=0; i<space_ndims; i++) {
if (sample[i]!=1) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, 0,
@ -356,6 +418,11 @@ H5P_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout,
size_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
size_t zero[H5O_LAYOUT_NDIMS]; /*zero vector */
size_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */
#ifndef LATER
intn file_offset_signed[H5O_LAYOUT_NDIMS];
intn hsize_signed[H5O_LAYOUT_NDIMS];
intn sample_signed[H5O_LAYOUT_NDIMS];
#endif
intn space_ndims; /*space dimensionality */
intn i; /*counters */
@ -383,11 +450,27 @@ H5P_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout,
* currently pass sample information into H5F_arr_read() much less
* H5F_istore_read().
*/
#ifdef LATER
if ((space_ndims=H5P_get_hyperslab (file_space, file_offset, hsize,
sample))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to retrieve hyperslab parameters");
}
#else
if ((space_ndims=H5P_get_hyperslab (file_space, file_offset_signed,
hsize_signed, sample_signed))<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to retrieve hyperslab parameters");
}
for (i=0; i<space_ndims; i++) {
assert (file_offset_signed[i]>=0);
file_offset[i] = file_offset_signed[i];
assert (hsize_signed[i]>0);
hsize[i] = hsize_signed[i];
assert (sample_signed[i]>0);
sample[i] = sample_signed[i];
}
#endif
for (i=0; i<space_ndims; i++) {
if (sample[i]!=1) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,

View File

@ -13,6 +13,9 @@
#include <stdio.h>
#include <unistd.h>
#include <H5Eprivate.h>
#ifndef HAVE_FUNCTION
#define __FUNCTION__ ""
#endif
@ -304,6 +307,7 @@ test_tconv(hid_t file)
/* Write the data to the dataset */
status = H5Dwrite(dataset, H5T_NATIVE_INT32, H5P_ALL, H5P_ALL,
H5C_DEFAULT, out);
if (status<0) H5Eprint (H5E_thrdid_g, stdout);
assert(status >= 0);
/* Create a new type with the opposite byte order */