[svn-r12171] Purpose:

bug fixes

Description:
h5dump/h5ls were not displaying long doubles correctly

Solution:
1) the print datatype functions were incorrectly testing for the valid return value from H5Tequal,
   (TRUE), causing the display of an incorrect name of a dataype in error cases from H5Tequal
2) h5tools_print_str did not have a case for native long double
3) added a file generator for a long double dataset
4) added one script test for the long double data (commented , some sytems don't have a native long double match, and the output differs)
5) added a vms file and h5dump script test


Platforms tested:
linux 32, 64
solaris
AIX

Misc. update:
This commit is contained in:
Pedro Vicente Nunes 2006-03-28 16:25:10 -05:00
parent 194d3dfe52
commit cd25a7690a
10 changed files with 259 additions and 110 deletions

View File

@ -1059,7 +1059,9 @@
./tools/testfiles/tstring2.ddl
./tools/testfiles/tstr3.h5
./tools/testfiles/taindices.h5
./tools/testfiles/tvms.ddl
./tools/testfiles/tldouble.h5
./tools/testfiles/tvms.h5
# Expected output from h5ls tests

View File

@ -655,7 +655,8 @@ usage(const char *prog)
*
* Programmer: Ruey-Hsia Li
*
* Modifications:
* Modifications: pvn, March 28, 2006
* print information about type when a native match is not possible
*
*-------------------------------------------------------------------------
*/
@ -677,6 +678,9 @@ print_datatype(hid_t type,unsigned in_group)
hid_t super;
hid_t tmp_type;
htri_t is_vlstr=FALSE;
const char *order_s=NULL; /* byte order string */
H5T_sign_t sign; /* sign scheme value */
const char *sign_s=NULL; /* sign scheme string */
if (!in_group && H5Tcommitted(type) > 0) {
obj_t *obj; /* Found object */
@ -696,88 +700,141 @@ print_datatype(hid_t type,unsigned in_group)
} else {
switch (H5Tget_class(type)) {
case H5T_INTEGER:
if (H5Tequal(type, H5T_STD_I8BE)) {
if (H5Tequal(type, H5T_STD_I8BE)==TRUE) {
printf("H5T_STD_I8BE");
} else if (H5Tequal(type, H5T_STD_I8LE)) {
} else if (H5Tequal(type, H5T_STD_I8LE)==TRUE) {
printf("H5T_STD_I8LE");
} else if (H5Tequal(type, H5T_STD_I16BE)) {
} else if (H5Tequal(type, H5T_STD_I16BE)==TRUE) {
printf("H5T_STD_I16BE");
} else if (H5Tequal(type, H5T_STD_I16LE)) {
} else if (H5Tequal(type, H5T_STD_I16LE)==TRUE) {
printf("H5T_STD_I16LE");
} else if (H5Tequal(type, H5T_STD_I32BE)) {
} else if (H5Tequal(type, H5T_STD_I32BE)==TRUE) {
printf("H5T_STD_I32BE");
} else if (H5Tequal(type, H5T_STD_I32LE)) {
} else if (H5Tequal(type, H5T_STD_I32LE)==TRUE) {
printf("H5T_STD_I32LE");
} else if (H5Tequal(type, H5T_STD_I64BE)) {
} else if (H5Tequal(type, H5T_STD_I64BE)==TRUE) {
printf("H5T_STD_I64BE");
} else if (H5Tequal(type, H5T_STD_I64LE)) {
} else if (H5Tequal(type, H5T_STD_I64LE)==TRUE) {
printf("H5T_STD_I64LE");
} else if (H5Tequal(type, H5T_STD_U8BE)) {
} else if (H5Tequal(type, H5T_STD_U8BE)==TRUE) {
printf("H5T_STD_U8BE");
} else if (H5Tequal(type, H5T_STD_U8LE)) {
} else if (H5Tequal(type, H5T_STD_U8LE)==TRUE) {
printf("H5T_STD_U8LE");
} else if (H5Tequal(type, H5T_STD_U16BE)) {
} else if (H5Tequal(type, H5T_STD_U16BE)==TRUE) {
printf("H5T_STD_U16BE");
} else if (H5Tequal(type, H5T_STD_U16LE)) {
} else if (H5Tequal(type, H5T_STD_U16LE)==TRUE) {
printf("H5T_STD_U16LE");
} else if (H5Tequal(type, H5T_STD_U32BE)) {
} else if (H5Tequal(type, H5T_STD_U32BE)==TRUE) {
printf("H5T_STD_U32BE");
} else if (H5Tequal(type, H5T_STD_U32LE)) {
} else if (H5Tequal(type, H5T_STD_U32LE)==TRUE) {
printf("H5T_STD_U32LE");
} else if (H5Tequal(type, H5T_STD_U64BE)) {
} else if (H5Tequal(type, H5T_STD_U64BE)==TRUE) {
printf("H5T_STD_U64BE");
} else if (H5Tequal(type, H5T_STD_U64LE)) {
} else if (H5Tequal(type, H5T_STD_U64LE)==TRUE) {
printf("H5T_STD_U64LE");
} else if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
} else if (H5Tequal(type, H5T_NATIVE_SCHAR)==TRUE) {
printf("H5T_NATIVE_SCHAR");
} else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
} else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) {
printf("H5T_NATIVE_UCHAR");
} else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
} else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) {
printf("H5T_NATIVE_SHORT");
} else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
} else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) {
printf("H5T_NATIVE_USHORT");
} else if (H5Tequal(type, H5T_NATIVE_INT)) {
} else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) {
printf("H5T_NATIVE_INT");
} else if (H5Tequal(type, H5T_NATIVE_UINT)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT)==TRUE) {
printf("H5T_NATIVE_UINT");
} else if (H5Tequal(type, H5T_NATIVE_LONG)) {
} else if (H5Tequal(type, H5T_NATIVE_LONG)==TRUE) {
printf("H5T_NATIVE_LONG");
} else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
} else if (H5Tequal(type, H5T_NATIVE_ULONG)==TRUE) {
printf("H5T_NATIVE_ULONG");
} else if (H5Tequal(type, H5T_NATIVE_LLONG)) {
} else if (H5Tequal(type, H5T_NATIVE_LLONG)==TRUE) {
printf("H5T_NATIVE_LLONG");
} else if (H5Tequal(type, H5T_NATIVE_ULLONG)) {
} else if (H5Tequal(type, H5T_NATIVE_ULLONG)==TRUE) {
printf("H5T_NATIVE_ULLONG");
} else {
printf("undefined integer");
d_status = EXIT_FAILURE;
/* byte order */
if (H5Tget_size(type)>1)
{
order = H5Tget_order(type);
if (H5T_ORDER_LE==order) {
order_s = " little-endian";
} else if (H5T_ORDER_BE==order) {
order_s = " big-endian";
} else if (H5T_ORDER_VAX==order) {
order_s = " mixed-endian";
} else {
order_s = " unknown-byte-order";
}
} else {
order_s = "";
}
/* sign */
if ((sign=H5Tget_sign(type))>=0)
{
if (H5T_SGN_NONE==sign) {
sign_s = " unsigned";
} else if (H5T_SGN_2==sign) {
sign_s = "";
} else {
sign_s = " unknown-sign";
}
} else {
sign_s = " unknown-sign";
}
/* print size, order, and sign */
printf("%lu-bit%s%s integer",
(unsigned long)(8*H5Tget_size(type)), order_s, sign_s);
}
break;
case H5T_FLOAT:
if (H5Tequal(type, H5T_IEEE_F32BE)) {
if (H5Tequal(type, H5T_IEEE_F32BE)==TRUE) {
printf("H5T_IEEE_F32BE");
} else if (H5Tequal(type, H5T_IEEE_F32LE)) {
} else if (H5Tequal(type, H5T_IEEE_F32LE)==TRUE) {
printf("H5T_IEEE_F32LE");
} else if (H5Tequal(type, H5T_IEEE_F64BE)) {
} else if (H5Tequal(type, H5T_IEEE_F64BE)==TRUE) {
printf("H5T_IEEE_F64BE");
} else if (H5Tequal(type, H5T_IEEE_F64LE)) {
} else if (H5Tequal(type, H5T_IEEE_F64LE)==TRUE) {
printf("H5T_IEEE_F64LE");
} else if (H5Tequal(type, H5T_VAX_F32)) {
} else if (H5Tequal(type, H5T_VAX_F32)==TRUE) {
printf("H5T_VAX_F32");
} else if (H5Tequal(type, H5T_VAX_F64)) {
} else if (H5Tequal(type, H5T_VAX_F64)==TRUE) {
printf("H5T_VAX_F64");
} else if (H5Tequal(type, H5T_NATIVE_FLOAT)) {
} else if (H5Tequal(type, H5T_NATIVE_FLOAT)==TRUE) {
printf("H5T_NATIVE_FLOAT");
} else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
} else if (H5Tequal(type, H5T_NATIVE_DOUBLE)==TRUE) {
printf("H5T_NATIVE_DOUBLE");
#if H5_SIZEOF_LONG_DOUBLE !=0
} else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) {
} else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)==TRUE) {
printf("H5T_NATIVE_LDOUBLE");
#endif
} else {
printf("undefined float");
d_status = EXIT_FAILURE;
/* byte order */
if (H5Tget_size(type)>1)
{
order = H5Tget_order(type);
if (H5T_ORDER_LE==order) {
order_s = " little-endian";
} else if (H5T_ORDER_BE==order) {
order_s = " big-endian";
} else if (H5T_ORDER_VAX==order) {
order_s = " mixed-endian";
} else {
order_s = " unknown-byte-order";
}
} else {
order_s = "";
}
/* print size and byte order */
printf("%lu-bit%s floating-point",
(unsigned long)(8*H5Tget_size(type)), order_s);
}
break;
@ -891,21 +948,21 @@ done:
break;
case H5T_BITFIELD:
if (H5Tequal(type, H5T_STD_B8BE)) {
if (H5Tequal(type, H5T_STD_B8BE)==TRUE) {
printf("H5T_STD_B8BE");
} else if (H5Tequal(type, H5T_STD_B8LE)) {
} else if (H5Tequal(type, H5T_STD_B8LE)==TRUE) {
printf("H5T_STD_B8LE");
} else if (H5Tequal(type, H5T_STD_B16BE)) {
} else if (H5Tequal(type, H5T_STD_B16BE)==TRUE) {
printf("H5T_STD_B16BE");
} else if (H5Tequal(type, H5T_STD_B16LE)) {
} else if (H5Tequal(type, H5T_STD_B16LE)==TRUE) {
printf("H5T_STD_B16LE");
} else if (H5Tequal(type, H5T_STD_B32BE)) {
} else if (H5Tequal(type, H5T_STD_B32BE)==TRUE) {
printf("H5T_STD_B32BE");
} else if (H5Tequal(type, H5T_STD_B32LE)) {
} else if (H5Tequal(type, H5T_STD_B32LE)==TRUE) {
printf("H5T_STD_B32LE");
} else if (H5Tequal(type, H5T_STD_B64BE)) {
} else if (H5Tequal(type, H5T_STD_B64BE)==TRUE) {
printf("H5T_STD_B64BE");
} else if (H5Tequal(type, H5T_STD_B64LE)) {
} else if (H5Tequal(type, H5T_STD_B64LE)==TRUE) {
printf("H5T_STD_B64LE");
} else {
printf("undefined bitfield");

View File

@ -78,6 +78,8 @@
#define FILE49 "tstr3.h5"
#define FILE50 "taindices.h5"
#define FILE51 "tlonglinks.h5"
#define FILE52 "tldouble.h5"
@ -5415,6 +5417,59 @@ static void gent_longlinks(void)
}
/*-------------------------------------------------------------------------
* Function: gent_ldouble
*
* Purpose: make file with a long double dataset
*
*-------------------------------------------------------------------------
*/
static int gent_ldouble(void)
{
hid_t fid;
hid_t did;
hid_t tid;
hid_t sid;
size_t size;
hsize_t dims[1] = {3};
long double buf[3] = {1,2,3};
if ((fid = H5Fcreate(FILE52, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0)
goto error;
if ((sid = H5Screate_simple(1, dims, NULL))<0)
goto error;
if ((tid = H5Tcopy(H5T_NATIVE_LDOUBLE))<0)
goto error;
if ((size = H5Tget_size(tid))<0)
goto error;
if ((did = H5Dcreate(fid, "dset", tid, sid, H5P_DEFAULT))<0)
goto error;
if (H5Dwrite(did,tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
goto error;
if (H5Sclose(sid)<0)
goto error;
if (H5Tclose(tid)<0)
goto error;
if (H5Dclose(did)<0)
goto error;
if (H5Fclose(fid)<0)
goto error;
return 0;
error:
printf("error !\n");
return -1;
}
/*-------------------------------------------------------------------------
* Function: main
*
@ -5474,6 +5529,7 @@ int main(void)
gent_string();
gent_aindices();
gent_longlinks();
gent_ldouble();
return 0;
}

View File

@ -314,6 +314,11 @@ TOOLTEST tnullspace.ddl tnullspace.h5
# test for displaying objects with very long names
TOOLTEST tlonglinks.ddl tlonglinks.h5
# test for long double (some systems do not have long double)
#TOOLTEST tldouble.ddl tldouble.h5
# test for vms
TOOLTEST tvms.ddl tvms.h5
if test $nerrors -eq 0 ; then
echo "All $DUMPER tests passed."

View File

@ -294,97 +294,97 @@ display_string(FILE *stream, const char *s, hbool_t escape_spaces)
static hbool_t
display_native_type(hid_t type, int UNUSED ind)
{
if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
if (H5Tequal(type, H5T_NATIVE_SCHAR)==TRUE) {
printf("native signed char");
} else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
} else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) {
printf("native unsigned char");
} else if (H5Tequal(type, H5T_NATIVE_INT)) {
} else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) {
printf("native int");
} else if (H5Tequal(type, H5T_NATIVE_UINT)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT)==TRUE) {
printf("native unsigned int");
} else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
} else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) {
printf("native short");
} else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
} else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) {
printf("native unsigned short");
} else if (H5Tequal(type, H5T_NATIVE_LONG)) {
} else if (H5Tequal(type, H5T_NATIVE_LONG)==TRUE) {
printf("native long");
} else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
} else if (H5Tequal(type, H5T_NATIVE_ULONG)==TRUE) {
printf("native unsigned long");
} else if (H5Tequal(type, H5T_NATIVE_LLONG)) {
} else if (H5Tequal(type, H5T_NATIVE_LLONG)==TRUE) {
printf("native long long");
} else if (H5Tequal(type, H5T_NATIVE_ULLONG)) {
} else if (H5Tequal(type, H5T_NATIVE_ULLONG)==TRUE) {
printf("native unsigned long long");
} else if (H5Tequal(type, H5T_NATIVE_FLOAT)) {
} else if (H5Tequal(type, H5T_NATIVE_FLOAT)==TRUE) {
printf("native float");
} else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
} else if (H5Tequal(type, H5T_NATIVE_DOUBLE)==TRUE) {
printf("native double");
#if H5_SIZEOF_LONG_DOUBLE !=0
} else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) {
} else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)==TRUE) {
printf("native long double");
#endif
} else if (H5Tequal(type, H5T_NATIVE_INT8)) {
} else if (H5Tequal(type, H5T_NATIVE_INT8)==TRUE) {
printf("native int8_t");
} else if (H5Tequal(type, H5T_NATIVE_UINT8)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT8)==TRUE) {
printf("native uint8_t");
} else if (H5Tequal(type, H5T_NATIVE_INT16)) {
} else if (H5Tequal(type, H5T_NATIVE_INT16)==TRUE) {
printf("native int16_t");
} else if (H5Tequal(type, H5T_NATIVE_UINT16)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT16)==TRUE) {
printf("native uint16_t");
} else if (H5Tequal(type, H5T_NATIVE_INT32)) {
} else if (H5Tequal(type, H5T_NATIVE_INT32)==TRUE) {
printf("native int32_t");
} else if (H5Tequal(type, H5T_NATIVE_UINT32)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT32)==TRUE) {
printf("native uint32_t");
} else if (H5Tequal(type, H5T_NATIVE_INT64)) {
} else if (H5Tequal(type, H5T_NATIVE_INT64)==TRUE) {
printf("native int64_t");
} else if (H5Tequal(type, H5T_NATIVE_UINT64)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT64)==TRUE) {
printf("native uint64_t");
} else if (H5Tequal(type, H5T_NATIVE_INT_LEAST8)) {
} else if (H5Tequal(type, H5T_NATIVE_INT_LEAST8)==TRUE) {
printf("native int_least8_t");
} else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST8)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST8)==TRUE) {
printf("native uint_least8_t");
} else if (H5Tequal(type, H5T_NATIVE_INT_LEAST16)) {
} else if (H5Tequal(type, H5T_NATIVE_INT_LEAST16)==TRUE) {
printf("native int_least16_t");
} else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST16)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST16)==TRUE) {
printf("native uint_least16_t");
} else if (H5Tequal(type, H5T_NATIVE_INT_LEAST32)) {
} else if (H5Tequal(type, H5T_NATIVE_INT_LEAST32)==TRUE) {
printf("native int_least32_t");
} else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST32)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST32)==TRUE) {
printf("native uint_least32_t");
} else if (H5Tequal(type, H5T_NATIVE_INT_LEAST64)) {
} else if (H5Tequal(type, H5T_NATIVE_INT_LEAST64)==TRUE) {
printf("native int_least64_t");
} else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST64)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST64)==TRUE) {
printf("native uint_least64_t");
} else if (H5Tequal(type, H5T_NATIVE_INT_FAST8)) {
} else if (H5Tequal(type, H5T_NATIVE_INT_FAST8)==TRUE) {
printf("native int_fast8_t");
} else if (H5Tequal(type, H5T_NATIVE_UINT_FAST8)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT_FAST8)==TRUE) {
printf("native uint_fast8_t");
} else if (H5Tequal(type, H5T_NATIVE_INT_FAST16)) {
} else if (H5Tequal(type, H5T_NATIVE_INT_FAST16)==TRUE) {
printf("native int_fast16_t");
} else if (H5Tequal(type, H5T_NATIVE_UINT_FAST16)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT_FAST16)==TRUE) {
printf("native uint_fast16_t");
} else if (H5Tequal(type, H5T_NATIVE_INT_FAST32)) {
} else if (H5Tequal(type, H5T_NATIVE_INT_FAST32)==TRUE) {
printf("native int_fast32_t");
} else if (H5Tequal(type, H5T_NATIVE_UINT_FAST32)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT_FAST32)==TRUE) {
printf("native uint_fast32_t");
} else if (H5Tequal(type, H5T_NATIVE_INT_FAST64)) {
} else if (H5Tequal(type, H5T_NATIVE_INT_FAST64)==TRUE) {
printf("native int_fast64_t");
} else if (H5Tequal(type, H5T_NATIVE_UINT_FAST64)) {
} else if (H5Tequal(type, H5T_NATIVE_UINT_FAST64)==TRUE) {
printf("native uint_fast64_t");
} else if (H5Tequal(type, H5T_NATIVE_B8)) {
} else if (H5Tequal(type, H5T_NATIVE_B8)==TRUE) {
printf("native 8-bit field");
} else if (H5Tequal(type, H5T_NATIVE_B16)) {
} else if (H5Tequal(type, H5T_NATIVE_B16)==TRUE) {
printf("native 16-bit field");
} else if (H5Tequal(type, H5T_NATIVE_B32)) {
} else if (H5Tequal(type, H5T_NATIVE_B32)==TRUE) {
printf("native 32-bit field");
} else if (H5Tequal(type, H5T_NATIVE_B64)) {
} else if (H5Tequal(type, H5T_NATIVE_B64)==TRUE) {
printf("native 64-bit field");
} else if (H5Tequal(type, H5T_NATIVE_HSIZE)) {
} else if (H5Tequal(type, H5T_NATIVE_HSIZE)==TRUE) {
printf("native hsize_t");
} else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) {
} else if (H5Tequal(type, H5T_NATIVE_HSSIZE)==TRUE) {
printf("native hssize_t");
} else if (H5Tequal(type, H5T_NATIVE_HERR)) {
} else if (H5Tequal(type, H5T_NATIVE_HERR)==TRUE) {
printf("native herr_t");
} else if (H5Tequal(type, H5T_NATIVE_HBOOL)) {
} else if (H5Tequal(type, H5T_NATIVE_HBOOL)==TRUE) {
printf("native hbool_t");
} else {
return FALSE;
@ -412,13 +412,13 @@ display_native_type(hid_t type, int UNUSED ind)
static hbool_t
display_ieee_type(hid_t type, int UNUSED ind)
{
if (H5Tequal(type, H5T_IEEE_F32BE)) {
if (H5Tequal(type, H5T_IEEE_F32BE)==TRUE) {
printf("IEEE 32-bit big-endian float");
} else if (H5Tequal(type, H5T_IEEE_F32LE)) {
} else if (H5Tequal(type, H5T_IEEE_F32LE)==TRUE) {
printf("IEEE 32-bit little-endian float");
} else if (H5Tequal(type, H5T_IEEE_F64BE)) {
} else if (H5Tequal(type, H5T_IEEE_F64BE)==TRUE) {
printf("IEEE 64-bit big-endian float");
} else if (H5Tequal(type, H5T_IEEE_F64LE)) {
} else if (H5Tequal(type, H5T_IEEE_F64LE)==TRUE) {
printf("IEEE 64-bit little-endian float");
} else {
return FALSE;

View File

@ -552,15 +552,18 @@ h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, unsigned cha
* Added support for printing raw data. If info->raw is non-zero
* then data is printed in hexadecimal format.
*
* Robb Matzke, 2003-01-10
* Binary output format is dd:dd:... instead of 0xdddd... so it
* doesn't look like a hexadecimal integer, and thus users will
* be less likely to complain that HDF5 didn't properly byte
* swap their data during type conversion.
* Robb Matzke, 2003-01-10
* Binary output format is dd:dd:... instead of 0xdddd... so it
* doesn't look like a hexadecimal integer, and thus users will
* be less likely to complain that HDF5 didn't properly byte
* swap their data during type conversion.
*
* Robb Matzke, LLNL, 2003-06-05
* If TYPE is a variable length string then the pointer to
* the value to pring (VP) is a pointer to a `char*'.
* Robb Matzke, LLNL, 2003-06-05
* If TYPE is a variable length string then the pointer to
* the value to pring (VP) is a pointer to a `char*'.
*
* pvn, 28 March 2006
* added H5T_NATIVE_LDOUBLE case
*-------------------------------------------------------------------------
*/
char *
@ -592,6 +595,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
int tempint;
unsigned short tempushort;
short tempshort;
#if H5_SIZEOF_LONG_DOUBLE !=0
long double templdouble;
#endif
/* Build default formats for long long types */
if (!fmt_llong[0]) {
@ -617,9 +623,14 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
memcpy(&tempfloat, vp, sizeof(float));
h5tools_str_append(str, OPT(info->fmt_float, "%g"), tempfloat);
} else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
memcpy(&tempdouble, vp, sizeof(double));
h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble);
} else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) ||
memcpy(&tempdouble, vp, sizeof(double));
h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble);
#if H5_SIZEOF_LONG_DOUBLE !=0
} else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) {
memcpy(&templdouble, vp, sizeof(long double));
h5tools_str_append(str, "%Lf", templdouble);
#endif
} else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) ||
H5Tequal(type, H5T_NATIVE_UCHAR))) {
h5tools_print_char(str, info, (unsigned char)(*ucp_vp));
} else if (H5T_STRING == H5Tget_class(type)) {

BIN
tools/testfiles/tldouble.h5 Normal file

Binary file not shown.

View File

@ -3,7 +3,7 @@ Expected output for 'h5dump -H -p -d nbit tfilters.h5'
#############################
HDF5 "tfilters.h5" {
DATASET "nbit" {
DATATYPE undefined integer
DATATYPE 32-bit little-endian integer
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
STORAGE_LAYOUT {
CHUNKED ( 10, 5 )

18
tools/testfiles/tvms.ddl Normal file
View File

@ -0,0 +1,18 @@
#############################
Expected output for 'h5dump tvms.h5'
#############################
HDF5 "tvms.h5" {
GROUP "/" {
DATASET "IntArray" {
DATATYPE H5T_VAX_F64
DATASPACE SIMPLE { ( 5, 6 ) / ( 5, 6 ) }
DATA {
(0,0): 0, 1, 2, 3, 4, 5,
(1,0): 1, 2, 3, 4, 5, 6,
(2,0): 2, 3, 4, 5, 6, 7,
(3,0): 3, 4, 5, 6, 7, 8,
(4,0): 4, 5, 6, 7, 8, 9
}
}
}
}

BIN
tools/testfiles/tvms.h5 Normal file

Binary file not shown.