mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-19 16:50:46 +08:00
[svn-r1651] Fold in J90 changes
This commit is contained in:
parent
aeb5116600
commit
eea89e1e6c
@ -2172,7 +2172,9 @@ libdir='$install_libdir'\
|
||||
|
||||
if test -z "$run"; then
|
||||
# Export the shlibpath_var.
|
||||
eval "export $shlibpath_var"
|
||||
if test -n "$shlibpath_var"; then
|
||||
eval "export $shlibpath_var"
|
||||
fi
|
||||
|
||||
# Now actually exec the command.
|
||||
eval "exec \$cmd$args"
|
||||
|
26
configure.in
26
configure.in
@ -166,7 +166,7 @@ dnl Check for system libraries.
|
||||
dnl
|
||||
AC_CHECK_LIB(m,ceil)
|
||||
AC_CHECK_LIB(nsl,xdr_int) dnl ...for Solaris and hdf4
|
||||
AC_CHECK_LIB(coug,main) dnl ...for ASCI/Red
|
||||
dnl AC_CHECK_LIB(coug,main) dnl ...for ASCI/Red
|
||||
|
||||
dnl ----------------------------------------------------------------------
|
||||
dnl Check for system header files.
|
||||
@ -287,10 +287,10 @@ AC_ARG_WITH(hdf4,[ --with-hdf4=INC,LIB Use the HDF4 library],,withval=[/usr
|
||||
case $withval in
|
||||
yes)
|
||||
AC_CHECK_HEADERS(mfhdf.h,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(z,main,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(jpeg,main,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(df,main,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(mfhdf,main,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(z,deflate,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(jpeg,jpeg_start_compress,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(df,Hstartaccess,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(mfhdf,SDstart,,unset H5TOH4 TESTH5TOH4)
|
||||
;;
|
||||
no)
|
||||
AC_MSG_CHECKING(for HDF4)
|
||||
@ -314,15 +314,15 @@ case $withval in
|
||||
if test "X" != "$hdf4_lib"; then
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS -L$hdf4_lib"
|
||||
AC_CHECK_LIB(z,main,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(jpeg,main,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(df,main,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(mfhdf,main,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(z,deflate,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(jpeg,jpeg_start_compress,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(df,Hstartaccess,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(mfhdf,SDstart,,unset H5TOH4 TESTH5TOH4)
|
||||
else
|
||||
AC_CHECK_LIB(z,main,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(jpeg,main,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(df,main)
|
||||
AC_CHECK_LIB(mfhdf,main)
|
||||
AC_CHECK_LIB(z,deflate,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(jpeg,jpeg_start_compress,,unset H5TOH4 TESTH5TOH4)
|
||||
AC_CHECK_LIB(df,Hstartaccess)
|
||||
AC_CHECK_LIB(mfhdf,SDstart)
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
@ -265,8 +265,8 @@ static intn interface_initialize_g = 0;
|
||||
/* The first part of every integer hardware conversion macro */
|
||||
#define CI_BEGIN(STYPE,DTYPE,ST,DT,STRT) { \
|
||||
size_t elmtno; /*element number */ \
|
||||
uint8_t *src, *s; /*source buffer */ \
|
||||
uint8_t *dst, *d; /*destination buffer */ \
|
||||
void *src, *s; /*source buffer */ \
|
||||
void *dst, *d; /*destination buffer */ \
|
||||
H5T_t *st, *dt; /*data type descriptors */ \
|
||||
long_long aligned; /*largest integer type, aligned */ \
|
||||
hbool_t s_mv, d_mv; /*move data to align it? */ \
|
||||
@ -348,8 +348,8 @@ static intn interface_initialize_g = 0;
|
||||
if (d_mv) HDmemcpy(dst, &aligned, dt_size); \
|
||||
\
|
||||
/* Advance pointers */ \
|
||||
src += direction * s_stride; \
|
||||
dst += direction * d_stride; \
|
||||
src = (char *)src + direction * s_stride; \
|
||||
dst = (char *)dst + direction * d_stride; \
|
||||
} \
|
||||
break; \
|
||||
\
|
||||
|
208
test/dtypes.c
208
test/dtypes.c
@ -1925,6 +1925,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
|
||||
endian = H5Tget_order(H5T_NATIVE_INT);
|
||||
src_size = H5Tget_size(src);
|
||||
dst_size = H5Tget_size(dst);
|
||||
src_nbits = H5Tget_precision(src); /* not 8*src_size, esp on J90 - QAK */
|
||||
dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */
|
||||
buf = aligned_malloc(nelmts*MAX(src_size, dst_size));
|
||||
saved = aligned_malloc(nelmts*MAX(src_size, dst_size));
|
||||
aligned = malloc(sizeof(long_long));
|
||||
@ -2492,9 +2494,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
|
||||
}
|
||||
}
|
||||
|
||||
/* Make certain that there isn't some weird number of destination bits */
|
||||
assert(dst_nbits%8==0);
|
||||
|
||||
/* Are the two results the same */
|
||||
for (k=0; k<dst_size; k++) {
|
||||
if (buf[j*dst_size+k]!=hw[k]) break;
|
||||
for (k=(dst_size-(dst_nbits/8)); k<dst_size; k++) {
|
||||
if (buf[j*dst_size+k]!=hw[k]) break;
|
||||
}
|
||||
if (k==dst_size) continue; /*no error*/
|
||||
|
||||
@ -2504,13 +2509,11 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
|
||||
* certain things. These routines have already been tested by
|
||||
* the `bittests' program.
|
||||
*/
|
||||
src_nbits = 8*src_size;
|
||||
for (k=0; k<src_size; k++) {
|
||||
src_bits[src_size-(k+1)] = saved[j*src_size+
|
||||
ENDIAN(src_size, k)];
|
||||
}
|
||||
|
||||
dst_nbits = 8*dst_size;
|
||||
for (k=0; k<dst_size; k++) {
|
||||
dst_bits[dst_size-(k+1)] = buf[j*dst_size+
|
||||
ENDIAN(dst_size, k)];
|
||||
@ -2522,94 +2525,110 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
|
||||
* hardware conversion result during overflows is usually garbage
|
||||
* so we must handle those cases differetly when checking results.
|
||||
*/
|
||||
if (H5T_SGN_2==H5Tget_sign(src) &&
|
||||
H5T_SGN_2==H5Tget_sign(dst)) {
|
||||
if (src_size>dst_size &&
|
||||
0==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
|
||||
H5T_bit_find(src_bits, dst_nbits-1, (src_nbits-dst_nbits),
|
||||
H5T_BIT_MSB, 1)>=0) {
|
||||
/*
|
||||
* Source is positive and the magnitude is too large for
|
||||
* the destination. The destination should be set to the
|
||||
* maximum possible value: 0x7f...f
|
||||
*/
|
||||
if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
|
||||
H5T_bit_find(dst_bits, 0, dst_nbits-1,
|
||||
H5T_BIT_LSB, 0)<0) {
|
||||
continue; /*no error*/
|
||||
}
|
||||
} else if (src_size>dst_size &&
|
||||
1==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
|
||||
H5T_bit_find(src_bits, 0, src_nbits-1, H5T_BIT_MSB,
|
||||
0)+1>=(ssize_t)dst_nbits) {
|
||||
/*
|
||||
* Source is negative but the magnitude is too large for
|
||||
* the destination. The destination should be set to the
|
||||
* smallest possible value: 0x80...0
|
||||
*/
|
||||
if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
|
||||
H5T_bit_find(dst_bits, 0, dst_nbits-1,
|
||||
H5T_BIT_LSB, 1)<0) {
|
||||
continue; /*no error*/
|
||||
}
|
||||
}
|
||||
|
||||
} else if (H5T_SGN_2==H5Tget_sign(src) &&
|
||||
H5T_SGN_NONE==H5Tget_sign(dst)) {
|
||||
if (H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
|
||||
/*
|
||||
* The source is negative so the result should be zero.
|
||||
* The source is negative if the most significant bit is
|
||||
* set. The destination is zero if all bits are zero.
|
||||
*/
|
||||
if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 1)<0)
|
||||
continue; /*no error*/
|
||||
} else if (src_size>dst_size &&
|
||||
H5T_bit_find(src_bits, dst_nbits-1,
|
||||
src_nbits-dst_nbits, H5T_BIT_LSB,
|
||||
1)>=0) {
|
||||
/*
|
||||
* The source is a value with a magnitude too large for
|
||||
* the destination. The destination should be the
|
||||
* largest possible value: 0xff...f
|
||||
*/
|
||||
if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB,
|
||||
0)<0) {
|
||||
continue; /*no error*/
|
||||
}
|
||||
}
|
||||
|
||||
} else if (H5T_SGN_NONE==H5Tget_sign(src) &&
|
||||
H5T_SGN_2==H5Tget_sign(dst)) {
|
||||
if (src_size>=dst_size &&
|
||||
H5T_bit_find(src_bits, dst_nbits-1,
|
||||
(src_nbits-dst_nbits)+1, H5T_BIT_LSB, 1)>=0) {
|
||||
/*
|
||||
* The source value has a magnitude that is larger than
|
||||
* the destination can handle. The destination should be
|
||||
* set to the largest possible positive value: 0x7f...f
|
||||
*/
|
||||
if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
|
||||
H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB,
|
||||
0)<0) {
|
||||
continue; /*no error*/
|
||||
}
|
||||
}
|
||||
|
||||
if (H5T_SGN_2==H5Tget_sign(src) && H5T_SGN_2==H5Tget_sign(dst)) {
|
||||
if (src_nbits>dst_nbits) {
|
||||
if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
|
||||
H5T_bit_find(src_bits, dst_nbits-1, (src_nbits-dst_nbits),
|
||||
H5T_BIT_MSB, 1)>=0) {
|
||||
/*
|
||||
* Source is positive and the magnitude is too large for
|
||||
* the destination. The destination should be set to the
|
||||
* maximum possible value: 0x7f...f
|
||||
*/
|
||||
if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
|
||||
H5T_bit_find(dst_bits, 0, dst_nbits-1,
|
||||
H5T_BIT_LSB, 0)<0) {
|
||||
continue; /*no error*/
|
||||
}
|
||||
} else if (1==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
|
||||
H5T_bit_find(src_bits, 0, src_nbits-1, H5T_BIT_MSB,
|
||||
0)+1>=(ssize_t)dst_nbits) {
|
||||
/*
|
||||
* Source is negative but the magnitude is too large for
|
||||
* the destination. The destination should be set to the
|
||||
* smallest possible value: 0x80...0
|
||||
*/
|
||||
if (1==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
|
||||
H5T_bit_find(dst_bits, 0, dst_nbits-1,
|
||||
H5T_BIT_LSB, 1)<0) {
|
||||
continue; /*no error*/
|
||||
}
|
||||
}
|
||||
} else if(src_nbits<dst_nbits) {
|
||||
/* Source is smaller than the destination */
|
||||
if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
|
||||
/*
|
||||
* Source is positive, so the excess bits in the
|
||||
* destination should be set to 0's.
|
||||
*/
|
||||
if (0==H5T_bit_get_d(dst_bits, src_nbits-1, 1) &&
|
||||
H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits,
|
||||
H5T_BIT_LSB, 1)<0) {
|
||||
continue; /*no error*/
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Source is negative, so the excess bits in the
|
||||
* destination should be set to 1's.
|
||||
*/
|
||||
if (1==H5T_bit_get_d(dst_bits, src_nbits-1, 1) &&
|
||||
H5T_bit_find(dst_bits, src_nbits, dst_nbits-src_nbits,
|
||||
H5T_BIT_LSB, 0)<0) {
|
||||
continue; /*no error*/
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (H5T_SGN_2==H5Tget_sign(src) && H5T_SGN_NONE==H5Tget_sign(dst)) {
|
||||
if (H5T_bit_get_d(src_bits, src_nbits-1, 1)) {
|
||||
/*
|
||||
* The source is negative so the result should be zero.
|
||||
* The source is negative if the most significant bit is
|
||||
* set. The destination is zero if all bits are zero.
|
||||
*/
|
||||
if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 1)<0)
|
||||
continue; /*no error*/
|
||||
} else if (src_nbits>dst_nbits &&
|
||||
H5T_bit_find(src_bits, dst_nbits-1,
|
||||
src_nbits-dst_nbits, H5T_BIT_LSB,
|
||||
1)>=0) {
|
||||
/*
|
||||
* The source is a value with a magnitude too large for
|
||||
* the destination. The destination should be the
|
||||
* largest possible value: 0xff...f
|
||||
*/
|
||||
if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 0)<0) {
|
||||
continue; /*no error*/
|
||||
}
|
||||
}
|
||||
|
||||
} else if (H5T_SGN_NONE==H5Tget_sign(src) && H5T_SGN_2==H5Tget_sign(dst)) {
|
||||
if (src_nbits>=dst_nbits &&
|
||||
H5T_bit_find(src_bits, dst_nbits-1, (src_nbits-dst_nbits)+1,
|
||||
H5T_BIT_LSB, 1)>=0) {
|
||||
/*
|
||||
* The source value has a magnitude that is larger than
|
||||
* the destination can handle. The destination should be
|
||||
* set to the largest possible positive value: 0x7f...f
|
||||
*/
|
||||
if (0==H5T_bit_get_d(dst_bits, dst_nbits-1, 1) &&
|
||||
H5T_bit_find(dst_bits, 0, dst_nbits-1, H5T_BIT_LSB, 0)<0) {
|
||||
continue; /*no error*/
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (src_size>dst_size &&
|
||||
H5T_bit_find(src_bits, dst_nbits, src_nbits-dst_nbits,
|
||||
H5T_BIT_LSB, 1)>=0) {
|
||||
/*
|
||||
* The unsigned source has a value which is too large for
|
||||
* the unsigned destination. The destination should be
|
||||
* set to the largest possible value: 0xff...f
|
||||
*/
|
||||
if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB,
|
||||
0)<0) {
|
||||
continue; /*no error*/
|
||||
}
|
||||
}
|
||||
if (src_nbits>dst_nbits &&
|
||||
H5T_bit_find(src_bits, dst_nbits, src_nbits-dst_nbits,
|
||||
H5T_BIT_LSB, 1)>=0) {
|
||||
/*
|
||||
* The unsigned source has a value which is too large for
|
||||
* the unsigned destination. The destination should be
|
||||
* set to the largest possible value: 0xff...f
|
||||
*/
|
||||
if (H5T_bit_find(dst_bits, 0, dst_nbits, H5T_BIT_LSB, 0)<0) {
|
||||
continue; /*no error*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Print errors */
|
||||
@ -2633,12 +2652,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
|
||||
break;
|
||||
case INT_SHORT:
|
||||
memcpy(aligned, saved+j*sizeof(short), sizeof(short));
|
||||
printf(" %29d\n", *((short*)aligned));
|
||||
printf(" %29hd\n", *((short*)aligned));
|
||||
break;
|
||||
case INT_USHORT:
|
||||
memcpy(aligned, saved+j*sizeof(short),
|
||||
sizeof(unsigned short));
|
||||
printf(" %29u\n", *((unsigned short*)aligned));
|
||||
printf(" %29hu\n", *((unsigned short*)aligned));
|
||||
break;
|
||||
case INT_INT:
|
||||
memcpy(aligned, saved+j*sizeof(int), sizeof(int));
|
||||
@ -3029,7 +3048,8 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
|
||||
}
|
||||
|
||||
/* Sanity checks */
|
||||
assert(sizeof(float)!=sizeof(double));
|
||||
if(sizeof(float)==sizeof(double))
|
||||
puts("Sizeof(float)==sizeof(double) - some tests may not be sensible.");
|
||||
if (FLT_OTHER==src_type || FLT_OTHER==dst_type) {
|
||||
sprintf(str, "Testing random %s %s -> %s conversions",
|
||||
name, src_type_name, dst_type_name);
|
||||
|
@ -72,7 +72,7 @@ test_reference_obj(void)
|
||||
hobj_ref_t *wbuf, /* buffer to write to disk */
|
||||
*rbuf, /* buffer read from disk */
|
||||
*tbuf; /* temp. buffer read from disk */
|
||||
uint32_t *tu32; /* Temporary pointer to uint32 data */
|
||||
uintn *tu32; /* Temporary pointer to uint32 data */
|
||||
intn i; /* counting variables */
|
||||
const char *write_comment="Foo!"; /* Comments for group */
|
||||
char read_comment[10];
|
||||
@ -82,9 +82,9 @@ test_reference_obj(void)
|
||||
MESSAGE(5, ("Testing Object Reference Functions\n"));
|
||||
|
||||
/* Allocate write & read buffers */
|
||||
wbuf=malloc(sizeof(hobj_ref_t)*SPACE1_DIM1);
|
||||
rbuf=malloc(sizeof(hobj_ref_t)*SPACE1_DIM1);
|
||||
tbuf=malloc(sizeof(hobj_ref_t)*SPACE1_DIM1);
|
||||
wbuf=malloc(MAX(sizeof(uintn),sizeof(hobj_ref_t))*SPACE1_DIM1);
|
||||
rbuf=malloc(MAX(sizeof(uintn),sizeof(hobj_ref_t))*SPACE1_DIM1);
|
||||
tbuf=malloc(MAX(sizeof(uintn),sizeof(hobj_ref_t))*SPACE1_DIM1);
|
||||
|
||||
/* Create file */
|
||||
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
@ -103,14 +103,14 @@ test_reference_obj(void)
|
||||
CHECK(ret, FAIL, "H5Gset_comment");
|
||||
|
||||
/* Create a dataset (inside Group1) */
|
||||
dataset=H5Dcreate(group,"Dataset1",H5T_STD_U32LE,sid1,H5P_DEFAULT);
|
||||
dataset=H5Dcreate(group,"Dataset1",H5T_NATIVE_UINT,sid1,H5P_DEFAULT);
|
||||
CHECK(dataset, FAIL, "H5Dcreate");
|
||||
|
||||
for(tu32=(uint32_t *)wbuf,i=0; i<SPACE1_DIM1; i++)
|
||||
for(tu32=(uintn *)wbuf,i=0; i<SPACE1_DIM1; i++)
|
||||
*tu32++=i*3;
|
||||
|
||||
/* Write selection to disk */
|
||||
ret=H5Dwrite(dataset,H5T_STD_U32LE,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
|
||||
ret=H5Dwrite(dataset,H5T_NATIVE_UINT,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf);
|
||||
CHECK(ret, FAIL, "H5Dwrite");
|
||||
|
||||
/* Close Dataset */
|
||||
@ -219,10 +219,10 @@ test_reference_obj(void)
|
||||
VERIFY(ret, 4, "H5Sget_simple_extent_npoints");
|
||||
|
||||
/* Read from disk */
|
||||
ret=H5Dread(dset2,H5T_STD_U32LE,H5S_ALL,H5S_ALL,H5P_DEFAULT,tbuf);
|
||||
ret=H5Dread(dset2,H5T_NATIVE_UINT,H5S_ALL,H5S_ALL,H5P_DEFAULT,tbuf);
|
||||
CHECK(ret, FAIL, "H5Dread");
|
||||
|
||||
for(tu32=(uint32_t *)tbuf,i=0; i<SPACE1_DIM1; i++,tu32++)
|
||||
for(tu32=(uintn *)tbuf,i=0; i<SPACE1_DIM1; i++,tu32++)
|
||||
VERIFY(*tu32, (uint32_t)(i*3), "Data");
|
||||
|
||||
/* Close dereferenced Dataset */
|
||||
|
Loading…
x
Reference in New Issue
Block a user