summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools_str.c
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2010-05-07 20:56:54 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2010-05-07 20:56:54 (GMT)
commit7c16aec7e1e7ba08b8845cf148fdc7935e84a211 (patch)
treed9583f35d601ce5dc9736f8b90424930a65dd57a /tools/lib/h5tools_str.c
parentae6f5891b5794325ee5702fec0da55bafdce1afe (diff)
downloadhdf5-7c16aec7e1e7ba08b8845cf148fdc7935e84a211.zip
hdf5-7c16aec7e1e7ba08b8845cf148fdc7935e84a211.tar.gz
hdf5-7c16aec7e1e7ba08b8845cf148fdc7935e84a211.tar.bz2
[svn-r18743] enhancement 1853:
Install packed-bits feature for h5dump. Allen has installed the feature in the NPOESS feature branch. I ported it back to the v1.8 branch for v1.8.5 release. tools/h5dump/testh5dump.sh.in: Added tests for the packed-bits feature. tools/h5dump/h5dump.c tools/h5dump/h5dump.h Added code to parse and handled the packed-bits request. tools/lib/h5tools.h tools/lib/h5tools_str.c tools/lib/h5tools.c Added code to print packed-bits. tools/testfiles/tpackedbits2.ddl tools/testfiles/tnofilename-with-packed-bits.ddl tools/testfiles/tpackedbits.ddl Expected output files for packed-bits feature. Tested: h5committested the NPOESS branch. Tested in the linux VM machine in my Dove.
Diffstat (limited to 'tools/lib/h5tools_str.c')
-rw-r--r--tools/lib/h5tools_str.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 55596cd..c7fb8a9 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -783,36 +783,72 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
else if (H5Tequal(type, H5T_NATIVE_INT)) {
HDmemcpy(&tempint, vp, sizeof(int));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempint = (tempint & packed_counter)>>packed_normalize;
+#endif
h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint);
}
else if (H5Tequal(type, H5T_NATIVE_UINT)) {
HDmemcpy(&tempuint, vp, sizeof(unsigned int));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempuint = (tempuint & packed_counter)>>packed_normalize;
+#endif
h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint);
}
else if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
- h5tools_str_append(str, OPT(info->fmt_schar, "%d"), *cp_vp);
+ char tempchar;
+ HDmemcpy(&tempchar, cp_vp, sizeof(char));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempchar = (tempchar & packed_counter)>>packed_normalize;
+#endif
+ h5tools_str_append(str, OPT(info->fmt_schar, "%d"), tempchar);
}
else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
- h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), *ucp_vp);
+ unsigned char tempuchar;
+ HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempuchar = (tempuchar & packed_counter)>>packed_normalize;
+#endif
+ h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), tempuchar);
}
else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
short tempshort;
HDmemcpy(&tempshort, vp, sizeof(short));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempshort = (tempshort & packed_counter)>>packed_normalize;
+#endif
h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort);
}
else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
unsigned short tempushort;
HDmemcpy(&tempushort, vp, sizeof(unsigned short));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempushort = (tempushort & packed_counter)>>packed_normalize;
+#endif
h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort);
}
else if (H5Tequal(type, H5T_NATIVE_LONG)) {
HDmemcpy(&templong, vp, sizeof(long));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ templong = (templong & packed_counter)>>packed_normalize;
+#endif
h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong);
}
else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
HDmemcpy(&tempulong, vp, sizeof(unsigned long));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_output)
+ tempulong = (tempulong & packed_counter)>>packed_normalize;
+#endif
h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong);
}
else if (H5Tequal(type, H5T_NATIVE_LLONG)) {