summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-04-29 18:38:41 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-04-29 18:38:41 (GMT)
commit87994982f9a061f8a8c5584dcafbde7b3b33b790 (patch)
tree511d65dcf60397c626db8283490dc0a2855bfd60 /tools/lib
parent170e7e53a515be431a33c4e191b0be7c74e14ae5 (diff)
downloadhdf5-87994982f9a061f8a8c5584dcafbde7b3b33b790.zip
hdf5-87994982f9a061f8a8c5584dcafbde7b3b33b790.tar.gz
hdf5-87994982f9a061f8a8c5584dcafbde7b3b33b790.tar.bz2
[svn-r20677] Merge packed bits option from 1.8 branch to trunk. CMake only. Autotools merge to come.
Tested: local Linux
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5tools.c5
-rw-r--r--tools/lib/h5tools.h6
-rw-r--r--tools/lib/h5tools_str.c58
3 files changed, 67 insertions, 2 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 3e72bdd..a712794 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -42,6 +42,11 @@ FILE *rawdatastream; /* should initialize to stdout but gcc moans about it
int bin_output; /* binary output */
int bin_form; /* binary form */
int region_output; /* region output */
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+int packed_bits_num; /* number of packed bits to display */
+int packed_data_offset; /* offset of packed bits to display */
+unsigned long long packed_data_mask; /* mask in which packed bits to display */
+#endif
static h5tool_format_t h5tools_dataformat = {
0, /*raw */
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 89e07fa..448a20c 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -530,6 +530,12 @@ struct subset_t {
extern "C" {
#endif
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+H5TOOLS_DLLVAR int packed_bits_num; /* number of packed bits to display */
+H5TOOLS_DLLVAR int packed_data_offset; /* offset of packed bits to display */
+H5TOOLS_DLLVAR unsigned long long packed_data_mask; /* mask in which packed bits to display */
+#endif
+
H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */
H5TOOLS_DLLVAR int bin_output; /* binary output */
H5TOOLS_DLLVAR int bin_form; /* binary form */
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index c1c6d72..7630e9a 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -795,44 +795,98 @@ 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_bits_num) {
+ tempint = (tempint >> packed_data_offset) & packed_data_mask;
+ }
+#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_bits_num) {
+ tempuint = (tempuint >> packed_data_offset) & packed_data_mask;
+ }
+#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, "%hhd"), *cp_vp);
+ char tempchar;
+ HDmemcpy(&tempchar, cp_vp, sizeof(char));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_bits_num) {
+ tempchar = (tempchar >> packed_data_offset) & packed_data_mask;
+ }
+#endif
+ h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), 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_bits_num) {
+ tempuchar = (tempuchar >> packed_data_offset) & packed_data_mask;
+ }
+#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_bits_num) {
+ tempshort = (tempshort >> packed_data_offset) & packed_data_mask;
+ }
+#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_bits_num) {
+ tempushort = (tempushort >> packed_data_offset) & packed_data_mask;
+ }
+#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_bits_num) {
+ templong = (templong >> packed_data_offset) & packed_data_mask;
+ }
+#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_bits_num) {
+ tempulong = (tempulong >> packed_data_offset) & packed_data_mask;
+ }
+#endif
h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong);
}
else if (H5Tequal(type, H5T_NATIVE_LLONG)) {
HDmemcpy(&templlong, vp, sizeof(long long));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_bits_num) {
+ templlong = (templlong >> packed_data_offset) & packed_data_mask;
+ }
+#endif
h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong);
}
else if (H5Tequal(type, H5T_NATIVE_ULLONG)) {
HDmemcpy(&tempullong, vp, sizeof(unsigned long long));
+#ifdef H5_HAVE_H5DUMP_PACKED_BITS
+ if(packed_bits_num) {
+ tempullong = (tempullong >> packed_data_offset) & packed_data_mask;
+ }
+#endif
h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong);
}
else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) {