summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools_str.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2006-03-28 21:25:10 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2006-03-28 21:25:10 (GMT)
commitcd25a7690abbd3665996dc7657b13101ba032c79 (patch)
treef6f9e860bb7e86d7d496875f87af9fff58f667aa /tools/lib/h5tools_str.c
parent194d3dfe522c2b6612586829d47e830ad5c7ef0c (diff)
downloadhdf5-cd25a7690abbd3665996dc7657b13101ba032c79.zip
hdf5-cd25a7690abbd3665996dc7657b13101ba032c79.tar.gz
hdf5-cd25a7690abbd3665996dc7657b13101ba032c79.tar.bz2
[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:
Diffstat (limited to 'tools/lib/h5tools_str.c')
-rw-r--r--tools/lib/h5tools_str.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 73ca045..2286b4e 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -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, 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, 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*'.
+ *
+ * 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)) {