[svn-r178] Changes since 19980127

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

./Makefile.in
./config/commence.in
	With GNU make you can now use `-j' and `-l' options and things
	get built correctly.  I can do a `make -j -l6 test' from a
	clean hdf5 source tree (after configure) in 45 seconds (8 to
	build dependencies, 26 to compile everything, and 11 to run
	the tests).

./src/H5Gnode.c
	Removed a comment that no longer applies.

./src/H5P.c
./src/H5Pprivate.h
./src/H5Ppublic.h
	Changed H5Pselect_hyperslab() to H5Pset_hyperslab() and added
	H5Pget_hyperslab() and H5P_get_hyperslab().

	Replaced a couple short memset() calls with a for loop.

	Removed `if (foo!=NULL)' from around H5MM_xfree() calls.

	Clear hslab_def when the hyperslab disappears.

./src/H5Tpublic.h
	Removed trailing enum comma.
This commit is contained in:
Robb Matzke 1998-01-28 00:47:19 -05:00
parent 84e5e6fd28
commit 7aa4f57811
9 changed files with 673 additions and 572 deletions

View File

@ -57,14 +57,14 @@ SUBDIRS=src test
# make used in combination with gcc will maintain dependency
# information automatically.
#
.PHONY: all lib progs test install uninstall dep depend clean mostlyclean \
distclean maintainer-clean
all lib progs test install uninstall TAGS dep depend:
@@SETX@; for d in $(SUBDIRS); do \
(cd $$d && $(MAKE) $@) || exit 1; \
done
.PHONY: all lib progs test install uninstall dep depend clean mostlyclean \
distclean maintainer-clean
clean mostlyclean:
@@SETX@; for d in $(SUBDIRS); do \
(cd $$d && $(MAKE) $@) || exit 1; \

View File

@ -30,8 +30,8 @@ bindir=@bindir@
libdir=@libdir@
includedir=@includedir@
# The default is to build the library and programs.
all: lib progs
# The default is to build the programs which in turn builds the lib.
all: progs
# The following rules insure that the Makefile is up-to-date by rerunning
# various autoconf components (although not all versions of make assume

View File

@ -772,7 +772,7 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
if ((my_ins = H5B_insert_helper(f, addr, type, lt_key, &lt_key_changed,
md_key, udata, rt_key, &rt_key_changed,
&child /*out */ )) < 0 || my_ins < 0) {
&child/*out*/ )) < 0 || my_ins < 0) {
HRETURN_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL,
"unable to insert key");
}
@ -1094,9 +1094,9 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
bt->key[idx].nkey, lt_key_changed,
md_key, udata,
bt->key[idx + 1].nkey, rt_key_changed,
&child_addr /*out */ )) < 0) {
&child_addr/*out*/)) < 0) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR,
"can't insert first leaf node");
"unable to insert first leaf node");
}
} else {
my_ins = H5B_INS_NOOP;

1082
src/H5G.c

File diff suppressed because it is too large Load Diff

View File

@ -753,11 +753,9 @@ H5G_node_insert(H5F_t *f, const haddr_t *addr,
idx += cmp > 0 ? 1 : 0;
/*
* Add the new name to the heap. The caller will check if the
* heap address changed and update the symbol table object header
* with the new heap address.
* Add the new name to the heap.
*/
offset = H5H_insert(f, &(bt_udata->heap_addr), HDstrlen(bt_udata->name) + 1,
offset = H5H_insert(f, &(bt_udata->heap_addr), HDstrlen(bt_udata->name)+1,
bt_udata->name);
bt_udata->ent.name_off = offset;
if (offset <= 0) {

132
src/H5P.c
View File

@ -961,11 +961,11 @@ H5Pset_space(hid_t sid, intn rank, const size_t *dims)
/*--------------------------------------------------------------------------
NAME
H5Pselect_hyperslab
H5Pset_hyperslab
PURPOSE
Select a hyperslab from a simple dataspace
USAGE
herr_t H5Pselect_hyperslab(sid, start, count, stride)
herr_t H5Pset_hyperslab(sid, start, count, stride)
hid_t sid; IN: Dataspace object to select hyperslab from
const size_t *start; IN: Starting location for hyperslab to select
const size_t *count; IN: Number of elements in hyperslab
@ -982,14 +982,14 @@ H5Pset_space(hid_t sid, intn rank, const size_t *dims)
datasets which extend in arbitrary directions.
--------------------------------------------------------------------------*/
herr_t
H5Pselect_hyperslab(hid_t sid, const size_t *start, const size_t *count, const size_t *stride)
H5Pset_hyperslab(hid_t sid, const size_t *start, const size_t *count, const size_t *stride)
{
H5P_t *space = NULL; /* dataspace to modify */
size_t *tmp_stride=NULL; /* temp. copy of stride */
intn u; /* local counting variable */
herr_t ret_value = SUCCEED;
FUNC_ENTER(H5Pselect_hyperslab, FAIL);
FUNC_ENTER(H5Pset_hyperslab, FAIL);
/* Clear errors and check args and all the boring stuff. */
H5ECLEAR;
@ -1006,15 +1006,16 @@ H5Pselect_hyperslab(hid_t sid, const size_t *start, const size_t *count, const s
/* Set up stride values for later use */
tmp_stride= H5MM_xmalloc(space->u.simple.rank*sizeof(size_t));
if(stride==NULL)
HDmemset(tmp_stride,1,space->u.simple.rank);
else
HDmemcpy(tmp_stride,stride,space->u.simple.rank);
for (u=0; u<space->u.simple.rank; u++) {
tmp_stride[u] = stride ? stride[u] : 1;
}
/* Allocate space for the hyperslab information */
space->h.start= H5MM_xcalloc(space->u.simple.rank,sizeof(size_t));
space->h.count= H5MM_xcalloc(space->u.simple.rank,sizeof(size_t));
space->h.stride= H5MM_xcalloc(space->u.simple.rank,sizeof(size_t));
if (NULL==space->h.start) {
space->h.start= H5MM_xcalloc(space->u.simple.rank,sizeof(size_t));
space->h.count= H5MM_xcalloc(space->u.simple.rank,sizeof(size_t));
space->h.stride= H5MM_xcalloc(space->u.simple.rank,sizeof(size_t));
}
/* Build hyperslab */
for(u=0; u<space->u.simple.rank; u++)
@ -1033,18 +1034,115 @@ H5Pselect_hyperslab(hid_t sid, const size_t *start, const size_t *count, const s
done:
if (ret_value == FAIL) { /* Error condition cleanup */
/* Free hyperslab arrays if we encounter an error */
if(space->h.start!=NULL)
H5MM_xfree(space->h.start);
if(space->h.count!=NULL)
H5MM_xfree(space->h.count);
if(space->h.stride!=NULL)
H5MM_xfree(space->h.stride);
H5MM_xfree(space->h.start);
H5MM_xfree(space->h.count);
H5MM_xfree(space->h.stride);
space->hslab_def = FALSE;
} /* end if */
/* Normal function cleanup */
H5MM_xfree(tmp_stride);
FUNC_LEAVE(ret_value);
}
/*-------------------------------------------------------------------------
* Function: H5Pget_hyperslab
*
* Purpose: Retrieves information about the hyperslab from a simple data
* space. If no hyperslab has been defined then the hyperslab
* is the same as the entire array.
*
* Return: Success: SUCCEED
*
* Failure: FAIL
*
* Programmer: Robb Matzke
* Wednesday, January 28, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_hyperslab (hid_t sid, size_t offset[]/*out*/, size_t size[]/*out*/,
size_t stride[]/*out*/)
{
H5P_t *ds = NULL;
FUNC_ENTER (H5Pget_hyperslab, FAIL);
H5ECLEAR;
/* Check args */
if (H5_DATASPACE!=H5A_group (sid) || NULL==(ds=H5A_object (sid))) {
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
}
/* Get hyperslab info */
if (H5P_get_hyperslab (ds, offset, size, stride)<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to retrieve hyperslab information");
}
FUNC_LEAVE (SUCCEED);
}
/*-------------------------------------------------------------------------
* Function: H5P_get_hyperslab
*
* Purpose: Retrieves information about the hyperslab from a simple data
* space. If no hyperslab has been defined then the hyperslab
* is the same as the entire array.
*
* Return: Success: SUCCEED
*
* Failure: FAIL
*
* Programmer: Robb Matzke
* Wednesday, January 28, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
herr_t
H5P_get_hyperslab (H5P_t *ds, size_t offset[]/*out*/, size_t size[]/*out*/,
size_t stride[]/*out*/)
{
intn i;
FUNC_ENTER (H5P_get_hyperslab, FAIL);
/* Check args */
assert (ds);
switch (ds->type) {
case H5P_SCALAR:
break;
case H5P_SIMPLE:
if (ds->hslab_def) {
for (i=0; i<ds->u.simple.rank; i++) {
if (offset) offset[i] = ds->h.start[i];
if (size) size[i] = ds->h.count[i];
if (stride) stride[i] = ds->h.stride[i];
}
} else {
for (i=0; i<ds->u.simple.rank; i++) {
if (offset) offset[i] = 0;
if (size) size[i] = ds->u.simple.size[i];
if (stride) stride[i] = 1;
}
}
break;
case H5P_COMPLEX: /*fall through*/
default:
HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL,
"hyperslabs not supported for this type of space");
}
FUNC_LEAVE (SUCCEED);
}
/*-------------------------------------------------------------------------
* Function: H5P_find

View File

@ -102,6 +102,8 @@ intn H5P_cmp (const H5P_t *ds1, const H5P_t *ds2);
hbool_t H5P_is_simple (const H5P_t *sdim);
uintn H5P_nelem (const H5P_t *space);
const H5P_conv_t *H5P_find (const H5P_t *mem_space, const H5P_t *file_space);
herr_t H5P_get_hyperslab (H5P_t *ds, size_t offset[]/*out*/,
size_t size[]/*out*/, size_t stride[]/*out*/);
/* Conversion functions for simple data spaces */
size_t H5P_simp_init (const struct H5O_layout_t *layout,

View File

@ -46,7 +46,10 @@ intn H5Pget_ndims (hid_t space_id);
intn H5Pget_dims (hid_t space_id, size_t dims[]);
hbool_t H5Pis_simple (hid_t space_id);
herr_t H5Pset_space (hid_t space_id, intn rank, const size_t *dims);
herr_t H5Pselect_hyperslab(hid_t sid, const size_t *start, const size_t *count, const size_t *stride);
herr_t H5Pset_hyperslab(hid_t sid, const size_t *start, const size_t *count,
const size_t *stride);
herr_t H5Pget_hyperslab (hid_t sid, size_t offset[]/*out*/,
size_t size[]/*out*/, size_t stride[]/*out*/);
#ifdef __cplusplus
}

View File

@ -99,7 +99,7 @@ typedef enum H5T_pad_t {
typedef enum H5T_bkg_t {
H5T_BKG_NONE = 0, /*background buffer is not needed, send NULL */
H5T_BKG_TEMP = 1, /*bkg buffer used as temp storage only */
H5T_BKG_YES = 2, /*init bkg buf with data before conversion */
H5T_BKG_YES = 2 /*init bkg buf with data before conversion */
} H5T_bkg_t;
/* Type conversion client data */