summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-05-10 15:59:13 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-05-10 15:59:13 (GMT)
commit445c805a4cd1222703e0294afa3af9631c7d6c99 (patch)
treefd23d7bd1bc9fa2ed6390483e7d4c926e92582b5 /tools/lib
parent9d50ed52875549dad6e5253111c0356aca3c2c05 (diff)
downloadhdf5-445c805a4cd1222703e0294afa3af9631c7d6c99.zip
hdf5-445c805a4cd1222703e0294afa3af9631c7d6c99.tar.gz
hdf5-445c805a4cd1222703e0294afa3af9631c7d6c99.tar.bz2
HDFFV-10186 Add endianess to bitfield and fix tests
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff_attr.c4
-rw-r--r--tools/lib/h5diff_dset.c4
-rw-r--r--tools/lib/h5diff_util.c27
-rw-r--r--tools/lib/h5tools.c2
-rw-r--r--tools/lib/h5tools.h1
-rw-r--r--tools/lib/h5tools_dump.c8
-rw-r--r--tools/lib/h5tools_str.c6
-rw-r--r--tools/lib/h5tools_type.c24
8 files changed, 58 insertions, 18 deletions
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 5642a9b..004672e 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -395,9 +395,9 @@ hsize_t diff_attr(hid_t loc1_id,
continue;
}
- if((mtype1_id = h5tools_get_native_type(ftype1_id)) < 0)
+ if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0)
goto error;
- if((mtype2_id = h5tools_get_native_type(ftype2_id)) < 0)
+ if((mtype2_id = H5Tget_native_type(ftype2_id, H5T_DIR_DEFAULT)) < 0)
goto error;
if((msize1 = H5Tget_size(mtype1_id)) == 0)
goto error;
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index d8eadda..9f70299 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -329,10 +329,10 @@ hsize_t diff_datasetid( hid_t did1,
*-------------------------------------------------------------------------
*/
h5difftrace("check for memory type and sizes\n");
- if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0)
+ if ((m_tid1=H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0)
goto error;
- if ((m_tid2=h5tools_get_native_type(f_tid2)) < 0)
+ if ((m_tid2=H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0)
goto error;
m_size1 = H5Tget_size( m_tid1 );
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 1032d1b..6a512ac 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -156,9 +156,30 @@ void print_type(hid_t type)
}
break;
+ case H5T_BITFIELD:
+ if (H5Tequal(type, H5T_STD_B8BE)) {
+ parallel_print("H5T_STD_B8BE");
+ } else if (H5Tequal(type, H5T_STD_B8LE)) {
+ parallel_print("H5T_STD_B8LE");
+ } else if (H5Tequal(type, H5T_STD_B16BE)) {
+ parallel_print("H5T_STD_B16BE");
+ } else if (H5Tequal(type, H5T_STD_B16LE)) {
+ parallel_print("H5T_STD_B16LE");
+ } else if (H5Tequal(type, H5T_STD_B32BE)) {
+ parallel_print("H5T_STD_B32BE");
+ } else if (H5Tequal(type, H5T_STD_B32LE)) {
+ parallel_print("H5T_STD_B32LE");
+ } else if (H5Tequal(type, H5T_STD_B64BE)) {
+ parallel_print("H5T_STD_B64BE");
+ } else if (H5Tequal(type, H5T_STD_B64LE)) {
+ parallel_print("H5T_STD_B64LE");
+ } else {
+ parallel_print("undefined bitfield");
+ }
+ break;
+
case H5T_TIME:
case H5T_STRING:
- case H5T_BITFIELD:
case H5T_OPAQUE:
case H5T_COMPOUND:
case H5T_REFERENCE:
@@ -367,7 +388,7 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
{
H5Tclose( *m_tid1 );
- if(( (*m_tid1) = h5tools_get_native_type(f_tid2_id)) < 0)
+ if(( (*m_tid1) = H5Tget_native_type(f_tid2_id, H5T_DIR_DEFAULT)) < 0)
{
ret = FAIL;
goto out;
@@ -378,7 +399,7 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
else {
H5Tclose(*m_tid2);
- if(( (*m_tid2) = h5tools_get_native_type(f_tid1_id)) < 0)
+ if(( (*m_tid2) = H5Tget_native_type(f_tid1_id, H5T_DIR_DEFAULT)) < 0)
{
ret = FAIL;
goto out;
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 2cc02e8..a74fdd2 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -1322,6 +1322,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
case H5T_INTEGER:
case H5T_FLOAT:
case H5T_ENUM:
+ case H5T_BITFIELD:
block_index = block_nelmts * size;
while(block_index > 0) {
size_t bytes_in = 0; /* # of bytes to write */
@@ -1488,7 +1489,6 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
break;
case H5T_TIME:
- case H5T_BITFIELD:
case H5T_OPAQUE:
for (block_index = 0; block_index < block_nelmts; block_index++) {
mem = ((unsigned char*)_mem) + block_index * size;
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 2bafdfc..c5e750a 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -586,7 +586,6 @@ H5TOOLS_DLL int h5tools_set_output_file(const char *fname, int is_bin);
H5TOOLS_DLL int h5tools_set_error_file(const char *fname, int is_bin);
H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl,
const char *driver, char *drivername, size_t drivername_len);
-H5TOOLS_DLL hid_t h5tools_get_native_type(hid_t type);
H5TOOLS_DLL hid_t h5tools_get_little_endian_type(hid_t type);
H5TOOLS_DLL hid_t h5tools_get_big_endian_type(hid_t type);
H5TOOLS_DLL htri_t h5tools_detect_vlen(hid_t tid);
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 381a253..1a57512 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -1795,7 +1795,7 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
else if (bin_form == 3)
p_type = h5tools_get_big_endian_type(f_type);
else
- p_type = h5tools_get_native_type(f_type);
+ p_type = H5Tget_native_type(f_type, H5T_DIR_DEFAULT);
if (p_type < 0)
goto done;
@@ -2957,7 +2957,7 @@ h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t
hid_t n_type;
void *buf = NULL;
- n_type = h5tools_get_native_type(type_id);
+ n_type = H5Tget_native_type(type_id, H5T_DIR_DEFAULT);
size = H5Tget_size(n_type);
buf = HDmalloc(size);
@@ -3785,7 +3785,7 @@ void
h5tools_print_packed_bits(h5tools_str_t *buffer, hid_t type)
{
unsigned packed_bits_size = 0;
- hid_t n_type = h5tools_get_native_type(type);
+ hid_t n_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
if(H5Tget_class(n_type) == H5T_INTEGER) {
if(H5Tequal(n_type, H5T_NATIVE_SCHAR) == TRUE)
@@ -4043,7 +4043,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info,
unsigned int vl_data = 0; /* contains VL datatypes */
type = H5Aget_type(obj_id);
- p_type = h5tools_get_native_type(type);
+ p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
ndims = H5Sget_simple_extent_dims(space, size, NULL);
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index b7a2c1e..7396e8c 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -746,7 +746,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
size_t i;
if(1 == nsize)
- h5tools_str_append(str, OPT(info->fmt_raw, "0x%02x"), ucp_vp[0]);
+ h5tools_str_append(str, OPT(info->fmt_raw, "%#02x"), ucp_vp[0]);
else
for(i = 0; i < nsize; i++) {
if(i)
@@ -1100,7 +1100,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
else {
size_t i;
if(1 == nsize)
- h5tools_str_append(str, "0x%02x", ucp_vp[0]);
+ h5tools_str_append(str, "%#02x", ucp_vp[0]);
else
for(i = 0; i < nsize; i++)
h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]);
@@ -1283,7 +1283,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
/* All other types get printed as hexadecimal */
size_t i;
if(1 == nsize)
- h5tools_str_append(str, "0x%02x", ucp_vp[0]);
+ h5tools_str_append(str, "%#02x", ucp_vp[0]);
else
for(i = 0; i < nsize; i++)
h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]);
diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c
index 8c5592f..b57e274 100644
--- a/tools/lib/h5tools_type.c
+++ b/tools/lib/h5tools_type.c
@@ -100,8 +100,18 @@ h5tools_get_little_endian_type(hid_t tid)
p_type=H5Tcopy(H5T_IEEE_F64LE);
break;
- case H5T_TIME:
case H5T_BITFIELD:
+ if ( size == 1)
+ p_type=H5Tcopy(H5T_STD_B8LE);
+ else if ( size == 2)
+ p_type=H5Tcopy(H5T_STD_B16LE);
+ else if ( size == 4)
+ p_type=H5Tcopy(H5T_STD_B32LE);
+ else if ( size == 8)
+ p_type=H5Tcopy(H5T_STD_B64LE);
+ break;
+
+ case H5T_TIME:
case H5T_OPAQUE:
case H5T_STRING:
case H5T_COMPOUND:
@@ -177,8 +187,18 @@ h5tools_get_big_endian_type(hid_t tid)
p_type=H5Tcopy(H5T_IEEE_F64BE);
break;
- case H5T_TIME:
case H5T_BITFIELD:
+ if ( size == 1)
+ p_type=H5Tcopy(H5T_STD_B8BE);
+ else if ( size == 2)
+ p_type=H5Tcopy(H5T_STD_B16BE);
+ else if ( size == 4)
+ p_type=H5Tcopy(H5T_STD_B32BE);
+ else if ( size == 8)
+ p_type=H5Tcopy(H5T_STD_B64BE);
+ break;
+
+ case H5T_TIME:
case H5T_OPAQUE:
case H5T_STRING:
case H5T_COMPOUND: