summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/h5diff/h5diff.c122
-rw-r--r--tools/h5dump/h5dump.c4
-rw-r--r--tools/h5dump/h5dumpgentest.c201
-rwxr-xr-xtools/h5dump/testh5dump.sh2
-rwxr-xr-xtools/h5dump/testh5dumpxml.sh1
-rw-r--r--tools/h5ls/h5ls.c2
-rw-r--r--tools/lib/h5tools.c217
-rw-r--r--tools/lib/h5tools.h1
-rw-r--r--tools/lib/talign.c4
-rw-r--r--tools/testfiles/tcomp-4.ddl109
-rw-r--r--tools/testfiles/tcompound_complex.h5bin0 -> 8192 bytes
-rw-r--r--tools/testfiles/tcompound_complex.h5.xml130
12 files changed, 452 insertions, 341 deletions
diff --git a/tools/h5diff/h5diff.c b/tools/h5diff/h5diff.c
index 35eb0d1..c80653e 100644
--- a/tools/h5diff/h5diff.c
+++ b/tools/h5diff/h5diff.c
@@ -79,7 +79,6 @@ static int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_
#ifdef NOT_YET
static void list( const char *filename, int nobjects, info_t *info );
#endif /* NOT_YET */
-static hid_t fixtype( hid_t f_type );
static int h5diff_can_diff( hid_t type_id );
static void print_datatype(hid_t type);
static int check_n_input( const char* );
@@ -1083,8 +1082,8 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
*-------------------------------------------------------------------------
*/
- m_type1 = fixtype( f_type1 );
- m_type2 = fixtype( f_type2 );
+ m_type1 = H5Tget_native_type( f_type1 , H5T_DIR_DEFAULT);
+ m_type2 = H5Tget_native_type( f_type2 , H5T_DIR_DEFAULT);
m_size1 = H5Tget_size( m_type1 );
m_size2 = H5Tget_size( m_type2 );
@@ -1136,13 +1135,13 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
if ( m_size1 < m_size2 )
{
assert( (H5Tclose(m_type1)) >=0);
- m_type1 = fixtype( f_type2 );
+ m_type1 = H5Tget_native_type( f_type2 , H5T_DIR_DEFAULT);
m_size1 = H5Tget_size( m_type1 );
}
else
{
assert( (H5Tclose(m_type2)) >=0);
- m_type2 = fixtype( f_type1 );
+ m_type2 = H5Tget_native_type( f_type1 , H5T_DIR_DEFAULT);
m_size2 = H5Tget_size( m_type2 );
}
#if defined (H5DIFF_DEBUG)
@@ -2294,119 +2293,6 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
-
-
-/*-------------------------------------------------------------------------
- * Function: fixtype
- *
- * Purpose: Given a file data type choose a memory data type which is
- * appropriate
- *
- * Return: Memory data type
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
- * Comments: Adapted from h5tools_fixtype
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static
-hid_t fixtype(hid_t f_type)
-{
- hid_t m_type = -1;
- size_t size;
-
- size = H5Tget_size(f_type);
-
- switch (H5Tget_class(f_type))
- {
- default:
- return -1;
- case H5T_INTEGER:
-/*
- * Use the smallest native integer type of the same sign as the file
- * such that the memory type is at least as large as the file type.
- * If there is no memory type large enough then use the largest
- * memory type available.
- */
- if (size <= sizeof(char))
- {
- m_type = H5Tcopy(H5T_NATIVE_SCHAR);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_SCHAR\n");
- #endif
- }
- else if (size <= sizeof(short))
- {
- m_type = H5Tcopy(H5T_NATIVE_SHORT);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_SHORT\n");
- #endif
- }
- else if (size <= sizeof(int))
- {
- m_type = H5Tcopy(H5T_NATIVE_INT);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_INT\n");
- #endif
- }
- else if (size <= sizeof(long))
- {
- m_type = H5Tcopy(H5T_NATIVE_LONG);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_LONG\n");
- #endif
- }
- else
- {
- m_type = H5Tcopy(H5T_NATIVE_LLONG);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_LLONG\n");
- #endif
- }
-
- H5Tset_sign(m_type, H5Tget_sign(f_type));
- break;
-
- case H5T_FLOAT:
-/*
- * Use the smallest native floating point type available such that
- * its size is at least as large as the file type. If there is not
- * native type large enough then use the largest native type.
- */
- if (size <= sizeof(float))
- {
- m_type = H5Tcopy(H5T_NATIVE_FLOAT);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_FLOAT\n");
- #endif
- }
- else if (size <= sizeof(double))
- {
- m_type = H5Tcopy(H5T_NATIVE_DOUBLE);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_DOUBLE\n");
- #endif
- }
- else
- {
- m_type = H5Tcopy(H5T_NATIVE_LDOUBLE);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_LDOUBLE\n");
- #endif
- }
- break;
-
- }
-
- return m_type;
-}
-
-
/*-------------------------------------------------------------------------
* Function: h5diff_can_diff
*
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 4fe0092..c0841cc 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -1915,7 +1915,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset)
} else {
/* need to call h5tools_dump_mem for the attribute data */
type = H5Aget_type(obj_id);
- p_type = h5tools_fixtype(type);
+ p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT);
space = H5Aget_space(obj_id);
ndims = H5Sget_simple_extent_dims(space, size, NULL);
@@ -4187,7 +4187,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset)
status = xml_print_strs(obj_id, ATTRIBUTE_DATA);
} else {
/* all other data */
- p_type = h5tools_fixtype(type);
+ p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT);
H5Tclose(type);
space = H5Aget_space(obj_id);
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index b2715a1..b2edb8d 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -66,6 +66,7 @@
#define FILE38 "tvlstr.h5"
#define FILE39 "tchar.h5"
#define FILE40 "tattr2.h5"
+#define FILE41 "tcompound_complex.h5"
/* prototypes */
@@ -123,6 +124,20 @@ typedef struct s1_t {
/* VL string datatype name */
#define VLSTR_TYPE "vl_string_type"
+/* "File 41" macros */
+/* Name of dataset to create in datafile */
+#define F41_DATASETNAME "CompoundComplex"
+/* Dataset dimensions */
+#define F41_LENGTH 6
+#define F41_RANK 1
+#define F41_ARRAY_RANK 1
+#define F41_ARRAY_RANKd 2
+#define F41_DIMb 4
+#define F41_ARRAY_DIMc 6
+#define F41_ARRAY_DIMd1 5
+#define F41_ARRAY_DIMd2 6
+#define F41_ARRAY_DIMf 10
+
static void gent_group(void)
{
hid_t fid, group;
@@ -3852,8 +3867,8 @@ static void write_dset_in(hid_t loc_id,
static void gent_attr_all(void)
{
- hid_t file_id;
- hid_t dset_id;
+ hid_t file_id;
+ hid_t dset_id;
hid_t group_id;
hid_t group2_id;
hid_t root_id;
@@ -3984,6 +3999,186 @@ int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
}
+static void gent_compound_complex(void)
+{
+ /* Structure and array for compound types */
+ typedef struct Array1Struct {
+ int a;
+ const char *b[F41_DIMb];
+ char c[F41_ARRAY_DIMc];
+ short d[F41_ARRAY_DIMd1][F41_ARRAY_DIMd2];
+ float e;
+ double f[F41_ARRAY_DIMf];
+ char g;
+ } Array1Struct;
+ Array1Struct Array1[F41_LENGTH];
+
+ /* Define the value of the string array */
+ const char *quote [F41_DIMb] = {
+ "A fight is a contract that takes two people to honor.",
+ "A combative stance means that you've accepted the contract.",
+ "In which case, you deserve what you get.",
+ " -- Professor Cheng Man-ch'ing"
+ };
+
+ /* Define the value of the character array */
+ char chararray [F41_ARRAY_DIMc] = {'H', 'e', 'l', 'l', 'o', '!'};
+
+
+ hid_t Array1Structid; /* File datatype identifier */
+ hid_t array_tid; /* Array datatype handle */
+ hid_t array1_tid; /* Array datatype handle */
+ hid_t array2_tid; /* Array datatype handle */
+ hid_t array4_tid; /* Array datatype handle */
+ hid_t datafile, dataset; /* Datafile/dataset handles */
+ hid_t dataspace; /* Dataspace handle */
+ herr_t status; /* Error checking variable */
+ hsize_t dim[] = {F41_LENGTH}; /* Dataspace dimensions */
+ hsize_t array_dimb[] = {F41_DIMb}; /* Array dimensions */
+ hsize_t array_dimd[]={F41_ARRAY_DIMd1,F41_ARRAY_DIMd2}; /* Array dimensions */
+ hsize_t array_dimf[]={F41_ARRAY_DIMf}; /* Array dimensions */
+ hid_t str_array_id;
+
+ int m, n, o; /* Array init loop vars */
+
+ /* Initialize the data in the arrays/datastructure */
+ for (m = 0; m< F41_LENGTH; m++) {
+ Array1[m].a = m;
+
+ for (n = 0; n < F41_DIMb; n++) {
+ Array1[m].b[n] = quote[n];
+ }
+
+ for (n = 0; n < F41_ARRAY_DIMc; n++) {
+ Array1[m].c[n] = chararray[n];
+ }
+
+ for (n = 0; n < F41_ARRAY_DIMd1; n++) {
+ for (o = 0; o < F41_ARRAY_DIMd2; o++){
+ Array1[m].d[n][o] = m + n + o;
+ }
+ }
+
+ Array1[m].e = ( m * .96 );
+
+ for (n = 0; n < F41_ARRAY_DIMf; n++) {
+ Array1[m].f[n] = ( m * 1024.9637 );
+ }
+
+ Array1[m].g = 'm';
+ }
+
+ /* Create the dataspace */
+ dataspace = H5Screate_simple(F41_RANK, dim, NULL);
+ assert (dataspace >= 0);
+
+ /* Create the file */
+ datafile = H5Fcreate(FILE41, H5F_ACC_TRUNC, H5P_DEFAULT,
+ H5P_DEFAULT);
+ assert (datafile >= 0);
+
+ /* Copy the array data type for the string array */
+ array_tid = H5Tcopy (H5T_C_S1);
+ assert (array_tid >= 0);
+
+ /* Set the string array size to Variable */
+ status = H5Tset_size (array_tid,H5T_VARIABLE);
+ assert (status >= 0);
+
+ /* Create the array data type for the string array */
+ str_array_id = H5Tarray_create(array_tid, F41_ARRAY_RANK,
+ array_dimb, NULL);
+ assert (str_array_id >= 0);
+
+ /* Copy the array data type for the character array */
+ array1_tid = H5Tcopy (H5T_C_S1);
+ assert (array1_tid >= 0);
+
+ /* Set the character array size */
+ status = H5Tset_size (array1_tid, F41_ARRAY_DIMc);
+ assert (status >= 0);
+
+ /* Create the array data type for the character array */
+ array2_tid = H5Tarray_create(H5T_NATIVE_SHORT, F41_ARRAY_RANKd,
+ array_dimd, NULL);
+ assert (array2_tid >= 0);
+
+ /* Create the array data type for the character array */
+ array4_tid = H5Tarray_create(H5T_NATIVE_DOUBLE, F41_ARRAY_RANK,
+ array_dimf, NULL);
+ assert (array4_tid >= 0);
+
+ /* Create the memory data type */
+ Array1Structid = H5Tcreate (H5T_COMPOUND, sizeof(Array1Struct));
+ assert (Array1Structid >= 0);
+
+ /* Insert the arrays and variables into the structure */
+ status = H5Tinsert(Array1Structid, "a_name",
+ HOFFSET(Array1Struct, a), H5T_NATIVE_INT);
+ assert (status >= 0);
+
+ status = H5Tinsert(Array1Structid, "b_name",
+ HOFFSET(Array1Struct, b), str_array_id);
+ assert (status >= 0);
+
+ status = H5Tinsert(Array1Structid, "c_name",
+ HOFFSET(Array1Struct, c), array1_tid);
+ assert (status >= 0);
+
+ status = H5Tinsert(Array1Structid, "d_name",
+ HOFFSET(Array1Struct, d), array2_tid);
+ assert (status >= 0);
+
+ status = H5Tinsert(Array1Structid, "e_name",
+ HOFFSET(Array1Struct, e), H5T_NATIVE_FLOAT);
+ assert (status >= 0);
+
+ status = H5Tinsert(Array1Structid, "f_name",
+ HOFFSET(Array1Struct, f), array4_tid);
+ assert (status >= 0);
+
+ status = H5Tinsert(Array1Structid, "g_name",
+ HOFFSET(Array1Struct, g), H5T_NATIVE_CHAR);
+ assert (status >= 0);
+
+ /* Create the dataset */
+ dataset = H5Dcreate(datafile, F41_DATASETNAME, Array1Structid,
+ dataspace, H5P_DEFAULT);
+
+ /* Write data to the dataset */
+ status = H5Dwrite(dataset, Array1Structid, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, Array1);
+ assert (status >= 0);
+
+ /* Release resources */
+ status = H5Tclose(Array1Structid);
+ assert (status >= 0);
+
+ status = H5Tclose(array_tid);
+ assert (status >= 0);
+
+ status = H5Tclose(array1_tid);
+ assert (status >= 0);
+
+ status = H5Tclose(array2_tid);
+ assert (status >= 0);
+
+ status = H5Tclose(array4_tid);
+ assert (status >= 0);
+
+ status = H5Tclose(str_array_id);
+ assert (status >= 0);
+
+ status = H5Sclose(dataspace);
+ assert (status >= 0);
+
+ status = H5Dclose(dataset);
+ assert (status >= 0);
+
+ status = H5Fclose(datafile);
+ assert (status >= 0);
+}
+
/*-------------------------------------------------------------------------
* Function: main
@@ -4047,5 +4242,7 @@ int main(void)
gent_attr_all();
+ gent_compound_complex();
+
return 0;
}
diff --git a/tools/h5dump/testh5dump.sh b/tools/h5dump/testh5dump.sh
index 6855cba..d1dfe0c 100755
--- a/tools/h5dump/testh5dump.sh
+++ b/tools/h5dump/testh5dump.sh
@@ -119,6 +119,8 @@ TOOLTEST tcomp-1.ddl tcompound.h5
TOOLTEST tcomp-2.ddl -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5
# test for unamed type
TOOLTEST tcomp-3.ddl -t /#6632 -g /group2 tcompound.h5
+# test complicated compound datatype
+TOOLTEST tcomp-4.ddl tcompound_complex.h5
#test for the nested compound type
TOOLTEST tnestcomp-1.ddl tnestedcomp.h5
diff --git a/tools/h5dump/testh5dumpxml.sh b/tools/h5dump/testh5dumpxml.sh
index 9c7ef67..bd10949 100755
--- a/tools/h5dump/testh5dumpxml.sh
+++ b/tools/h5dump/testh5dumpxml.sh
@@ -100,6 +100,7 @@ TOOLTEST tloop.h5.xml --xml tloop.h5
TOOLTEST tloop2.h5.xml --xml tloop2.h5
TOOLTEST tmany.h5.xml --xml tmany.h5
TOOLTEST tnestedcomp.h5.xml --xml tnestedcomp.h5
+TOOLTEST tcompound_complex.h5.xml --xml tcompound_complex.h5
TOOLTEST tobjref.h5.xml --xml tobjref.h5
TOOLTEST topaque.h5.xml --xml topaque.h5
TOOLTEST tslink.h5.xml --xml tslink.h5
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 25ef80b..0cb64fe 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1377,7 +1377,7 @@ list_attr (hid_t obj, const char *attr_name, void UNUSED *op_data)
if (hexdump_g) {
p_type = H5Tcopy(type);
} else {
- p_type = h5tools_fixtype(type);
+ p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT);
}
if (p_type>=0) {
temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 58a663b..d2be237 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -485,7 +485,7 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) {
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_sprint(&buffer, info, container, type, mem + i * size, ctx);
+ h5tools_str_sprint(&buffer, info, container, type, mem + i * size, ctx);
if (i + 1 < nelmts || (flags & END_OF_DATA) == 0)
h5tools_str_append(&buffer, "%s", OPT(info->elmt_suf1, ","));
@@ -1012,219 +1012,6 @@ h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id,
}
/*-------------------------------------------------------------------------
- * Function: h5tools_fixtype
- *
- * Purpose: Given a file data type choose a memory data type which is
- * appropriate for printing the data.
- *
- * Return: Success: Memory data type
- *
- * Failure: FAIL
- *
- * Programmer: Robb Matzke
- * Thursday, July 23, 1998
- *
- * Modifications:
- * Robb Matzke, 1999-06-04
- * Added support for references.
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-h5tools_fixtype(hid_t f_type)
-{
- hid_t m_type = FAIL, f_memb;
- hid_t *memb = NULL;
- char **name = NULL;
- int nmembs = 0, i;
- int ndims;
- hsize_t dim[H5S_MAX_RANK];
- size_t size, offset;
- hid_t array_base;
- /* H5T_str_t strpad; */
-
- size = H5Tget_size(f_type);
-
- switch (H5Tget_class(f_type)) {
- case H5T_INTEGER:
- /*
- * Use the smallest native integer type of the same sign as the file
- * such that the memory type is at least as large as the file type.
- * If there is no memory type large enough then use the largest
- * memory type available.
- */
- if (size <= sizeof(char)) {
- m_type = H5Tcopy(H5T_NATIVE_SCHAR);
- } else if (size <= sizeof(short)) {
- m_type = H5Tcopy(H5T_NATIVE_SHORT);
- } else if (size <= sizeof(int)) {
- m_type = H5Tcopy(H5T_NATIVE_INT);
- } else if (size <= sizeof(long)) {
- m_type = H5Tcopy(H5T_NATIVE_LONG);
- } else {
- m_type = H5Tcopy(H5T_NATIVE_LLONG);
- }
-
- H5Tset_sign(m_type, H5Tget_sign(f_type));
- break;
-
- case H5T_FLOAT:
- /*
- * Use the smallest native floating point type available such that
- * its size is at least as large as the file type. If there is not
- * native type large enough then use the largest native type.
- */
- if (size <= sizeof(float)) {
- m_type = H5Tcopy(H5T_NATIVE_FLOAT);
- } else if (size <= sizeof(double)) {
- m_type = H5Tcopy(H5T_NATIVE_DOUBLE);
- } else {
- m_type = H5Tcopy(H5T_NATIVE_LDOUBLE);
- }
-
- break;
-
- case H5T_STRING:
- /*
- * This is needed because the function in dumputil.c is the case where
- * strDUAction == TRUE. if it is false we will do the original action
- * here.
- */
- if(H5Tis_variable_str(f_type)) {
- m_type = H5Tcopy(H5T_C_S1);
- H5Tset_size(m_type, H5T_VARIABLE);
- } else {
- m_type = H5Tcopy(f_type);
- H5Tset_cset(m_type, H5T_CSET_ASCII);
- }
- break;
-
- case H5T_COMPOUND:
- /*
- * We have to do this in two steps. The first step scans the file
- * type and converts the members to native types and remembers all
- * their names and sizes, computing the size of the memory compound
- * type at the same time. Then we create the memory compound type
- * and add the members.
- */
- nmembs = H5Tget_nmembers(f_type);
- assert(nmembs > 0);
- memb = calloc((size_t)nmembs, sizeof(hid_t));
- name = calloc((size_t)nmembs, sizeof(char *));
-
- for (i = 0, size = 0; i < nmembs; i++) {
- /* Get the member type and fix it */
- f_memb = H5Tget_member_type(f_type, i);
- memb[i] = h5tools_fixtype(f_memb);
- H5Tclose(f_memb);
-
- if (memb[i] < 0)
- goto done;
-
- /* Get the member name */
- name[i] = H5Tget_member_name(f_type, i);
-
- if (name[i] == NULL)
- goto done;
-
- /*
- * Compute the new offset so each member is aligned on a byte
- * boundary which is the same as the member size.
- */
- size = ALIGN(size, H5Tget_size(memb[i])) + H5Tget_size(memb[i]);
- }
-
- m_type = H5Tcreate(H5T_COMPOUND, size);
-
- for (i = 0, offset = 0; i < nmembs; i++) {
- if (offset)
- offset = ALIGN(offset, H5Tget_size(memb[i]));
-
- H5Tinsert(m_type, name[i], offset, memb[i]);
- offset += H5Tget_size(memb[i]);
- }
-
- break;
-
- case H5T_ARRAY:
- /* Get the array information */
- ndims = H5Tget_array_ndims(f_type);
- H5Tget_array_dims(f_type, dim, NULL);
-
- /* Get the array's base type and convert it to the printable version */
- f_memb = H5Tget_super(f_type);
- array_base = h5tools_fixtype(f_memb);
-
- /* Copy the array */
- m_type = H5Tarray_create(array_base, ndims, dim, NULL);
-
- /* Close the temporary datatypes */
- H5Tclose(array_base);
- H5Tclose(f_memb);
- break;
-
- case H5T_VLEN:
- /* Get the VL sequence's base type and convert it to the printable version */
- f_memb = H5Tget_super(f_type);
- array_base = h5tools_fixtype(f_memb);
-
- /* Copy the VL type */
- m_type = H5Tvlen_create(array_base);
-
- /* Close the temporary datatypes */
- H5Tclose(array_base);
- H5Tclose(f_memb);
- break;
-
- case H5T_ENUM:
- case H5T_REFERENCE:
- case H5T_OPAQUE:
- /* Same as file type */
- m_type = H5Tcopy(f_type);
- break;
-
- case H5T_BITFIELD:
- /*
- * Same as the file except the offset is set to zero and the byte
- * order is set to little endian.
- */
- m_type = H5Tcopy(f_type);
- H5Tset_offset(m_type, 0);
- H5Tset_order(m_type, H5T_ORDER_LE);
- break;
-
- case H5T_TIME:
- /*
- * These type classes are not implemented yet.
- */
- break;
-
- default:
- /* What the heck? */
- break;
- }
-
- done:
- /* Clean up temp buffers */
- if (memb && name) {
- register int j;
-
- for (j = 0; j < nmembs; j++) {
- if (memb[j] >= 0)
- H5Tclose(memb[j]);
-
- if (name[j])
- free(name[j]);
- }
-
- free(memb);
- free(name);
- }
-
- return m_type;
-}
-
-/*-------------------------------------------------------------------------
* Function: h5tools_dump_dset
*
* Purpose: Print some values from a dataset DSET to the file STREAM
@@ -1281,7 +1068,7 @@ h5tools_dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t _p_type,
if (info->raw)
p_type = H5Tcopy(f_type);
else
- p_type = h5tools_fixtype(f_type);
+ p_type = H5Tget_native_type(f_type,H5T_DIR_DEFAULT);
H5Tclose(f_type);
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 40b4055..96e2bd1 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -477,7 +477,6 @@ extern void h5tools_init(void);
extern void h5tools_close(void);
extern hid_t h5tools_fopen(const char *fname, const char *driver,
char *drivername, size_t drivername_len);
-extern hid_t h5tools_fixtype(hid_t f_type);
extern int h5tools_dump_dset(FILE *stream, const h5dump_t *info, hid_t dset,
hid_t p_typ, struct subset_t *sset, int indentlevel);
extern int h5tools_dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id,
diff --git a/tools/lib/talign.c b/tools/lib/talign.c
index 5c4f88d..e24cabf 100644
--- a/tools/lib/talign.c
+++ b/tools/lib/talign.c
@@ -1,6 +1,6 @@
/*
* Small program to illustrate the "misalignment" of members within a compound
- * datatype, in a datatype fixed by h5tools_fixtype().
+ * datatype, in a datatype fixed by H5Tget_native_type().
*/
#include <string.h>
#include <stdlib.h>
@@ -72,7 +72,7 @@ int main(void)
H5Tinsert(cmp, "Not Ok", sizeof(fok) + sizeof(string5), array_dt);
H5Tclose(array_dt);
- fix = h5tools_fixtype(cmp);
+ fix = H5Tget_native_type(cmp,H5T_DIR_DEFAULT);
cmp1 = H5Tcreate(H5T_COMPOUND, sizeof(fok));
diff --git a/tools/testfiles/tcomp-4.ddl b/tools/testfiles/tcomp-4.ddl
new file mode 100644
index 0000000..3860087
--- /dev/null
+++ b/tools/testfiles/tcomp-4.ddl
@@ -0,0 +1,109 @@
+#############################
+Expected output for 'h5dump tcompound_complex.h5'
+#############################
+HDF5 "tcompound_complex.h5" {
+GROUP "/" {
+ DATASET "CompoundComplex" {
+ DATATYPE H5T_COMPOUND {
+ H5T_STD_I32BE "a_name";
+ H5T_ARRAY { [4] H5T_STRING {
+ STRSIZE H5T_VARIABLE;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } } "b_name";
+ H5T_STRING {
+ STRSIZE 6;
+ STRPAD H5T_STR_NULLTERM;
+ CSET H5T_CSET_ASCII;
+ CTYPE H5T_C_S1;
+ } "c_name";
+ H5T_ARRAY { [5][6] H5T_STD_I16BE } "d_name";
+ H5T_IEEE_F32BE "e_name";
+ H5T_ARRAY { [10] H5T_IEEE_F64BE } "f_name";
+ H5T_STD_I8LE "g_name";
+ }
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ DATA {
+ {
+ 0,
+ [ "A fight is a contract that takes two people to honor.", "A combative stance means that you've accepted the contract.", "In which case, you deserve what you get.", " -- Professor Cheng Man-ch'ing" ],
+ "Hello!",
+ [ 0, 1, 2, 3, 4, 5,
+ 1, 2, 3, 4, 5, 6,
+ 2, 3, 4, 5, 6, 7,
+ 3, 4, 5, 6, 7, 8,
+ 4, 5, 6, 7, 8, 9 ],
+ 0,
+ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
+ 109
+ },
+ {
+ 1,
+ [ "A fight is a contract that takes two people to honor.", "A combative stance means that you've accepted the contract.", "In which case, you deserve what you get.", " -- Professor Cheng Man-ch'ing" ],
+ "Hello!",
+ [ 1, 2, 3, 4, 5, 6,
+ 2, 3, 4, 5, 6, 7,
+ 3, 4, 5, 6, 7, 8,
+ 4, 5, 6, 7, 8, 9,
+ 5, 6, 7, 8, 9, 10 ],
+ 0.96,
+ [ 1024.96, 1024.96, 1024.96, 1024.96, 1024.96, 1024.96, 1024.96, 1024.96, 1024.96, 1024.96 ],
+ 109
+ },
+ {
+ 2,
+ [ "A fight is a contract that takes two people to honor.", "A combative stance means that you've accepted the contract.", "In which case, you deserve what you get.", " -- Professor Cheng Man-ch'ing" ],
+ "Hello!",
+ [ 2, 3, 4, 5, 6, 7,
+ 3, 4, 5, 6, 7, 8,
+ 4, 5, 6, 7, 8, 9,
+ 5, 6, 7, 8, 9, 10,
+ 6, 7, 8, 9, 10, 11 ],
+ 1.92,
+ [ 2049.93, 2049.93, 2049.93, 2049.93, 2049.93, 2049.93, 2049.93, 2049.93, 2049.93, 2049.93 ],
+ 109
+ },
+ {
+ 3,
+ [ "A fight is a contract that takes two people to honor.", "A combative stance means that you've accepted the contract.", "In which case, you deserve what you get.", " -- Professor Cheng Man-ch'ing" ],
+ "Hello!",
+ [ 3, 4, 5, 6, 7, 8,
+ 4, 5, 6, 7, 8, 9,
+ 5, 6, 7, 8, 9, 10,
+ 6, 7, 8, 9, 10, 11,
+ 7, 8, 9, 10, 11, 12 ],
+ 2.88,
+ [ 3074.89, 3074.89, 3074.89, 3074.89, 3074.89, 3074.89, 3074.89, 3074.89, 3074.89, 3074.89 ],
+ 109
+ },
+ {
+ 4,
+ [ "A fight is a contract that takes two people to honor.", "A combative stance means that you've accepted the contract.", "In which case, you deserve what you get.", " -- Professor Cheng Man-ch'ing" ],
+ "Hello!",
+ [ 4, 5, 6, 7, 8, 9,
+ 5, 6, 7, 8, 9, 10,
+ 6, 7, 8, 9, 10, 11,
+ 7, 8, 9, 10, 11, 12,
+ 8, 9, 10, 11, 12, 13 ],
+ 3.84,
+ [ 4099.85, 4099.85, 4099.85, 4099.85, 4099.85, 4099.85, 4099.85, 4099.85, 4099.85, 4099.85 ],
+ 109
+ },
+ {
+ 5,
+ [ "A fight is a contract that takes two people to honor.", "A combative stance means that you've accepted the contract.", "In which case, you deserve what you get.", " -- Professor Cheng Man-ch'ing" ],
+ "Hello!",
+ [ 5, 6, 7, 8, 9, 10,
+ 6, 7, 8, 9, 10, 11,
+ 7, 8, 9, 10, 11, 12,
+ 8, 9, 10, 11, 12, 13,
+ 9, 10, 11, 12, 13, 14 ],
+ 4.8,
+ [ 5124.82, 5124.82, 5124.82, 5124.82, 5124.82, 5124.82, 5124.82, 5124.82, 5124.82, 5124.82 ],
+ 109
+ }
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tcompound_complex.h5 b/tools/testfiles/tcompound_complex.h5
new file mode 100644
index 0000000..5eed316
--- /dev/null
+++ b/tools/testfiles/tcompound_complex.h5
Binary files differ
diff --git a/tools/testfiles/tcompound_complex.h5.xml b/tools/testfiles/tcompound_complex.h5.xml
new file mode 100644
index 0000000..9dd41c3
--- /dev/null
+++ b/tools/testfiles/tcompound_complex.h5.xml
@@ -0,0 +1,130 @@
+#############################
+Expected output for 'h5dump --xml tcompound_complex.h5'
+#############################
+<?xml version="1.0" encoding="UTF-8"?>
+<hdf5:HDF5-File xmlns:hdf5="http://hdf.ncsa.uiuc.edu/DTDs/HDF5-File" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hdf.ncsa.uiuc.edu/DTDs/HDF5File http://hdf.ncsa.uiuc.edu/DTDs/HDF5-File.xsd">
+<hdf5:RootGroup OBJ-XID="xid_928" H5Path="/">
+ <hdf5:Dataset Name="CompoundComplex" OBJ-XID="xid_976" H5Path= "/CompoundComplex" Parents="xid_928" H5ParentPaths="/">
+ <hdf5:StorageLayout>
+ <hdf5:ContiguousLayout/>
+ </hdf5:StorageLayout>
+ <hdf5:FillValueInfo FillTime="FillOnAlloc" AllocationTime="Late">
+ <hdf5:FillValue>
+ <hdf5:Data>
+ <!-- Compound fill not yet implemented. -->
+ <hdf5:NoData />
+ </hdf5:Data>
+ </hdf5:FillValue>
+ </hdf5:FillValueInfo>
+ <hdf5:Dataspace>
+ <hdf5:SimpleDataspace Ndims="1">
+ <hdf5:Dimension DimSize="6" MaxDimSize="6"/>
+ </hdf5:SimpleDataspace>
+ </hdf5:Dataspace>
+ <hdf5:DataType>
+ <hdf5:CompoundType>
+ <hdf5:Field FieldName="a_name">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="4" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="b_name">
+ <hdf5:DataType>
+ <hdf5:ArrayType Ndims="1">
+ <hdf5:ArrayDimension DimSize="4" DimPerm="0"/>
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="H5T_VARIABLE" StrPad="H5T_STR_NULLTERM"/>
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:ArrayType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="c_name">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:StringType Cset="H5T_CSET_ASCII" StrSize="6" StrPad="H5T_STR_NULLTERM"/>
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="d_name">
+ <hdf5:DataType>
+ <hdf5:ArrayType Ndims="2">
+ <hdf5:ArrayDimension DimSize="5" DimPerm="0"/>
+ <hdf5:ArrayDimension DimSize="6" DimPerm="1"/>
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="BE" Sign="true" Size="2" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:ArrayType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="e_name">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="BE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="f_name">
+ <hdf5:DataType>
+ <hdf5:ArrayType Ndims="1">
+ <hdf5:ArrayDimension DimSize="10" DimPerm="0"/>
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:FloatType ByteOrder="BE" Size="8" SignBitLocation="63" ExponentBits="11" ExponentLocation="52" MantissaBits="52" MantissaLocation="0" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:ArrayType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ <hdf5:Field FieldName="g_name">
+ <hdf5:DataType>
+ <hdf5:AtomicType>
+ <hdf5:IntegerType ByteOrder="LE" Sign="true" Size="1" />
+ </hdf5:AtomicType>
+ </hdf5:DataType>
+ </hdf5:Field>
+ </hdf5:CompoundType>
+ </hdf5:DataType>
+ <!-- Note: format of compound data not specified -->
+ <hdf5:Data>
+ <hdf5:DataFromFile>
+ 0 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 0 1 2 3 4 5
+ 1 2 3 4 5 6
+ 2 3 4 5 6 7
+ 3 4 5 6 7 8
+ 4 5 6 7 8 9 0 0 0 0 0 0 0 0 0 0 0 109
+ 1 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 1 2 3 4 5 6
+ 2 3 4 5 6 7
+ 3 4 5 6 7 8
+ 4 5 6 7 8 9
+ 5 6 7 8 9 10 0.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 109
+ 2 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 2 3 4 5 6 7
+ 3 4 5 6 7 8
+ 4 5 6 7 8 9
+ 5 6 7 8 9 10
+ 6 7 8 9 10 11 1.92 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 109
+ 3 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 3 4 5 6 7 8
+ 4 5 6 7 8 9
+ 5 6 7 8 9 10
+ 6 7 8 9 10 11
+ 7 8 9 10 11 12 2.88 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 109
+ 4 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 4 5 6 7 8 9
+ 5 6 7 8 9 10
+ 6 7 8 9 10 11
+ 7 8 9 10 11 12
+ 8 9 10 11 12 13 3.84 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 109
+ 5 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 5 6 7 8 9 10
+ 6 7 8 9 10 11
+ 7 8 9 10 11 12
+ 8 9 10 11 12 13
+ 9 10 11 12 13 14 4.8 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 109
+ </hdf5:DataFromFile>
+ </hdf5:Data>
+ </hdf5:Dataset>
+</hdf5:RootGroup>
+</hdf5:HDF5-File>