[svn-r1065] Changes since 19990121

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

./configure.in
./acconfig.h
./configure		[REGENERATED]
./src/H5config.h.in	[REGENERATED]
./src/H5public.h
./src/H5Omtime.c
	Check for <stddef.h>

	Checks for `__tm_gmtoff' in `struct tm' because old versions
	of GNU libc are different than recent versions. This fixes the
	failing mtime test.

./bin/config.guess
./config/freebsd2.2.7	[REMOVED]
./config/freebsd	[ADDED]
	Changed the name so it works with all versions of FreeBSD.

./src/H5.c
	Moved H5F after H5T and H5G in H5_term_library() to satisfy
	dependencies.

./src/H5G.c
	Fixed a bug that caused H5Gcreate() to fail if the group name
	had trailing slashes.

./src/H5Gpublic.h
	Changed `group_name' to `name' in a prototype.

./src/Makefile.in
	Dynamic library on Linux, but needs for work to be generally
	useful.

./src/H5HG.c
./src/H5HGprivate.h
	Fixed alignment problems when using old GCC compilers (like
	the one shipped with RedHad Linux).

./tools/h5ls.c
	Fixed a bug where the contents of the root group could be
	listed twice if there was a link back to the root
	group. Similarly for groups that are mentioned on the command
	line.

	Fixed a bug where unknown types were printed with a random
	type class number.

./src/H5T.c
./src/H5Tconv.c
./src/H5Tprivate.h
	Fixed O(log N) conversion bugs.
This commit is contained in:
Robb Matzke 1999-02-15 12:38:04 -05:00
parent f6272d4292
commit c22bac0d20
21 changed files with 411 additions and 244 deletions

View File

@ -43,7 +43,7 @@
./config/commence.in
./config/conclude.in
./config/depend.in
./config/freebsd2.2.7
./config/freebsd
./config/hpux10.20
./config/hpux9.03
./config/intel-osf1

2
README
View File

@ -1,4 +1,4 @@
This is hdf5-1.1.39 released on Wed Feb 3 11:36:32 CST 1999
This is hdf5-1.1.39 released on Mon Feb 15 10:58:34 EST 1999
Please refer to the INSTALL file for installation instructions.
------------------------------------------------------------------------------

View File

@ -16,6 +16,9 @@
/* Define if `tm_gmtoff' is a member of `struct tm' */
#undef HAVE_TM_GMTOFF
/* Define if `__tm_gmtoff' is a member of `struct tm' */
#undef HAVE___TM_GMTOFF
/* Define if `timezone' is a global variable */
#undef HAVE_TIMEZONE

2
bin/config.guess vendored
View File

@ -319,7 +319,7 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
echo ${UNAME_MACHINE}-unknown-freebsd
exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`

View File

@ -6,4 +6,3 @@
# See BlankForm in this directory for details.
. config/linux
CPP=/usr/bin/cpp

455
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -143,6 +143,7 @@ AC_HEADER_STDC
AC_HEADER_TIME
dnl Unix
AC_CHECK_HEADERS(sys/resource.h sys/time.h unistd.h sys/ioctl.h sys/stat.h)
AC_CHECK_HEADERS(stddef.h)
dnl Windows
AC_CHECK_HEADERS(io.h winsock.h sys/timeb.h)
@ -304,6 +305,15 @@ AC_DEFINE(HAVE_TM_GMTOFF)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
dnl check if `struct tm' has a `__tm_gmtoff' member.
AC_MSG_CHECKING(for __tm_gmtoff in struct tm)
AC_TRY_COMPILE([
#include <sys/time.h>
#include <time.h>],[struct tm tm; tm.__tm_gmtoff=0;],
AC_DEFINE(HAVE___TM_GMTOFF)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
dnl Check whether the global variable `timezone' is defined.
AC_MSG_CHECKING(for global timezone variable)
AC_TRY_LINK([

View File

@ -143,6 +143,17 @@ H5_term_library(void)
* interface later.
*/
/*
* Cycles: The H5F layer participates in quite a few dependency cycles
* because it's cache depends on almost all other meta object
* packages and those packages depend on H5O which depends on H5F
* (because H5F_close() can delay until all object headers are
* closed). We handle this cycle by closing the H5F interface,
* which flushes the cache of all files, breaking any cycles.
*/
H5F_term_interface(-1);
H5F_term_interface(0);
/* Function What depends on it? */
/*------------------------- ------------------------------- */
H5D_term_interface(-1); /* */
@ -150,12 +161,12 @@ H5_term_library(void)
H5Z_term_interface(-1); /* */
H5A_term_interface(-1); /* */
H5RA_term_interface(-1); /* */
H5F_term_interface(-1); /* T */
H5G_term_interface(-1); /* */
H5R_term_interface(-1); /* */
H5S_term_interface(-1); /* */
H5T_native_close(-1); /* D RA */
H5T_term_interface(-1); /* D RA */
H5F_term_interface(-1); /* G T */
H5P_term_interface(-1); /* D */
H5I_term_interface(-1); /* A D F G P RA S T TB Z */
/*------------------------- --------------------------------- */

View File

@ -1263,9 +1263,10 @@ H5G_create(H5G_entry_t *loc, const char *name, size_t size_hint)
rest = H5G_component(rest, &nchars);
assert(rest && *rest);
if (rest[nchars]) {
if (H5G_component(rest + nchars, NULL)) {
const char *t = H5G_component(rest+nchars, NULL);
if (t && *t) {
HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "missing component");
} else if (nchars + 1 > sizeof _comp) {
} else if (nchars+1 > sizeof _comp) {
HRETURN_ERROR(H5E_SYM, H5E_COMPLEN, NULL, "component is too long");
} else {
/* null terminate */

View File

@ -67,7 +67,7 @@ typedef struct H5G_stat_t {
} H5G_stat_t;
typedef herr_t (*H5G_iterate_t)(hid_t group, const char *group_name,
typedef herr_t (*H5G_iterate_t)(hid_t group, const char *name,
void *op_data);
__DLL__ hid_t H5Gcreate (hid_t loc_id, const char *name, size_t size_hint);

View File

@ -96,6 +96,7 @@ H5HG_create (H5F_t *f, size_t size)
H5HG_heap_t *ret_value = NULL;
uint8_t *p = NULL;
haddr_t addr;
size_t n;
FUNC_ENTER (H5HG_create, NULL);
@ -135,8 +136,18 @@ H5HG_create (H5F_t *f, size_t size)
*p++ = 0; /*reserved*/
H5F_encode_length (f, p, size);
/*
* Padding so free space object is aligned. If malloc returned memory
* which was always at least H5HG_ALIGNMENT aligned then we could just
* align the pointer, but this might not be the case.
*/
n = H5HG_ALIGN(p-heap->chunk) - (p-heap->chunk);
memset(p, 0, n);
p += n;
/* The freespace object */
heap->obj[0].size = size - H5HG_SIZEOF_HDR(f);
assert(H5HG_ISALIGNED(heap->obj[0].size));
heap->obj[0].begin = p;
UINT16ENCODE(p, 0); /*object ID*/
UINT16ENCODE(p, 0); /*reference count*/
@ -301,7 +312,7 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void __unused__ *udata1,
* size is never padded and already includes the object header.
*/
if (idx>0) {
need = H5HG_ALIGN(H5HG_SIZEOF_OBJHDR(f) + heap->obj[idx].size);
need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(heap->obj[idx].size);
} else {
need = heap->obj[idx].size;
}
@ -309,7 +320,7 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void __unused__ *udata1,
}
}
assert(p==heap->chunk+heap->size);
assert(heap->obj[0].size==H5HG_ALIGN(heap->obj[0].size));
assert(H5HG_ISALIGNED(heap->obj[0].size));
/*
* Add the new heap to the CWFS list, removing some other entry if
@ -434,7 +445,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, int cwfsno, size_t size)
{
int idx;
uint8_t *p = NULL;
size_t need = H5HG_ALIGN(H5HG_SIZEOF_OBJHDR(f) + size);
size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size);
FUNC_ENTER (H5HG_alloc, FAIL);
@ -487,6 +498,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, int cwfsno, size_t size)
UINT16ENCODE(p, 0); /*nrefs*/
UINT32ENCODE(p, 0); /*reserved*/
H5F_encode_length (f, p, heap->obj[0].size);
assert(H5HG_ISALIGNED(heap->obj[0].size));
} else {
/*
@ -495,6 +507,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, int cwfsno, size_t size)
*/
heap->obj[0].size -= need;
heap->obj[0].begin += need;
assert(H5HG_ISALIGNED(heap->obj[0].size));
}
heap->dirty = 1;
@ -546,7 +559,7 @@ H5HG_insert (H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/)
}
/* Find a large enough collection on the CWFS list */
need = H5HG_ALIGN(size + H5HG_SIZEOF_OBJHDR(f));
need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size);
for (cwfsno=0; cwfsno<f->shared->ncwfs; cwfsno++) {
if (f->shared->cwfs[cwfsno]->obj[0].size>=need) {
/*
@ -819,8 +832,11 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
assert (heap->obj[hobj->idx].begin);
obj_start = heap->obj[hobj->idx].begin;
need = H5HG_ALIGN(heap->obj[hobj->idx].size);
need = H5HG_ALIGN(heap->obj[hobj->idx].size); /*
* should this include the
* object header size? -rpm
*/
/* Move the new free space to the end of the heap */
for (i=0; i<heap->nalloc; i++) {
if (heap->obj[i].begin > heap->obj[hobj->idx].begin) {

View File

@ -32,6 +32,7 @@
#define H5HG_ALIGNMENT 8
#define H5HG_ALIGN(X) (H5HG_ALIGNMENT*(((X)+H5HG_ALIGNMENT-1)/ \
H5HG_ALIGNMENT))
#define H5HG_ISALIGNED(X) ((X)==H5HG_ALIGN(X))
/*
* All global heap collections are at least this big. This allows us to read
@ -53,20 +54,24 @@
#define H5HG_MAXLINK 65535
/*
* The size of the collection header.
* The size of the collection header, always a multiple of the alignment so
* that the stuff that follows the header is aligned.
*/
#define H5HG_SIZEOF_HDR(f) (4 + /*magic number */ \
1 + /*version number */ \
3 + /*reserved */ \
H5F_SIZEOF_SIZE(f)) /*collection size */
#define H5HG_SIZEOF_HDR(f) \
H5HG_ALIGN(4 + /*magic number */ \
1 + /*version number */ \
3 + /*reserved */ \
H5F_SIZEOF_SIZE(f)) /*collection size */
/*
* The overhead associated with each object in the heap.
* The overhead associated with each object in the heap, always a multiple of
* the alignment so that the stuff that follows the header is aligned.
*/
#define H5HG_SIZEOF_OBJHDR(f) (2 + /*object id number */ \
2 + /*reference count */ \
4 + /*reserved */ \
H5F_SIZEOF_SIZE(f)) /*object data size */
#define H5HG_SIZEOF_OBJHDR(f) \
H5HG_ALIGN(2 + /*object id number */ \
2 + /*reference count */ \
4 + /*reserved */ \
H5F_SIZEOF_SIZE(f)) /*object data size */
/*
* The initial guess for the number of messages in a collection. We assume

View File

@ -109,8 +109,11 @@ H5O_mtime_decode(H5F_t __unused__ *f, const uint8_t *p,
#if defined(HAVE_TM_GMTOFF)
/* FreeBSD, OSF 4.0 */
the_time += tm.tm_gmtoff;
#elif defined(HAVE___TM_GMTOFF)
/* Linux libc-4 */
the_time += tm.__tm_gmtoff;
#elif defined(HAVE_TIMEZONE)
/* Linux */
/* Linux libc-5 */
the_time -= timezone - (tm.tm_isdst?3600:0);
#elif defined(HAVE_BSDGETTIMEOFDAY) && defined(HAVE_STRUCT_TIMEZONE)
/* Irix5.3 */

View File

@ -5075,7 +5075,7 @@ H5T_pack(H5T_t *dt)
}
/* Remove padding between members */
H5T_sort_value(dt);
H5T_sort_value(dt, NULL);
for (i=0, offset=0; i<dt->u.compnd.nmembs; i++) {
dt->u.compnd.memb[i].offset = offset;
offset += dt->u.compnd.memb[i].size;
@ -5095,7 +5095,8 @@ H5T_pack(H5T_t *dt)
* Purpose: Sorts the members of a compound data type by their offsets;
* sorts the members of an enum type by their values. This even
* works for locked data types since it doesn't change the value
* of the type.
* of the type. MAP is an optional parallel integer array which
* is also swapped along with members of DT.
*
* Return: Non-negative on success/Negative on failure
*
@ -5107,7 +5108,7 @@ H5T_pack(H5T_t *dt)
*-------------------------------------------------------------------------
*/
herr_t
H5T_sort_value(H5T_t *dt)
H5T_sort_value(H5T_t *dt, int *map)
{
int i, j, nmembs;
size_t size;
@ -5132,6 +5133,11 @@ H5T_sort_value(H5T_t *dt)
H5T_cmemb_t tmp = dt->u.compnd.memb[j];
dt->u.compnd.memb[j] = dt->u.compnd.memb[j+1];
dt->u.compnd.memb[j+1] = tmp;
if (map) {
int x = map[j];
map[j] = map[j+1];
map[j+1] = x;
}
swapped = TRUE;
}
}
@ -5166,6 +5172,13 @@ H5T_sort_value(H5T_t *dt)
dt->u.enumer.value+(j+1)*size, size);
HDmemcpy(dt->u.enumer.value+(j+1)*size, tbuf, size);
/* Swap map */
if (map) {
int x = map[j];
map[j] = map[j+1];
map[j+1] = x;
}
swapped = TRUE;
}
}
@ -5204,7 +5217,7 @@ H5T_sort_value(H5T_t *dt)
*-------------------------------------------------------------------------
*/
herr_t
H5T_sort_name(H5T_t *dt)
H5T_sort_name(H5T_t *dt, int *map)
{
int i, j, nmembs;
size_t size;
@ -5230,6 +5243,11 @@ H5T_sort_name(H5T_t *dt)
dt->u.compnd.memb[j] = dt->u.compnd.memb[j+1];
dt->u.compnd.memb[j+1] = tmp;
swapped = TRUE;
if (map) {
int x = map[j];
map[j] = map[j+1];
map[j+1] = x;
}
}
}
}
@ -5261,7 +5279,14 @@ H5T_sort_name(H5T_t *dt)
HDmemcpy(dt->u.enumer.value+j*size,
dt->u.enumer.value+(j+1)*size, size);
HDmemcpy(dt->u.enumer.value+(j+1)*size, tbuf, size);
/* Swap map */
if (map) {
int x = map[j];
map[j] = map[j+1];
map[j+1] = x;
}
swapped = TRUE;
}
}
@ -5390,7 +5415,7 @@ H5T_enum_nameof(H5T_t *dt, void *value, char *name/*out*/, size_t size)
if (name && size>0) *name = '\0';
/* Do a binary search over the values to find the correct one */
H5T_sort_value(dt);
H5T_sort_value(dt, NULL);
lt = 0;
rt = dt->u.enumer.nmembs;
md = -1;
@ -5458,7 +5483,7 @@ H5T_enum_valueof(H5T_t *dt, const char *name, void *value/*out*/)
assert(value);
/* Do a binary search over the names to find the correct one */
H5T_sort_name(dt);
H5T_sort_name(dt, NULL);
lt = 0;
rt = dt->u.enumer.nmembs;
md = -1;

View File

@ -550,8 +550,8 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
/*
* Insure that members are sorted.
*/
H5T_sort_value(src);
H5T_sort_value(dst);
H5T_sort_value(src, NULL);
H5T_sort_value(dst, NULL);
/*
* Build a mapping from source member number to destination member
@ -761,8 +761,8 @@ H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/*
* Insure that members are sorted.
*/
H5T_sort_value(src);
H5T_sort_value(dst);
H5T_sort_value(src, NULL);
H5T_sort_value(dst, NULL);
src2dst = priv->src2dst;
/*
@ -910,8 +910,8 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
* symbol names and build a map from source member index to destination
* member index.
*/
H5T_sort_name(src);
H5T_sort_name(dst);
H5T_sort_name(src, NULL);
H5T_sort_name(dst, NULL);
if (NULL==(priv->src2dst=H5MM_malloc(src->u.enumer.nmembs*sizeof(int)))) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");;
@ -994,6 +994,9 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
H5MM_xfree(priv->src2dst);
priv->src2dst = map;
HGOTO_DONE(SUCCEED);
} else {
/* Sort source type by value and adjust src2dst[] appropriately */
H5T_sort_value(src, priv->src2dst);
}
}
ret_value = SUCCEED;
@ -1082,9 +1085,17 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
}
assert (H5T_ENUM==src->type);
assert (H5T_ENUM==dst->type);
H5T_sort_name(src);
H5T_sort_name(dst);
if (priv->length) {
/* Use O(1) lookup */
H5T_sort_name(src, NULL);
H5T_sort_name(dst, NULL);
} else {
/* Use O(log N) lookup */
H5T_sort_value(src, NULL); /*yes, by value*/
H5T_sort_name(dst, NULL); /*yes, by name*/
}
/*
* Direction of conversion.
*/
@ -1109,6 +1120,7 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
} else {
n = *((int*)s);
}
n -= priv->base;
if (n<0 || n>=priv->length || priv->src2dst[n]<0) {
if (!H5T_overflow_g ||
(H5T_overflow_g)(src_id, dst_id, s, d)<0) {

View File

@ -77,14 +77,13 @@ __DLL__ herr_t H5T_struct_insert(H5T_t *parent, const char *name, size_t offset,
intn ndims, const size_t *dim, const intn *perm,
const H5T_t *member);
__DLL__ herr_t H5T_enum_insert(H5T_t *dt, const char *name, void *value);
__DLL__ herr_t H5T_sort_value(H5T_t *dt);
__DLL__ herr_t H5T_pack(H5T_t *dt);
__DLL__ herr_t H5T_debug(H5T_t *dt, FILE * stream);
__DLL__ H5G_entry_t *H5T_entof(H5T_t *dt);
__DLL__ H5T_path_t *H5T_path_find(const H5T_t *src, const H5T_t *dst,
const char *name, H5T_conv_t func);
__DLL__ herr_t H5T_sort_vaue(H5T_t *dt);
__DLL__ herr_t H5T_sort_name(H5T_t *dt);
__DLL__ herr_t H5T_sort_value(H5T_t *dt, int *map);
__DLL__ herr_t H5T_sort_name(H5T_t *dt, int *map);
__DLL__ herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id,
size_t nelmts, void *buf, void *bkg);
__DLL__ herr_t H5T_set_size(H5T_t *dt, size_t size);

View File

@ -50,6 +50,9 @@
/* Define if `tm_gmtoff' is a member of `struct tm' */
#undef HAVE_TM_GMTOFF
/* Define if `__tm_gmtoff' is a member of `struct tm' */
#undef HAVE___TM_GMTOFF
/* Define if `timezone' is a global variable */
#undef HAVE_TIMEZONE
@ -191,6 +194,9 @@
/* Define if you have the <mfhdf.h> header file. */
#undef HAVE_MFHDF_H
/* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H

View File

@ -29,10 +29,12 @@ static char RcsId[] = "@(#)$Revision$";
# include <limits.h> /*for H5T_NATIVE_CHAR defn in H5Tpublic.h */
#endif
#include <stddef.h>
#ifdef HAVE_STDDEF_H
# include <stddef.h>
#endif
#ifdef HAVE_PARALLEL
# include <mpi.h>
# include <mpio.h>
# include <mpi.h>
# include <mpio.h>
#endif
#include <H5api_adpt.h>

View File

@ -50,4 +50,9 @@ H5Tinit.c: H5detect
H5detect: H5detect.o
$(CC) $(CFLAGS) -o $@ H5detect.o $(LDFLAGS) $(LIBS)
# dynamic library with gcc. This needs more work to support other systems.
shared: libhdf5.so.1.2.0
libhdf5.so.1.2.0: $(LIB_OBJ)
$(CC) $(CFLAGS) -o $@ -shared -fPIC $^
@CONCLUDE@

View File

@ -219,7 +219,7 @@ test_tr1(hid_t file)
if (H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1)<0) goto error;
if (H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2)<0) goto error;
for (i=0; i<ds_size[1]; i++) {
for (i=0; i<ds_size[0]; i++) {
if (data1[i]!=data2[i]) {
FAILED();
printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n",
@ -299,7 +299,7 @@ test_tr2(hid_t file)
if (H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1)<0) goto error;
if (H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2)<0) goto error;
for (i=0; i<ds_size[1]; i++) {
for (i=0; i<ds_size[0]; i++) {
if (data1[i]!=data2[i]) {
FAILED();
printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n",

View File

@ -926,7 +926,7 @@ display_reference_type(hid_t type, int __unused__ indent)
static void
display_type(hid_t type, int indent)
{
H5T_class_t data_class;
H5T_class_t data_class = H5Tget_class(type);
/* Bad data type */
if (type<0) {
@ -1801,16 +1801,19 @@ main (int argc, char *argv[])
* If there are no arguments then list `/'.
*/
if (argno>=argc) {
H5Gget_objinfo(file, "/", TRUE, &sb);
sym_insert(&sb, "/");
iter.container = "/";
H5Giterate(file, "/", NULL, list, &iter);
} else {
for (/*void*/; argno<argc; argno++) {
if (H5Gget_objinfo(file, argv[argno], TRUE, &sb)>=0 &&
H5G_GROUP==sb.type) {
/*
* Specified name is a group. List the complete contents of
* the group.
*/
H5G_GROUP==sb.type) {
sym_insert(&sb, argv[argno]);
iter.container = container = fix_name("", argv[argno]);
H5Giterate(file, argv[argno], NULL, list, &iter);
free(container);