diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2012-07-11 15:15:21 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2012-07-11 15:15:21 (GMT) |
commit | 5096b7d3ec1047e234049f351b111ef62deb6030 (patch) | |
tree | 354c7efc0093d470b56ba77675e020dfa84ba338 /tools | |
parent | 91de89d57e82581f3ca5ed4fdea9f0f7cd94d339 (diff) | |
download | hdf5-5096b7d3ec1047e234049f351b111ef62deb6030.zip hdf5-5096b7d3ec1047e234049f351b111ef62deb6030.tar.gz hdf5-5096b7d3ec1047e234049f351b111ef62deb6030.tar.bz2 |
[svn-r22551] Merge changes from Trunk revision 22550 for:
HDFFV-4206, -7953, -5930, -2687, -5942
Tested: local linux with cmake
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5dump/CMakeLists.txt | 21 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 3 | ||||
-rw-r--r-- | tools/h5dump/h5dump_ddl.c | 2 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 4340 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 11 | ||||
-rw-r--r-- | tools/h5import/CMakeLists.txt | 76 | ||||
-rw-r--r-- | tools/h5import/h5importtest.c | 32 | ||||
-rwxr-xr-x | tools/h5import/h5importtestutil.sh | 18 | ||||
-rw-r--r-- | tools/h5ls/testh5ls.sh.in | 3 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 16 | ||||
-rw-r--r-- | tools/lib/h5trav.h | 2 | ||||
-rw-r--r-- | tools/testfiles/tnestedcmpddt.ddl | 220 | ||||
-rw-r--r-- | tools/testfiles/tnestedcmpddt.h5 | bin | 0 -> 16536 bytes | |||
-rw-r--r-- | tools/testfiles/tordercontents1.ddl | 20 | ||||
-rw-r--r-- | tools/testfiles/tordercontents2.ddl | 20 | ||||
-rw-r--r-- | tools/testfiles/twidedisplay.ddl | 130 |
16 files changed, 2756 insertions, 2158 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index 9fd35d5..8882497 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -131,10 +131,11 @@ IF (BUILD_TESTING) tloop-1.ddl tmulti.ddl tmultifile.ddl -# tqmarkfile.ddl -# tstarfile.ddl + #tqmarkfile.ddl + #tstarfile.ddl tnamed_dtype_attr.ddl tnestcomp-1.ddl + tnestedcmpddt.ddl tnbit.ddl tno-subset.ddl tnullspace.ddl @@ -148,6 +149,8 @@ IF (BUILD_TESTING) torderattr2.ddl torderattr3.ddl torderattr4.ddl + tordercontents1.ddl + tordercontents2.ddl tperror.ddl treference.ddl tsaf.ddl @@ -173,6 +176,7 @@ IF (BUILD_TESTING) tvldtypes5.ddl tvlstr.ddl tvms.ddl + twidedisplay.ddl h5dump-help.txt out3.h5import ) @@ -308,6 +312,7 @@ IF (BUILD_TESTING) tmulti-s.h5 tnamed_dtype_attr.h5 tnestedcomp.h5 + tnestedcmpddt.h5 tno-subset.h5 tnullspace.h5 zerodim.h5 @@ -856,6 +861,8 @@ IF (BUILD_TESTING) tnamed_dtype_attr.out.err tnestcomp-1.out tnestcomp-1.out.err + tnestedcmpddt.out + tnestedcmpddt.out.err tnbit.out tnbit.out.err tno-subset.out @@ -882,6 +889,10 @@ IF (BUILD_TESTING) torderattr3.out.err torderattr4.out torderattr4.out.err + tordercontents1.out + tordercontents1.out.err + tordercontents2.out + tordercontents2.out.err tperror.out tperror.out.err treference.out @@ -941,6 +952,9 @@ IF (BUILD_TESTING) ADD_HELP_TEST(help 0 -h) + # test for maximum display datasets + ADD_H5_TEST (twidedisplay 0 -w0 --enable-error-stack packedbits.h5) + # test for signed/unsigned datasets ADD_H5_TEST (packedbits 0 --enable-error-stack packedbits.h5) # test for compound signed/unsigned datasets @@ -1000,6 +1014,7 @@ IF (BUILD_TESTING) #test for the nested compound type ADD_H5_TEST (tnestcomp-1 0 --enable-error-stack tnestedcomp.h5) + ADD_H5_TEST (tnestedcmpddt 0 --enable-error-stack tnestedcmpddt.h5) # test for options # JIRA HDFFV-7936 ADD_H5_MASK_TEST (tall-1 0 --enable-error-stack tall.h5) @@ -1091,6 +1106,8 @@ IF (BUILD_TESTING) # test for file contents ADD_H5_TEST (tcontents 0 --enable-error-stack -n tfcontents1.h5) + ADD_H5_TEST (tordercontents1 0 --enable-error-stack -n --sort_by=name --sort_order=ascending tfcontents1.h5) + ADD_H5_TEST (tordercontents2 0 --enable-error-stack -n --sort_by=name --sort_order=descending tfcontents1.h5) # tests for storage layout # compact diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 2799d95..1a70d11 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -1035,6 +1035,9 @@ parse_start: break; case 'w': h5tools_nCols = HDatoi(opt_arg); + if (h5tools_nCols==0) { + h5tools_nCols = 65535; + } last_was_dset = FALSE; break; case 'a': diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index db78118..0f9be1f 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -1280,7 +1280,7 @@ dump_fcontents(hid_t fid) } /* print objects in the files */ - h5trav_print(fid); + h5trav_print(fid, sort_by, sort_order); HDfprintf(rawoutstream, " %s\n",END); } diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index dc8efa7..c12be7a 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -101,6 +101,7 @@ #define FILE69 "tattrintsize.h5" #define FILE70 "tcmpdintsize.h5" #define FILE71 "tcmpdattrintsize.h5" +#define FILE72 "tnestedcmpddt.h5" /*------------------------------------------------------------------------- * prototypes @@ -112,16 +113,16 @@ static int make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t tid, hid_t dcpl, void *buf); static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, - hid_t tid, void *buf); + hid_t tid, void *buf); static int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, - hid_t tid, void *buf ); + hid_t tid, void *buf ); /* a filter operation callback function */ static size_t myfilter(unsigned int UNUSED flags, size_t UNUSED cd_nelmts, - const unsigned int UNUSED *cd_values, size_t nbytes, - size_t UNUSED *buf_size, void UNUSED **buf); + const unsigned int UNUSED *cd_values, size_t nbytes, + size_t UNUSED *buf_size, void UNUSED **buf); /* a "set local" callback */ static herr_t @@ -131,35 +132,35 @@ set_local_myfilter(hid_t dcpl_id, hid_t tid, hid_t UNUSED sid); /* This message derives from H5Z */ const H5Z_class2_t H5Z_MYFILTER[1] = {{ - H5Z_CLASS_T_VERS, - MYFILTER_ID, /* Filter id number */ - 1, 1, - "myfilter", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - set_local_myfilter, /* The "set local" callback */ - myfilter, /* The actual filter function */ + H5Z_CLASS_T_VERS, + MYFILTER_ID, /* Filter id number */ + 1, 1, + "myfilter", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + set_local_myfilter, /* The "set local" callback */ + myfilter, /* The actual filter function */ }}; /* A UD link traversal function. Shouldn't actually be called. */ static hid_t UD_traverse(UNUSED const char * link_name, UNUSED hid_t cur_group, - UNUSED const void * udata, UNUSED size_t udata_size, UNUSED hid_t lapl_id) + UNUSED const void * udata, UNUSED size_t udata_size, UNUSED hid_t lapl_id) { -return -1; + return -1; } #define MY_LINKCLASS 187 const H5L_class_t UD_link_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)MY_LINKCLASS, /* Link type id number */ - "UD link class", /* name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)MY_LINKCLASS, /* Link type id number */ + "UD link class", /* name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; @@ -188,18 +189,18 @@ const H5L_class_t UD_link_class[1] = {{ #define POINT1_NPOINTS 10 typedef enum{ - RED, - GREEN, - BLUE, - WHITE, - BLACK + RED, + GREEN, + BLUE, + WHITE, + BLACK } enumtype; /* Compound datatype */ typedef struct s1_t { - unsigned int a; - unsigned int b; - float c; + unsigned int a; + unsigned int b; + float c; } s1_t; @@ -253,20 +254,20 @@ typedef struct s1_t { #define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1) /* "FILE66" macros and for FILE69 */ -#define F66_XDIM 8 +#define F66_XDIM 8 #define F66_DATASETU08 "DU08BITS" #define F66_DATASETS08 "DS08BITS" -#define F66_YDIM8 8 +#define F66_YDIM8 8 #define F66_DATASETU16 "DU16BITS" #define F66_DATASETS16 "DS16BITS" -#define F66_YDIM16 16 +#define F66_YDIM16 16 #define F66_DATASETU32 "DU32BITS" #define F66_DATASETS32 "DS32BITS" -#define F66_YDIM32 32 +#define F66_YDIM32 32 #define F66_DATASETU64 "DU64BITS" #define F66_DATASETS64 "DS64BITS" #define F66_YDIM64 64 -#define F66_DUMMYDBL "DummyDBL" +#define F66_DUMMYDBL "DummyDBL" /* "FILE70" macros and for FILE71 */ /* Name of dataset to create in datafile */ @@ -354,8 +355,8 @@ gent_dataset(void) dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < 10; i++) - for(j = 0; j < 20; j++) - dset1[i][j] = j + i; + for(j = 0; j < 20; j++) + dset1[i][j] = j + i; H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); H5Sclose(space); @@ -367,8 +368,8 @@ gent_dataset(void) dataset = H5Dcreate2(fid, "/dset2", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < 30; i++) - for(j = 0; j < 20; j++) - dset2[i][j] = 0.0001 * j + i; + for(j = 0; j < 20; j++) + dset2[i][j] = 0.0001 * j + i; H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); @@ -399,8 +400,8 @@ gent_dataset2(void) dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, create_plist, H5P_DEFAULT); for(i = 0; i < 10; i++) - for(j = 0; j < 20; j++) - dset1[i][j] = j; + for(j = 0; j < 20; j++) + dset1[i][j] = j; H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); H5Sclose(space); @@ -413,8 +414,8 @@ gent_dataset2(void) dataset = H5Dcreate2(fid, "/dset2", H5T_IEEE_F64BE, space, H5P_DEFAULT, create_plist, H5P_DEFAULT); for(i = 0; i < 30; i++) - for(j = 0; j < 10; j++) - dset2[i][j] = j; + for(j = 0; j < 10; j++) + dset2[i][j] = j; H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); @@ -527,9 +528,9 @@ static int gent_softlink2(void) int data2[NX][NY] = {{0,0},{0,1},{0,2},{3,3}}; herr_t status = SUCCEED; - /*----------------------------------------------------------------------- - * FILE - *------------------------------------------------------------------------*/ + /*----------------------------------------------------------------------- + * FILE + *------------------------------------------------------------------------*/ /* Create a new file */ fileid1 = H5Fcreate(FILE4_1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fileid1 < 0) @@ -539,9 +540,9 @@ static int gent_softlink2(void) goto out; } - /*----------------------------------------------------------------------- - * Groups - *------------------------------------------------------------------------*/ + /*----------------------------------------------------------------------- + * Groups + *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fileid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { @@ -558,9 +559,9 @@ static int gent_softlink2(void) goto out; } - /*----------------------------------------------------------------------- - * Named datatype - *------------------------------------------------------------------------*/ + /*----------------------------------------------------------------------- + * Named datatype + *------------------------------------------------------------------------*/ datatype = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) @@ -570,9 +571,9 @@ static int gent_softlink2(void) goto out; } - /*----------------------------------------------------------------------- - * Datasets - *------------------------------------------------------------------------*/ + /*----------------------------------------------------------------------- + * Datasets + *------------------------------------------------------------------------*/ /* * Describe the size of the array and create the data space for fixed * size dataset. @@ -590,7 +591,7 @@ static int gent_softlink2(void) */ /* Create a new dataset as sample object */ dset1 = H5Dcreate2(fileid1, "/dset1", H5T_NATIVE_INT, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (dset1 < 0) { fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); @@ -611,7 +612,7 @@ static int gent_softlink2(void) */ /* Create a new dataset as sample object */ dset2 = H5Dcreate2(fileid1, "/dset2", H5T_NATIVE_INT, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (dset2 < 0) { fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1); @@ -627,9 +628,9 @@ static int gent_softlink2(void) goto out; } - /*----------------------------------------------------------------------- - * Soft links - *------------------------------------------------------------------------*/ + /*----------------------------------------------------------------------- + * Soft links + *------------------------------------------------------------------------*/ /* * create various soft links under '/' root */ @@ -726,7 +727,7 @@ static int gent_softlink2(void) goto out; } -out: + out: /* * Close/release resources. */ @@ -773,7 +774,7 @@ out: dset2 g1.1 | dset3 -*/ + */ static void gent_hardlink(void) { @@ -804,7 +805,7 @@ static void gent_hardlink(void) H5Lcreate_hard(group, "/g2", H5L_SAME_LOC, "g1.1", H5P_DEFAULT, H5P_DEFAULT); H5Gclose(group); - /* create a link to the root group */ + /* create a link to the root group */ H5Lcreate_hard(fid, "/", H5L_SAME_LOC, "g3", H5P_DEFAULT, H5P_DEFAULT); H5Fclose(fid); } @@ -845,38 +846,38 @@ static void gent_udlink(void) | dset2 -*/ + */ static void gent_compound_dt(void) { /* test compound data type */ hid_t fid, group, dataset, space, space3, type, type2; hid_t array_dt; typedef struct { - int a; - float b; - double c; + int a; + float b; + double c; } dset1_t; dset1_t dset1[5]; typedef struct { - int a; - float b; + int a; + float b; } dset2_t; dset2_t dset2[5]; typedef struct { - int a[4]; - float b[5][6]; + int a[4]; + float b[5][6]; } dset3_t; dset3_t dset3[3][6]; typedef struct { - int a; - float b; + int a; + float b; } dset4_t; dset4_t dset4[5]; typedef struct { - int a; - float b; + int a; + float b; } dset5_t; dset5_t dset5[5]; @@ -970,13 +971,13 @@ static void gent_compound_dt(void) { /* test compound data type */ space3 = H5Screate_simple(2, dset3_dim, NULL); dataset = H5Dcreate2(group, "dset3", type, space3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < (int)dset3_dim[0]; i++) - for(j = 0; j < (int)dset3_dim[1]; j++) { - for(k = 0; k < 4; k++) - dset3[i][j].a[k] = k + j + i; - for(k = 0; k < 5; k++) - for(l = 0; l < 6; l++) - dset3[i][j].b[k][l] = (float)((k + 1) + l + j + i); - } + for(j = 0; j < (int)dset3_dim[1]; j++) { + for(k = 0; k < 4; k++) + dset3[i][j].a[k] = k + j + i; + for(k = 0; k < 5; k++) + for(l = 0; l < 6; l++) + dset3[i][j].b[k][l] = (float)((k + 1) + l + j + i); + } H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3); H5Sclose(space3); H5Tclose(type); @@ -1031,38 +1032,38 @@ static void gent_compound_dt(void) { /* test compound data type */ | dset2 -*/ + */ static void gent_compound_dt2(void) { /* test compound data type */ hid_t fid, group, dataset, space, type, create_plist, type2; hid_t array_dt; typedef struct { - int a; - float b; - double c; + int a; + float b; + double c; } dset1_t; dset1_t dset1[10]; typedef struct { - int a; - float b; + int a; + float b; } dset2_t; dset2_t dset2[10]; typedef struct { - int a[4]; - float b[5][6]; + int a[4]; + float b[5][6]; } dset3_t; typedef struct { - int a; - float b; + int a; + float b; } dset4_t; dset4_t dset4[10]; typedef struct { - int a; - float b; + int a; + float b; } dset5_t; dset5_t dset5[10]; @@ -1217,7 +1218,7 @@ g1.2 : g1.2.1 extlink g1.2.1 : slink g2 : dset2.1 dset2.2 udlink -*/ + */ static void gent_all(void) { @@ -1359,7 +1360,7 @@ static void gent_all(void) o - group objects -*/ + */ static void gent_loop(void) { hid_t fid, group; @@ -1409,7 +1410,7 @@ static void gent_loop2(void) | | (g1) (dset2) (dset3) (elink) udlink dset1 link1 slink6 (dset1) (udlink) -*/ + */ static void gent_many(void) @@ -1426,9 +1427,9 @@ gent_many(void) hsize_t sdim, maxdim; typedef struct { /* compound type has members with rank > 1 */ - int a[2][2][2][2]; /* arrays are 2x2x2x2 */ - double b[2][2][2][2]; - double c[2][2][2][2]; + int a[2][2][2][2]; /* arrays are 2x2x2x2 */ + double b[2][2][2][2]; + double c[2][2][2][2]; } dset1_t; dset1_t dset1[6]; @@ -1608,13 +1609,13 @@ gent_many(void) } static hid_t mkstr(int size, H5T_str_t pad) { -hid_t type; + hid_t type; - if((type=H5Tcopy(H5T_C_S1)) < 0) return -1; - if(H5Tset_size(type, (size_t)size) < 0) return -1; - if(H5Tset_strpad(type, pad) < 0) return -1; + if((type=H5Tcopy(H5T_C_S1)) < 0) return -1; + if(H5Tset_size(type, (size_t)size) < 0) return -1; + if(H5Tset_strpad(type, pad) < 0) return -1; - return type; + return type; } static void gent_str(void) { @@ -1623,131 +1624,131 @@ static void gent_str(void) { hsize_t dims1[] = { 3, 4}; char string1[12][3] = {"s1","s2","s3","s4","s5","s6","s7","s8","s9", - "s0","s1","s2"}; + "s0","s1","s2"}; hsize_t dims2[]={20}; char string2[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", - "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", - "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2", - "ab cd ef3", "ab cd ef4", "ab cd ef5", "ab cd ef6", - "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"}; + "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", + "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2", + "ab cd ef3", "ab cd ef4", "ab cd ef5", "ab cd ef6", + "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"}; hsize_t dims3[] = { 27}; char string3[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", - "abcd4", "abcd5", "abcd6", "abcd7", - "abcd8", "abcd9", "abcd0", "abcd1", - "abcd2", "abcd3", "abcd4", "abcd5", - "abcd6", "abcd7", "abcd8", "abcd9", - "abcd0", "abcd1", "abcd2", "abcd3", - "abcd4", "abcd5", "abcd6"}; + "abcd4", "abcd5", "abcd6", "abcd7", + "abcd8", "abcd9", "abcd0", "abcd1", + "abcd2", "abcd3", "abcd4", "abcd5", + "abcd6", "abcd7", "abcd8", "abcd9", + "abcd0", "abcd1", "abcd2", "abcd3", + "abcd4", "abcd5", "abcd6"}; int i, j, k, l; hsize_t dims4[] = { 3 }; char string4[3][21] = { "s1234567890123456789", "s1234567890123456789", - "s1234567890123456789"}; + "s1234567890123456789"}; hsize_t dims5[] = { 3, 6}; typedef struct { - int a[8][10]; - char s[12][33]; + int a[8][10]; + char s[12][33]; } compound_t; compound_t comp1[3][6]; hsize_t mdims[2]; - fid = H5Fcreate(FILE13, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - - /* string 1 : nullterm string */ - space = H5Screate_simple(2, dims1, NULL); - f_type = mkstr(5, H5T_STR_NULLTERM); - m_type = mkstr(3, H5T_STR_NULLTERM); - dataset = H5Dcreate2(fid, "/string1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string1); - H5Tclose(m_type); - H5Tclose(f_type); - H5Sclose(space); - H5Dclose(dataset); - - /* string 2 : space pad string */ - space = H5Screate_simple(1, dims2, NULL); - f_type = mkstr(11, H5T_STR_SPACEPAD); - m_type = mkstr(10, H5T_STR_NULLTERM); - dataset = H5Dcreate2(fid, "/string2", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string2); - H5Tclose(m_type); - H5Tclose(f_type); - H5Sclose(space); - H5Dclose(dataset); - - /* string 3 : null pad string */ - space = H5Screate_simple(1, dims3, NULL); - f_type = mkstr(8, H5T_STR_NULLPAD); - m_type = mkstr(6, H5T_STR_NULLTERM); - dataset = H5Dcreate2(fid, "/string3", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string3); - H5Tclose(m_type); - H5Tclose(f_type); - H5Sclose(space); - H5Dclose(dataset); - - /* string 4 : space pad long string */ - space = H5Screate_simple(1, dims4, NULL); - f_type = mkstr(168, H5T_STR_SPACEPAD); - m_type = mkstr(21, H5T_STR_NULLTERM); - dataset = H5Dcreate2(fid, "/string4", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string4); - H5Tclose(m_type); - H5Tclose(f_type); - H5Sclose(space); - H5Dclose(dataset); - - /* compound data */ - space = H5Screate_simple(2, dims5, NULL); - f_type = H5Tcreate (H5T_COMPOUND, sizeof(compound_t)); - f_type2 = H5Tcreate (H5T_COMPOUND, sizeof(compound_t)); - - mdims[0] = 8; mdims[1] = 10; - - array_dt = H5Tarray_create2(H5T_STD_I32BE, 2, mdims); - H5Tinsert(f_type, "int_array", HOFFSET(compound_t, a), array_dt); - H5Tclose(array_dt); - - array_dt = H5Tarray_create2(H5T_NATIVE_INT, 2, mdims); - H5Tinsert(f_type2, "int_array", HOFFSET(compound_t, a), array_dt); - H5Tclose(array_dt); - - mdims[0] = 3; mdims[1] = 4; - - str_type = mkstr(32, H5T_STR_SPACEPAD); - array_dt = H5Tarray_create2(str_type, 2, mdims); - H5Tinsert(f_type, "string", HOFFSET(compound_t, s), array_dt); - H5Tclose(array_dt); - H5Tclose(str_type); - - str_type = mkstr(33, H5T_STR_NULLTERM); - array_dt = H5Tarray_create2(str_type, 2, mdims); - H5Tinsert(f_type2, "string", HOFFSET(compound_t, s), array_dt); - H5Tclose(array_dt); - H5Tclose(str_type); - - for(i = 0; i < 3; i++) - for(j = 0; j < 6; j++) { - for(k = 0 ; k < 8; k++) + fid = H5Fcreate(FILE13, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* string 1 : nullterm string */ + space = H5Screate_simple(2, dims1, NULL); + f_type = mkstr(5, H5T_STR_NULLTERM); + m_type = mkstr(3, H5T_STR_NULLTERM); + dataset = H5Dcreate2(fid, "/string1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string1); + H5Tclose(m_type); + H5Tclose(f_type); + H5Sclose(space); + H5Dclose(dataset); + + /* string 2 : space pad string */ + space = H5Screate_simple(1, dims2, NULL); + f_type = mkstr(11, H5T_STR_SPACEPAD); + m_type = mkstr(10, H5T_STR_NULLTERM); + dataset = H5Dcreate2(fid, "/string2", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string2); + H5Tclose(m_type); + H5Tclose(f_type); + H5Sclose(space); + H5Dclose(dataset); + + /* string 3 : null pad string */ + space = H5Screate_simple(1, dims3, NULL); + f_type = mkstr(8, H5T_STR_NULLPAD); + m_type = mkstr(6, H5T_STR_NULLTERM); + dataset = H5Dcreate2(fid, "/string3", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string3); + H5Tclose(m_type); + H5Tclose(f_type); + H5Sclose(space); + H5Dclose(dataset); + + /* string 4 : space pad long string */ + space = H5Screate_simple(1, dims4, NULL); + f_type = mkstr(168, H5T_STR_SPACEPAD); + m_type = mkstr(21, H5T_STR_NULLTERM); + dataset = H5Dcreate2(fid, "/string4", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string4); + H5Tclose(m_type); + H5Tclose(f_type); + H5Sclose(space); + H5Dclose(dataset); + + /* compound data */ + space = H5Screate_simple(2, dims5, NULL); + f_type = H5Tcreate (H5T_COMPOUND, sizeof(compound_t)); + f_type2 = H5Tcreate (H5T_COMPOUND, sizeof(compound_t)); + + mdims[0] = 8; mdims[1] = 10; + + array_dt = H5Tarray_create2(H5T_STD_I32BE, 2, mdims); + H5Tinsert(f_type, "int_array", HOFFSET(compound_t, a), array_dt); + H5Tclose(array_dt); + + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 2, mdims); + H5Tinsert(f_type2, "int_array", HOFFSET(compound_t, a), array_dt); + H5Tclose(array_dt); + + mdims[0] = 3; mdims[1] = 4; + + str_type = mkstr(32, H5T_STR_SPACEPAD); + array_dt = H5Tarray_create2(str_type, 2, mdims); + H5Tinsert(f_type, "string", HOFFSET(compound_t, s), array_dt); + H5Tclose(array_dt); + H5Tclose(str_type); + + str_type = mkstr(33, H5T_STR_NULLTERM); + array_dt = H5Tarray_create2(str_type, 2, mdims); + H5Tinsert(f_type2, "string", HOFFSET(compound_t, s), array_dt); + H5Tclose(array_dt); + H5Tclose(str_type); + + for(i = 0; i < 3; i++) + for(j = 0; j < 6; j++) { + for(k = 0 ; k < 8; k++) for(l = 0; l < 10; l++) - comp1[i][j].a[k][l] = (l + j + k) * (l + j + k); - for(k = 0 ; k < 12; k++) - strcpy(comp1[i][j].s[k], "abcdefgh12345678abcdefgh12345678"); - } + comp1[i][j].a[k][l] = (l + j + k) * (l + j + k); + for(k = 0 ; k < 12; k++) + strcpy(comp1[i][j].s[k], "abcdefgh12345678abcdefgh12345678"); + } - dataset = H5Dcreate2(fid, "/comp1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(dataset, f_type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, comp1); + dataset = H5Dcreate2(fid, "/comp1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(dataset, f_type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, comp1); - H5Tclose(f_type); - H5Tclose(f_type2); - H5Sclose(space); - H5Dclose(dataset); + H5Tclose(f_type); + H5Tclose(f_type2); + H5Sclose(space); + H5Dclose(dataset); - H5Fclose(fid); + H5Fclose(fid); } /* @@ -1757,163 +1758,163 @@ static void gent_str(void) { | | | | \ \ string1 string3 string5 string2 string4 string6 -*/ + */ static void gent_str2(void) { -hid_t fid, group, attr, dataset, space, space2, mem_space, hyper_space; -hid_t fxdlenstr, fxdlenstr2, memtype; -hsize_t dims[1], size[1], stride[1], count[1], block[1]; -hsize_t start[1]; - - -int i; -char buf[LENSTR+10]; -char buf2[3*LENSTR2]; -hsize_t sdim; - - fid = H5Fcreate(FILE14, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - - fxdlenstr = H5Tcopy(H5T_C_S1); - H5Tset_size(fxdlenstr, LENSTR); - H5Tset_cset(fxdlenstr, H5T_CSET_ASCII); - H5Tset_strpad(fxdlenstr, H5T_STR_NULLTERM); - - memtype = H5Tcopy(H5T_C_S1); - H5Tset_size(memtype, LENSTR); - H5Tset_cset(memtype, H5T_CSET_ASCII); - H5Tset_strpad(memtype, H5T_STR_NULLTERM); - - sdim = 10; - size[0] = sdim; - space = H5Screate_simple(1, size, NULL); - size[0] = 1; - mem_space = H5Screate_simple(1,size,NULL); - hyper_space = H5Scopy(space); - - /* dset1 */ - - group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - dataset = H5Dcreate2(group, "dset1", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - /* add attributes to dset1 */ - - fxdlenstr2 = H5Tcopy(H5T_C_S1); - H5Tset_size(fxdlenstr2, LENSTR2); - H5Tset_cset(fxdlenstr2, H5T_CSET_ASCII); - H5Tset_strpad(fxdlenstr2, H5T_STR_NULLTERM); - - dims[0] = 3; - space2 = H5Screate_simple(1, dims, NULL); - attr = H5Acreate2(dataset, "attr1", fxdlenstr2, space2, H5P_DEFAULT, H5P_DEFAULT); - sprintf(&(buf2[0*LENSTR2]), "0123456789"); - sprintf(&(buf2[1*LENSTR2]), "abcdefghij"); - sprintf(&(buf2[2*LENSTR2]), "ABCDEFGHIJ"); - H5Awrite(attr, fxdlenstr2, buf2); - H5Sclose(space2); - H5Tclose(fxdlenstr2); - H5Aclose(attr); - - stride[0]=1; - count[0]=1; - block[0]=1; - - for(i = 0; (hsize_t)i < sdim; i++) { - start[0] = i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i); - H5Tset_size(memtype, HDstrlen(buf)+1); - H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); - H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); - } - H5Dclose(dataset); - H5Gclose(group); - - group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - dataset = H5Dcreate2(group, "dset2", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - for(i = 0; (hsize_t)i < sdim; i++) { - start[0] = i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i); - H5Tset_size(memtype, HDstrlen(buf)+1); - H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); - H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); - } - H5Dclose(dataset); - H5Gclose(group); - - - H5Tclose(fxdlenstr); - fxdlenstr = H5Tcopy(H5T_C_S1); - H5Tset_size(fxdlenstr, LENSTR); - H5Tset_cset(fxdlenstr, H5T_CSET_ASCII); - H5Tset_strpad(fxdlenstr, H5T_STR_NULLPAD); - - group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - dataset = H5Dcreate2(group, "dset3", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - for(i = 0;(hsize_t) i < sdim; i++) { - start[0] = i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i); - H5Tset_size(memtype, HDstrlen(buf)+1); - H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); - H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); - } - H5Dclose(dataset); - H5Gclose(group); - - - group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - dataset = H5Dcreate2(group, "dset4", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - for(i = 0; (hsize_t)i < sdim; i++) { - start[0] = i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i); - H5Tset_size(memtype, HDstrlen(buf)+1); - H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); - H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); - } - H5Dclose(dataset); - H5Gclose(group); - - H5Tclose(fxdlenstr); - fxdlenstr = H5Tcopy(H5T_C_S1); - H5Tset_size(fxdlenstr, LENSTR); - H5Tset_cset(fxdlenstr, H5T_CSET_ASCII); - H5Tset_strpad(fxdlenstr, H5T_STR_SPACEPAD); - - group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - dataset = H5Dcreate2(group, "dset5", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - for(i = 0; (hsize_t)i < sdim; i++) { - start[0] = i; - sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i); - H5Tset_size(memtype, HDstrlen(buf) + 1); - H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); - H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); - } - H5Dclose(dataset); - H5Gclose(group); - - - group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - dataset = H5Dcreate2(group, "dset6", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - for(i = 0; (hsize_t)i < sdim; i++) { - start[0] = i; - sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i); - H5Tset_size(memtype, HDstrlen(buf) + 1); - H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); - H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); - } - - H5Dclose(dataset); - H5Gclose(group); - H5Tclose(fxdlenstr); - H5Tclose(memtype); - H5Sclose(mem_space); - H5Sclose(hyper_space); - H5Sclose(space); - H5Fclose(fid); + hid_t fid, group, attr, dataset, space, space2, mem_space, hyper_space; + hid_t fxdlenstr, fxdlenstr2, memtype; + hsize_t dims[1], size[1], stride[1], count[1], block[1]; + hsize_t start[1]; + + + int i; + char buf[LENSTR+10]; + char buf2[3*LENSTR2]; + hsize_t sdim; + + fid = H5Fcreate(FILE14, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + fxdlenstr = H5Tcopy(H5T_C_S1); + H5Tset_size(fxdlenstr, LENSTR); + H5Tset_cset(fxdlenstr, H5T_CSET_ASCII); + H5Tset_strpad(fxdlenstr, H5T_STR_NULLTERM); + + memtype = H5Tcopy(H5T_C_S1); + H5Tset_size(memtype, LENSTR); + H5Tset_cset(memtype, H5T_CSET_ASCII); + H5Tset_strpad(memtype, H5T_STR_NULLTERM); + + sdim = 10; + size[0] = sdim; + space = H5Screate_simple(1, size, NULL); + size[0] = 1; + mem_space = H5Screate_simple(1,size,NULL); + hyper_space = H5Scopy(space); + + /* dset1 */ + + group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(group, "dset1", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + /* add attributes to dset1 */ + + fxdlenstr2 = H5Tcopy(H5T_C_S1); + H5Tset_size(fxdlenstr2, LENSTR2); + H5Tset_cset(fxdlenstr2, H5T_CSET_ASCII); + H5Tset_strpad(fxdlenstr2, H5T_STR_NULLTERM); + + dims[0] = 3; + space2 = H5Screate_simple(1, dims, NULL); + attr = H5Acreate2(dataset, "attr1", fxdlenstr2, space2, H5P_DEFAULT, H5P_DEFAULT); + sprintf(&(buf2[0*LENSTR2]), "0123456789"); + sprintf(&(buf2[1*LENSTR2]), "abcdefghij"); + sprintf(&(buf2[2*LENSTR2]), "ABCDEFGHIJ"); + H5Awrite(attr, fxdlenstr2, buf2); + H5Sclose(space2); + H5Tclose(fxdlenstr2); + H5Aclose(attr); + + stride[0]=1; + count[0]=1; + block[0]=1; + + for(i = 0; (hsize_t)i < sdim; i++) { + start[0] = i; + sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i); + H5Tset_size(memtype, HDstrlen(buf)+1); + H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); + H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); + } + H5Dclose(dataset); + H5Gclose(group); + + group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(group, "dset2", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + for(i = 0; (hsize_t)i < sdim; i++) { + start[0] = i; + sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i); + H5Tset_size(memtype, HDstrlen(buf)+1); + H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); + H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); + } + H5Dclose(dataset); + H5Gclose(group); + + + H5Tclose(fxdlenstr); + fxdlenstr = H5Tcopy(H5T_C_S1); + H5Tset_size(fxdlenstr, LENSTR); + H5Tset_cset(fxdlenstr, H5T_CSET_ASCII); + H5Tset_strpad(fxdlenstr, H5T_STR_NULLPAD); + + group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(group, "dset3", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + for(i = 0;(hsize_t) i < sdim; i++) { + start[0] = i; + sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i); + H5Tset_size(memtype, HDstrlen(buf)+1); + H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); + H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); + } + H5Dclose(dataset); + H5Gclose(group); + + + group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(group, "dset4", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + for(i = 0; (hsize_t)i < sdim; i++) { + start[0] = i; + sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i); + H5Tset_size(memtype, HDstrlen(buf)+1); + H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); + H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); + } + H5Dclose(dataset); + H5Gclose(group); + + H5Tclose(fxdlenstr); + fxdlenstr = H5Tcopy(H5T_C_S1); + H5Tset_size(fxdlenstr, LENSTR); + H5Tset_cset(fxdlenstr, H5T_CSET_ASCII); + H5Tset_strpad(fxdlenstr, H5T_STR_SPACEPAD); + + group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(group, "dset5", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + for(i = 0; (hsize_t)i < sdim; i++) { + start[0] = i; + sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i); + H5Tset_size(memtype, HDstrlen(buf) + 1); + H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); + H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); + } + H5Dclose(dataset); + H5Gclose(group); + + + group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataset = H5Dcreate2(group, "dset6", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + for(i = 0; (hsize_t)i < sdim; i++) { + start[0] = i; + sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i); + H5Tset_size(memtype, HDstrlen(buf) + 1); + H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); + H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); + } + + H5Dclose(dataset); + H5Gclose(group); + H5Tclose(fxdlenstr); + H5Tclose(memtype); + H5Sclose(mem_space); + H5Sclose(hyper_space); + H5Sclose(space); + H5Fclose(fid); } static void gent_enum(void) @@ -1922,9 +1923,9 @@ static void gent_enum(void) hid_t file, type, space, dset; int val; enumtype data[] = {RED, GREEN, BLUE, GREEN, WHITE, - WHITE, BLACK, GREEN, BLUE, RED, - RED, BLUE, GREEN, BLACK, WHITE, - RED, WHITE, GREEN, GREEN, BLUE}; + WHITE, BLACK, GREEN, BLUE, RED, + RED, BLUE, GREEN, BLACK, WHITE, + RED, WHITE, GREEN, GREEN, BLUE}; hsize_t size[1] = {NELMTS(data)}; file = H5Fcreate(FILE15,H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -1949,7 +1950,7 @@ static void gent_enum(void) static void gent_objref(void) { -/*some code is taken from enum.c in the test dir */ + /*some code is taken from enum.c in the test dir */ hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ @@ -1958,8 +1959,8 @@ static void gent_objref(void) hid_t tid1; /* Datatype ID */ hsize_t dims1[] = {SPACE1_DIM1}; hobj_ref_t *wbuf, /* buffer to write to disk */ - *rbuf, /* buffer read from disk */ - *tbuf; /* temp. buffer read from disk */ + *rbuf, /* buffer read from disk */ + *tbuf; /* temp. buffer read from disk */ uint32_t *tu32; /* Temporary pointer to uint32 data */ int i; /* counting variables */ const char *write_comment = "Foo!"; /* Comments for group */ @@ -2057,20 +2058,20 @@ static void gent_datareg(void) hid_t fid1; /* HDF5 File IDs */ hid_t dset1, /* Dataset ID */ - dset2; /* Dereferenced dataset ID */ + dset2; /* Dereferenced dataset ID */ hid_t sid1, /* Dataspace ID #1 */ - sid2; /* Dataspace ID #2 */ + sid2; /* Dataspace ID #2 */ hsize_t dims1[] = {SPACE1_DIM1}, - dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ hdset_reg_ref_t *wbuf, /* buffer to write to disk */ - *rbuf; /* buffer read from disk */ + *rbuf; /* buffer read from disk */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ - *drbuf; /* Buffer for reading numeric data from disk */ + *drbuf; /* Buffer for reading numeric data from disk */ uint8_t *tu8; /* Temporary pointer to uint8 data */ int i; /* counting variables */ @@ -2213,7 +2214,7 @@ static void gent_attrreg(void) */ sid1 = H5Screate (H5S_NULL); dset1 = H5Dcreate2 (fid1, "Dataset1", H5T_STD_I32LE, sid1, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT); H5Sclose (sid1); /* Create references */ @@ -2253,7 +2254,7 @@ static void gent_attrreg(void) /* Create the attribute and write the region references to it. */ attr1 = H5Acreate2 (dset1, "Attribute1", H5T_STD_REF_DSETREG, sid3, H5P_DEFAULT, - H5P_DEFAULT); + H5P_DEFAULT); H5Awrite (attr1, H5T_STD_REF_DSETREG, wbuf); /* Close attribute dataspace */ @@ -2281,18 +2282,18 @@ static void gent_attrreg(void) /*taken from Elena's compound test file*/ static void gent_nestcomp(void) { - /* Compound memeber of the compound datatype*/ + /* Compound memeber of the compound datatype*/ typedef struct cmp_t { - char a; - float b[2]; + char a; + float b[2]; } cmp_t; /* First structure and dataset*/ typedef struct s1_t { - int a; - float b; - double c; - cmp_t d; + int a; + float b; + double c; + cmp_t d; } s2_t; hid_t cmp_tid; /* Handle for the compound datatype */ hid_t char_id; /* Handle for the string datatype */ @@ -2368,7 +2369,7 @@ static void gent_nestcomp(void) */ status = H5Dwrite(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1); if(status < 0) - fprintf(stderr, "gent_nestcomp H5Dwrite failed\n"); + fprintf(stderr, "gent_nestcomp H5Dwrite failed\n"); /* * Release resources @@ -2439,14 +2440,14 @@ static void gent_bitfields(void) /* bitfield_1 */ nelmts = sizeof(buf); if((type = H5Tcopy(H5T_STD_B8LE)) < 0 || - (space = H5Screate_simple(1, &nelmts, NULL)) < 0 || - (dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + (space = H5Screate_simple(1, &nelmts, NULL)) < 0 || + (dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; for(i = 0; i < sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i; if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto error; + goto error; if(H5Sclose(space) < 0) goto error; if(H5Tclose(type) < 0) goto error; if(H5Dclose(dset) < 0) goto error; @@ -2454,25 +2455,25 @@ static void gent_bitfields(void) /* bitfield_2 */ nelmts = sizeof(buf)/2; if((type = H5Tcopy(H5T_STD_B16LE)) < 0 || - (space = H5Screate_simple(1, &nelmts, NULL)) < 0 || - (dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + (space = H5Screate_simple(1, &nelmts, NULL)) < 0 || + (dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; for(i = 0; i < sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i; if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto error; + goto error; if(H5Sclose(space) < 0) goto error; if(H5Tclose(type) < 0) goto error; if(H5Dclose(dset) < 0) goto error; if(H5Gclose(grp) < 0) goto error; H5Fclose(file); - error: + error: H5E_BEGIN_TRY { - H5Gclose(grp); - H5Tclose(type); - H5Sclose(space); - H5Dclose(dset); + H5Gclose(grp); + H5Tclose(type); + H5Sclose(space); + H5Dclose(dset); } H5E_END_TRY; } @@ -2488,7 +2489,7 @@ static void gent_vldatatypes(void) /* Allocate and initialize VL dataset to write */ for(i = 0; i < SPACE1_DIM1; i++) { - int j; + int j; wdata[i].p = HDmalloc((i + 1) * sizeof(int)); wdata[i].len = i + 1; @@ -2515,7 +2516,7 @@ static void gent_vldatatypes(void) /* Allocate and initialize VL dataset to write */ for(i = 0; i < SPACE1_DIM1; i++) { - int j; + int j; wdata[i].p = HDmalloc((i + 1) * sizeof(float)); wdata[i].len = i + 1; @@ -2639,9 +2640,9 @@ gent_vldatatypes2(void) static void gent_vldatatypes3(void) { typedef struct { /* Struct that the VL sequences are composed of */ - int i; - float f; - hvl_t v; + int i; + float f; + hvl_t v; } s1; s1 wdata[SPACE1_DIM1]; /* Information to write */ hid_t fid1; /* HDF5 File IDs */ @@ -2709,8 +2710,8 @@ static void gent_vldatatypes3(void) static void gent_vldatatypes4(void) { typedef struct { /* Struct that the VL sequences are composed of */ - int i; - float f; + int i; + float f; } s1; hvl_t wdata[SPACE1_DIM1]; /* Information to write */ hid_t fid1; /* HDF5 File IDs */ @@ -2728,7 +2729,7 @@ static void gent_vldatatypes4(void) for(j=0; j<(i+1); j++) { ((s1 *)wdata[i].p)[j].i=i*10+j; ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0); - } /* end for */ + } /* end for */ } /* end for */ /* Create file */ @@ -2839,7 +2840,7 @@ static void gent_vldatatypes5(void) via region reference for testing refion reference output. Note: this was added originally prepared for bug2092. before the fix h5dump didn't display array indices every 262 x N (N > 0) based on 2000x1000 dims. -*/ + */ #define SPACE_ARRAY1BIG_DIM 2000 #define ARRAY1BIG_DIM 1000 @@ -2855,7 +2856,7 @@ static void gent_array1_big(void) int i,j; /* counting variables */ herr_t ret; /* Generic return value */ - + /* for region reference dataset */ hid_t dset2; hid_t sid2; @@ -3080,8 +3081,8 @@ static void gent_array3(void) static void gent_array4(void) { typedef struct { /* Typedef for compound datatype */ - int i; - float f; + int i; + float f; } s2_t; s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ hid_t fid1; /* HDF5 File IDs */ @@ -3146,8 +3147,8 @@ static void gent_array4(void) static void gent_array5(void) { typedef struct { /* Typedef for compound datatype */ - int i; - float f[ARRAY1_DIM1]; + int i; + float f[ARRAY1_DIM1]; } s2_t; s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ hid_t fid1; /* HDF5 File IDs */ @@ -3365,7 +3366,7 @@ static void gent_array8(void) * elements within the array datatype. */ for (i=0; i<F64_DIM1; i++) - wdata[i] = i; + wdata[i] = i; /* * Create a new file using the default properties. @@ -3404,9 +3405,9 @@ static void gent_array8(void) static void gent_empty(void) { typedef struct { - int a; - float b; - char c; + int a; + float b; + char c; } empty_struct; hid_t file, dset, space, type; hsize_t dims[] = { SPACE1_DIM1 }; @@ -3561,8 +3562,8 @@ void gent_split_file(void) dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < 10; i++) - for(j = 0; j < 15; j++) - dset[i][j] = i + j; + for(j = 0; j < 15; j++) + dset[i][j] = i + j; H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset); H5Sclose(space); @@ -3593,8 +3594,8 @@ void gent_family(void) dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < 10; i++) - for(j = 0; j < 15; j++) - dset[i][j] = i + j; + for(j = 0; j < 15; j++) + dset[i][j] = i + j; H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset); H5Sclose(space); @@ -3633,13 +3634,13 @@ void gent_multi(void) memb_map[mt] = mt; sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; -/*printf("memb_name[%d]=%s, memb_map[%d]=%d; ", mt, memb_name[mt], mt, memb_map[mt]);*/ + /*printf("memb_name[%d]=%s, memb_map[%d]=%d; ", mt, memb_name[mt], mt, memb_map[mt]);*/ memb_addr[mt] = MAX(mt - 1,0) * (HADDR_MAX / 10); } memb_map[H5FD_MEM_DEFAULT] = H5FD_MEM_SUPER; H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, - memb_addr, FALSE); + memb_addr, FALSE); fid = H5Fcreate(FILE36, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -3650,8 +3651,8 @@ void gent_multi(void) dataset = H5Dcreate2(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < 10; i++) - for(j = 0; j < 15; j++) - dset[i][j] = i + j; + for(j = 0; j < 15; j++) + dset[i][j] = i + j; H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset); @@ -3684,11 +3685,11 @@ static void gent_large_objname(void) static void gent_vlstr(void) { const char *wdata[SPACE1_DIM1]= { - "Four score and seven years ago our forefathers brought forth on this continent a new nation,", - "conceived in liberty and dedicated to the proposition that all men are created equal.", - "", - NULL - }; /* Information to write */ + "Four score and seven years ago our forefathers brought forth on this continent a new nation,", + "conceived in liberty and dedicated to the proposition that all men are created equal.", + "", + NULL + }; /* Information to write */ const char *string_att= "This is the string for the attribute"; hid_t fid1; /* HDF5 File IDs */ hid_t dataset, root; /* Dataset ID */ @@ -3733,12 +3734,12 @@ static void gent_vlstr(void) static void gent_char(void) { const char *wdata = - "Four score and seven years ago our forefathers brought " - "forth on this continent a new nation, conceived in " - "liberty and dedicated to the proposition that all " - "men are created equal. Now we are engaged in a great " - "civil war, testing whether that nation or any nation " - "so conceived and so dedicated can long endure."; + "Four score and seven years ago our forefathers brought " + "forth on this continent a new nation, conceived in " + "liberty and dedicated to the proposition that all " + "men are created equal. Now we are engaged in a great " + "civil war, testing whether that nation or any nation " + "so conceived and so dedicated can long endure."; hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ hid_t sid1; /* Dataspace ID */ @@ -3779,427 +3780,427 @@ static void gent_char(void) */ static void write_attr_in(hid_t loc_id, - const char* dset_name, /* for saving reference to dataset*/ - hid_t fid) + const char* dset_name, /* for saving reference to dataset*/ + hid_t fid) { - /* Compound datatype */ - typedef struct s_t - { - char a; - double b; - } s_t; - - typedef enum - { - E_RED, - E_GREEN - } e_t; - - hid_t aid; - hid_t sid; - hid_t tid; - herr_t status; - int val, i, j, k, n; - float f; - - /* create 1D attributes with dimension [2], 2 elements */ - hsize_t dims[1]={2}; - char buf1[2][2]= {"ab","de"}; /* string */ - char buf2[2]= {1,2}; /* bitfield, opaque */ - s_t buf3[2]= {{1,2},{3,4}}; /* compound */ - hobj_ref_t buf4[2]; /* reference */ - hvl_t buf5[2]; /* vlen */ - hsize_t dimarray[1]={3}; /* array dimension */ - int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ - int buf7[2]= {1,2}; /* integer */ - float buf8[2]= {1,2}; /* float */ - - /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2]={3,2}; - char buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; /* string */ - char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ - s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ - hobj_ref_t buf42[3][2]; /* reference */ - hvl_t buf52[3][2]; /* vlen */ - int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ - int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ - float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */ - - /* create 3D attributes with dimension [4][3][2], 24 elements */ - hsize_t dims3[3]={4,3,2}; - char buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", - "rs","tu","vw","xz","AB","CD","EF","GH", - "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */ - char buf23[4][3][2]; /* bitfield, opaque */ - s_t buf33[4][3][2]; /* compound */ - hobj_ref_t buf43[4][3][2]; /* reference */ - hvl_t buf53[4][3][2]; /* vlen */ - int buf63[24][3]; /* array */ - int buf73[4][3][2]; /* integer */ - float buf83[4][3][2]; /* float */ + /* Compound datatype */ + typedef struct s_t + { + char a; + double b; + } s_t; + typedef enum + { + E_RED, + E_GREEN + } e_t; -/*------------------------------------------------------------------------- - * 1D attributes - *------------------------------------------------------------------------- - */ + hid_t aid; + hid_t sid; + hid_t tid; + herr_t status; + int val, i, j, k, n; + float f; + + /* create 1D attributes with dimension [2], 2 elements */ + hsize_t dims[1]={2}; + char buf1[2][2]= {"ab","de"}; /* string */ + char buf2[2]= {1,2}; /* bitfield, opaque */ + s_t buf3[2]= {{1,2},{3,4}}; /* compound */ + hobj_ref_t buf4[2]; /* reference */ + hvl_t buf5[2]; /* vlen */ + hsize_t dimarray[1]={3}; /* array dimension */ + int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ + int buf7[2]= {1,2}; /* integer */ + float buf8[2]= {1,2}; /* float */ + + /* create 2D attributes with dimension [3][2], 6 elements */ + hsize_t dims2[2]={3,2}; + char buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; /* string */ + char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ + s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ + hobj_ref_t buf42[3][2]; /* reference */ + hvl_t buf52[3][2]; /* vlen */ + int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ + int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ + float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */ + + /* create 3D attributes with dimension [4][3][2], 24 elements */ + hsize_t dims3[3]={4,3,2}; + char buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", + "rs","tu","vw","xz","AB","CD","EF","GH", + "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */ + char buf23[4][3][2]; /* bitfield, opaque */ + s_t buf33[4][3][2]; /* compound */ + hobj_ref_t buf43[4][3][2]; /* reference */ + hvl_t buf53[4][3][2]; /* vlen */ + int buf63[24][3]; /* array */ + int buf73[4][3][2]; /* integer */ + float buf83[4][3][2]; /* float */ -/*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, 2); - write_attr(loc_id,1,dims,"string",tid,buf1); - status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ - tid = H5Tcopy(H5T_STD_B8LE); - write_attr(loc_id,1,dims,"bitfield",tid,buf2); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * 1D attributes + *------------------------------------------------------------------------- + */ -/*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_OPAQUE, 1); - status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_attr(loc_id,1,dims,"opaque",tid,buf2); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_STRING + *------------------------------------------------------------------------- + */ + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, 2); + write_attr(loc_id,1,dims,"string",tid,buf1); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_attr(loc_id,1,dims,"compound",tid,buf3); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ + tid = H5Tcopy(H5T_STD_B8LE); + write_attr(loc_id,1,dims,"bitfield",tid,buf2); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - /* Create references to dataset */ - if(dset_name) - { - status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,-1); - status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1); - write_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); - } + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_OPAQUE, 1); + status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ + write_attr(loc_id,1,dims,"opaque",tid,buf2); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); - H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_attr(loc_id,1,dims,"enum",tid,0); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ + tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); + H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + write_attr(loc_id,1,dims,"compound",tid,buf3); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_REFERENCE + *------------------------------------------------------------------------- + */ + /* Create references to dataset */ + if(dset_name) + { + status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1); + write_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); + } - /* Allocate and initialize VL dataset to write */ - - buf5[0].len = 1; - buf5[0].p = HDmalloc(1 * sizeof(int)); - ((int *)buf5[0].p)[0] = 1; - buf5[1].len = 2; - buf5[1].p = HDmalloc(2 * sizeof(int)); - ((int *)buf5[1].p)[0] = 2; - ((int *)buf5[1].p)[1] = 3; - - sid = H5Screate_simple(1, dims, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT); - status = H5Awrite(aid, tid, buf5); - HDassert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); - HDassert(status >= 0); - status = H5Aclose(aid); - status = H5Tclose(tid); - status = H5Sclose(sid); + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "GREEN", (val = 1, &val)); + write_attr(loc_id,1,dims,"enum",tid,0); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); - write_attr(loc_id, 1, dims, "array", tid, buf6); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ -/*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ - write_attr(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7); - write_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8); + /* Allocate and initialize VL dataset to write */ + buf5[0].len = 1; + buf5[0].p = HDmalloc(1 * sizeof(int)); + ((int *)buf5[0].p)[0] = 1; + buf5[1].len = 2; + buf5[1].p = HDmalloc(2 * sizeof(int)); + ((int *)buf5[1].p)[0] = 2; + ((int *)buf5[1].p)[1] = 3; + + sid = H5Screate_simple(1, dims, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + status = H5Awrite(aid, tid, buf5); + HDassert(status >= 0); + status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); + HDassert(status >= 0); + status = H5Aclose(aid); + status = H5Tclose(tid); + status = H5Sclose(sid); -/*------------------------------------------------------------------------- - * 2D attributes - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 1, dims, "array", tid, buf6); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, 2); - write_attr(loc_id,2,dims2,"string2D",tid,buf12); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ + write_attr(loc_id, 1, dims, "integer", H5T_NATIVE_INT, buf7); + write_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8); -/*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ - tid = H5Tcopy(H5T_STD_B8LE); - write_attr(loc_id,2,dims2,"bitfield2D",tid,buf22); - status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_OPAQUE, 1); - status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_attr(loc_id,2,dims2,"opaque2D",tid,buf22); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * 2D attributes + *------------------------------------------------------------------------- + */ -/*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_attr(loc_id,2,dims2,"compound2D",tid,buf32); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_STRING + *------------------------------------------------------------------------- + */ + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, 2); + write_attr(loc_id,2,dims2,"string2D",tid,buf12); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - /* Create references to dataset */ - if(dset_name) - { - for(i = 0; i < 3; i++) { - for(j = 0; j < 2; j++) { - status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1); - } - } - write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); - } + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ + tid = H5Tcopy(H5T_STD_B8LE); + write_attr(loc_id,2,dims2,"bitfield2D",tid,buf22); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); - H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_attr(loc_id,2,dims2,"enum2D",tid,0); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_OPAQUE, 1); + status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ + write_attr(loc_id,2,dims2,"opaque2D",tid,buf22); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ + tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); + H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + write_attr(loc_id,2,dims2,"compound2D",tid,buf32); + status = H5Tclose(tid); - /* Allocate and initialize VL dataset to write */ - n=0; - for(i = 0; i < 3; i++) { - for(j = 0; j < 2; j++) { - int l; - - buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); - buf52[i][j].len = i + 1; - for(l = 0; l < i + 1; l++) - ((int *)buf52[i][j].p)[l] = n++; - } - } - - sid = H5Screate_simple(2, dims2, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); - status = H5Awrite(aid, tid, buf52); - HDassert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52); - HDassert(status >= 0); - status = H5Aclose(aid); - status = H5Tclose(tid); - status = H5Sclose(sid); + /*------------------------------------------------------------------------- + * H5T_REFERENCE + *------------------------------------------------------------------------- + */ + /* Create references to dataset */ + if(dset_name) + { + for(i = 0; i < 3; i++) { + for(j = 0; j < 2; j++) { + status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1); + } + } + write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); + } -/*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); - write_attr(loc_id, 2, dims2, "array2D", tid, buf62); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "GREEN", (val = 1, &val)); + write_attr(loc_id,2,dims2,"enum2D",tid,0); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ - write_attr(loc_id, 2, dims2, "integer2D", H5T_NATIVE_INT, buf72); - write_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82); + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ + /* Allocate and initialize VL dataset to write */ + n=0; + for(i = 0; i < 3; i++) { + for(j = 0; j < 2; j++) { + int l; + + buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); + buf52[i][j].len = i + 1; + for(l = 0; l < i + 1; l++) + ((int *)buf52[i][j].p)[l] = n++; + } + } -/*------------------------------------------------------------------------- - * 3D attributes - *------------------------------------------------------------------------- - */ + sid = H5Screate_simple(2, dims2, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + status = H5Awrite(aid, tid, buf52); + HDassert(status >= 0); + status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52); + HDassert(status >= 0); + status = H5Aclose(aid); + status = H5Tclose(tid); + status = H5Sclose(sid); -/*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, 2); - write_attr(loc_id,3,dims3,"string3D",tid,buf13); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 2, dims2, "array2D", tid, buf62); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ + write_attr(loc_id, 2, dims2, "integer2D", H5T_NATIVE_INT, buf72); + write_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82); - n=1; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { - buf23[i][j][k]=n++; - } - } - } - tid = H5Tcopy(H5T_STD_B8LE); - write_attr(loc_id,3,dims3,"bitfield3D",tid,buf23); - status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_OPAQUE, 1); - status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_attr(loc_id,3,dims3,"opaque3D",tid,buf23); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * 3D attributes + *------------------------------------------------------------------------- + */ -/*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_STRING + *------------------------------------------------------------------------- + */ + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, 2); + write_attr(loc_id,3,dims3,"string3D",tid,buf13); + status = H5Tclose(tid); - n=1; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { - buf33[i][j][k].a=n++; - buf33[i][j][k].b=n++; - } - } - } - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_attr(loc_id,3,dims3,"compound3D",tid,buf33); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ -/*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - /* Create references to dataset */ - if(dset_name) - { - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) - status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,-1); - } - } - write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); - } + n=1; + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) { + buf23[i][j][k]=n++; + } + } + } + tid = H5Tcopy(H5T_STD_B8LE); + write_attr(loc_id,3,dims3,"bitfield3D",tid,buf23); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); - H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_attr(loc_id,3,dims3,"enum3D",tid,0); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_OPAQUE, 1); + status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ + write_attr(loc_id,3,dims3,"opaque3D",tid,buf23); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ - /* Allocate and initialize VL dataset to write */ - n = 0; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { - int l; - - buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); - buf53[i][j][k].len = i + 1; - for(l = 0; l < i + 1; l++) - ((int *)buf53[i][j][k].p)[l] = n++; - } - } - } - - sid = H5Screate_simple(3, dims3, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); - status = H5Awrite(aid, tid, buf53); - HDassert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53); - HDassert(status >= 0); - status = H5Aclose(aid); - status = H5Tclose(tid); - status = H5Sclose(sid); + n=1; + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) { + buf33[i][j][k].a=n++; + buf33[i][j][k].b=n++; + } + } + } + tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); + H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + write_attr(loc_id,3,dims3,"compound3D",tid,buf33); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - n = 1; - for(i = 0; i < 24; i++) - for(j = 0; j < (int)dimarray[0]; j++) - buf63[i][j] = n++; + /*------------------------------------------------------------------------- + * H5T_REFERENCE + *------------------------------------------------------------------------- + */ + /* Create references to dataset */ + if(dset_name) + { + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) + status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,-1); + } + } + write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); + } - tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); - write_attr(loc_id, 3, dims3, "array3D", tid, buf63); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "GREEN", (val = 1, &val)); + write_attr(loc_id,3,dims3,"enum3D",tid,0); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ - n=1; f=1; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { - buf73[i][j][k]=n++; - buf83[i][j][k]=f++; - } - } - } - write_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73); - write_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83); + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ + + /* Allocate and initialize VL dataset to write */ + n = 0; + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) { + int l; + + buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); + buf53[i][j][k].len = i + 1; + for(l = 0; l < i + 1; l++) + ((int *)buf53[i][j][k].p)[l] = n++; + } + } + } + + sid = H5Screate_simple(3, dims3, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + status = H5Awrite(aid, tid, buf53); + HDassert(status >= 0); + status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53); + HDassert(status >= 0); + status = H5Aclose(aid); + status = H5Tclose(tid); + status = H5Sclose(sid); + + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + n = 1; + for(i = 0; i < 24; i++) + for(j = 0; j < (int)dimarray[0]; j++) + buf63[i][j] = n++; + + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_attr(loc_id, 3, dims3, "array3D", tid, buf63); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ + n=1; f=1; + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) { + buf73[i][j][k]=n++; + buf83[i][j][k]=f++; + } + } + } + write_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73); + write_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83); } @@ -4219,441 +4220,441 @@ static void write_attr_in(hid_t loc_id, */ static void write_dset_in(hid_t loc_id, - const char* dset_name, /* for saving reference to dataset*/ - hid_t fid) + const char* dset_name, /* for saving reference to dataset*/ + hid_t fid) { - /* Compound datatype */ - typedef struct s_t - { - char a; - double b; - } s_t; - - typedef enum - { - E_RED, - E_GREEN - } e_t; - - hid_t did; - hid_t sid; - hid_t tid; - hid_t plist_id; - herr_t status; - int val, i, j, k, n; - float f; - int fillvalue=2; - - /* create 1D attributes with dimension [2], 2 elements */ - hsize_t dims[1]={2}; - char buf1[2][2]= {"ab","de"}; /* string */ - char buf2[2]= {1,2}; /* bitfield, opaque */ - s_t buf3[2]= {{1,2},{3,4}}; /* compound */ - hobj_ref_t buf4[2]; /* reference */ - hvl_t buf5[2]; /* vlen */ - hsize_t dimarray[1]={3}; /* array dimension */ - int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ - int buf7[2]= {1,2}; /* integer */ - float buf8[2]= {1,2}; /* float */ - - /* create 2D attributes with dimension [3][2], 6 elements */ - hsize_t dims2[2]={3,2}; - char buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; /* string */ - char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ - s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ - hobj_ref_t buf42[3][2]; /* reference */ - hvl_t buf52[3][2]; /* vlen */ - int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ - int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ - float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */ - - /* create 3D attributes with dimension [4][3][2], 24 elements */ - hsize_t dims3[3]={4,3,2}; - char buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", - "rs","tu","vw","xz","AB","CD","EF","GH", - "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */ - char buf23[4][3][2]; /* bitfield, opaque */ - s_t buf33[4][3][2]; /* compound */ - hobj_ref_t buf43[4][3][2]; /* reference */ - hvl_t buf53[4][3][2]; /* vlen */ - int buf63[24][3]; /* array */ - int buf73[4][3][2]; /* integer */ - float buf83[4][3][2]; /* float */ + /* Compound datatype */ + typedef struct s_t + { + char a; + double b; + } s_t; + typedef enum + { + E_RED, + E_GREEN + } e_t; -/*------------------------------------------------------------------------- - * 1D - *------------------------------------------------------------------------- - */ + hid_t did; + hid_t sid; + hid_t tid; + hid_t plist_id; + herr_t status; + int val, i, j, k, n; + float f; + int fillvalue=2; + + /* create 1D attributes with dimension [2], 2 elements */ + hsize_t dims[1]={2}; + char buf1[2][2]= {"ab","de"}; /* string */ + char buf2[2]= {1,2}; /* bitfield, opaque */ + s_t buf3[2]= {{1,2},{3,4}}; /* compound */ + hobj_ref_t buf4[2]; /* reference */ + hvl_t buf5[2]; /* vlen */ + hsize_t dimarray[1]={3}; /* array dimension */ + int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */ + int buf7[2]= {1,2}; /* integer */ + float buf8[2]= {1,2}; /* float */ + + /* create 2D attributes with dimension [3][2], 6 elements */ + hsize_t dims2[2]={3,2}; + char buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; /* string */ + char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ + s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ + hobj_ref_t buf42[3][2]; /* reference */ + hvl_t buf52[3][2]; /* vlen */ + int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ + int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ + float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */ + + /* create 3D attributes with dimension [4][3][2], 24 elements */ + hsize_t dims3[3]={4,3,2}; + char buf13[24][2]= {"ab","cd","ef","gh","ij","kl","mn","pq", + "rs","tu","vw","xz","AB","CD","EF","GH", + "IJ","KL","MN","PQ","RS","TU","VW","XZ"}; /* string */ + char buf23[4][3][2]; /* bitfield, opaque */ + s_t buf33[4][3][2]; /* compound */ + hobj_ref_t buf43[4][3][2]; /* reference */ + hvl_t buf53[4][3][2]; /* vlen */ + int buf63[24][3]; /* array */ + int buf73[4][3][2]; /* integer */ + float buf83[4][3][2]; /* float */ -/*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, 2); - write_dset(loc_id,1,dims,"string",tid,buf1); - status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ - tid = H5Tcopy(H5T_STD_B8LE); - write_dset(loc_id,1,dims,"bitfield",tid,buf2); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * 1D + *------------------------------------------------------------------------- + */ -/*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_OPAQUE, 1); - status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_dset(loc_id,1,dims,"opaque",tid,buf2); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_STRING + *------------------------------------------------------------------------- + */ + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, 2); + write_dset(loc_id,1,dims,"string",tid,buf1); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_dset(loc_id,1,dims,"compound",tid,buf3); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ + tid = H5Tcopy(H5T_STD_B8LE); + write_dset(loc_id,1,dims,"bitfield",tid,buf2); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - /* Create references to dataset */ - if(dset_name) - { - status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,-1); - status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1); - write_dset(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); - } + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_OPAQUE, 1); + status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ + write_dset(loc_id,1,dims,"opaque",tid,buf2); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); - H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_dset(loc_id,1,dims,"enum",tid,0); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ + tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); + H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + write_dset(loc_id,1,dims,"compound",tid,buf3); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_REFERENCE + *------------------------------------------------------------------------- + */ + /* Create references to dataset */ + if(dset_name) + { + status=H5Rcreate(&buf4[0],fid,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf4[1],fid,dset_name,H5R_OBJECT,-1); + write_dset(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); + } - /* Allocate and initialize VL dataset to write */ - - buf5[0].len = 1; - buf5[0].p = HDmalloc( 1 * sizeof(int)); - ((int *)buf5[0].p)[0]=1; - buf5[1].len = 2; - buf5[1].p = HDmalloc( 2 * sizeof(int)); - ((int *)buf5[1].p)[0]=2; - ((int *)buf5[1].p)[1]=3; - - sid = H5Screate_simple(1, dims, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5); - HDassert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); - HDassert(status >= 0); - status = H5Dclose(did); - status = H5Tclose(tid); - status = H5Sclose(sid); + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "GREEN", (val = 1, &val)); + write_dset(loc_id,1,dims,"enum",tid,0); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); - write_dset(loc_id, 1, dims, "array", tid, buf6); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ -/*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ - write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7); - write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8); + /* Allocate and initialize VL dataset to write */ + buf5[0].len = 1; + buf5[0].p = HDmalloc( 1 * sizeof(int)); + ((int *)buf5[0].p)[0]=1; + buf5[1].len = 2; + buf5[1].p = HDmalloc( 2 * sizeof(int)); + ((int *)buf5[1].p)[0]=2; + ((int *)buf5[1].p)[1]=3; + + sid = H5Screate_simple(1, dims, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5); + HDassert(status >= 0); + status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); + HDassert(status >= 0); + status = H5Dclose(did); + status = H5Tclose(tid); + status = H5Sclose(sid); -/*------------------------------------------------------------------------- - * 2D - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_dset(loc_id, 1, dims, "array", tid, buf6); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, 2); - write_dset(loc_id,2,dims2,"string2D",tid,buf12); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ + write_dset(loc_id,1,dims,"integer",H5T_NATIVE_INT,buf7); + write_dset(loc_id,1,dims,"float",H5T_NATIVE_FLOAT,buf8); -/*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ - tid = H5Tcopy(H5T_STD_B8LE); - write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22); - status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_OPAQUE, 1); - status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_dset(loc_id,2,dims2,"opaque2D",tid,buf22); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * 2D + *------------------------------------------------------------------------- + */ -/*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_dset(loc_id,2,dims2,"compound2D",tid,buf32); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_STRING + *------------------------------------------------------------------------- + */ + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, 2); + write_dset(loc_id,2,dims2,"string2D",tid,buf12); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - /* Create references to dataset */ - if(dset_name) - { - for(i = 0; i < 3; i++) { - for(j = 0; j < 2; j++) { - status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1); - } - } - write_dset(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); - } + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ + tid = H5Tcopy(H5T_STD_B8LE); + write_dset(loc_id,2,dims2,"bitfield2D",tid,buf22); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); - H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_dset(loc_id,2,dims2,"enum2D",tid,0); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_OPAQUE, 1); + status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ + write_dset(loc_id,2,dims2,"opaque2D",tid,buf22); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ + tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); + H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + write_dset(loc_id,2,dims2,"compound2D",tid,buf32); + status = H5Tclose(tid); - /* Allocate and initialize VL dataset to write */ - n=0; - for(i = 0; i < 3; i++) - for(j = 0; j < 2; j++) { - int l; - - buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); - buf52[i][j].len = i + 1; - for(l = 0; l < i + 1; l++) - ((int *)buf52[i][j].p)[l] = n++; - } - - sid = H5Screate_simple(2, dims2, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52); - HDassert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52); - HDassert(status >= 0); - status = H5Dclose(did); - status = H5Tclose(tid); - status = H5Sclose(sid); + /*------------------------------------------------------------------------- + * H5T_REFERENCE + *------------------------------------------------------------------------- + */ + /* Create references to dataset */ + if(dset_name) + { + for(i = 0; i < 3; i++) { + for(j = 0; j < 2; j++) { + status=H5Rcreate(&buf42[i][j],fid,dset_name,H5R_OBJECT,-1); + } + } + write_dset(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); + } -/*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); - write_dset(loc_id, 2, dims2, "array2D", tid, buf62); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "GREEN", (val = 1, &val)); + write_dset(loc_id,2,dims2,"enum2D",tid,0); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_INTEGER, write a fill value - *------------------------------------------------------------------------- - */ - plist_id = H5Pcreate(H5P_DATASET_CREATE); - status = H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue); - sid = H5Screate_simple(2, dims2, NULL); - did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, plist_id, H5P_DEFAULT); - status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72); - status = H5Pclose(plist_id); - status = H5Dclose(did); - status = H5Sclose(sid); + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ -/*------------------------------------------------------------------------- - * H5T_FLOAT - *------------------------------------------------------------------------- - */ + /* Allocate and initialize VL dataset to write */ + n=0; + for(i = 0; i < 3; i++) + for(j = 0; j < 2; j++) { + int l; - write_dset(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82); + buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); + buf52[i][j].len = i + 1; + for(l = 0; l < i + 1; l++) + ((int *)buf52[i][j].p)[l] = n++; + } + sid = H5Screate_simple(2, dims2, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52); + HDassert(status >= 0); + status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52); + HDassert(status >= 0); + status = H5Dclose(did); + status = H5Tclose(tid); + status = H5Sclose(sid); -/*------------------------------------------------------------------------- - * 3D - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_dset(loc_id, 2, dims2, "array2D", tid, buf62); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - tid = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid, 2); - write_dset(loc_id,3,dims3,"string3D",tid,buf13); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_INTEGER, write a fill value + *------------------------------------------------------------------------- + */ + plist_id = H5Pcreate(H5P_DATASET_CREATE); + status = H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue); + sid = H5Screate_simple(2, dims2, NULL); + did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, plist_id, H5P_DEFAULT); + status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72); + status = H5Pclose(plist_id); + status = H5Dclose(did); + status = H5Sclose(sid); -/*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_FLOAT + *------------------------------------------------------------------------- + */ - n=1; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { - buf23[i][j][k]=n++; - } - } - } - tid = H5Tcopy(H5T_STD_B8LE); - write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23); - status = H5Tclose(tid); + write_dset(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82); -/*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_OPAQUE, 1); - status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ - write_dset(loc_id,3,dims3,"opaque3D",tid,buf23); - status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * 3D + *------------------------------------------------------------------------- + */ - n=1; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { - buf33[i][j][k].a=n++; - buf33[i][j][k].b=n++; - } - } - } - tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); - write_dset(loc_id,3,dims3,"compound3D",tid,buf33); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_STRING + *------------------------------------------------------------------------- + */ + tid = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid, 2); + write_dset(loc_id,3,dims3,"string3D",tid,buf13); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - /* Create references to dataset */ - if(dset_name) - { - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) - status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,-1); - } - } - write_dset(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); - } + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ -/*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(tid, "RED", (val = 0, &val)); - H5Tenum_insert(tid, "GREEN", (val = 1, &val)); - write_dset(loc_id,3,dims3,"enum3D",tid,0); - status = H5Tclose(tid); + n=1; + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) { + buf23[i][j][k]=n++; + } + } + } + tid = H5Tcopy(H5T_STD_B8LE); + write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23); + status = H5Tclose(tid); -/*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_OPAQUE, 1); + status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */ + write_dset(loc_id,3,dims3,"opaque3D",tid,buf23); + status = H5Tclose(tid); - /* Allocate and initialize VL dataset to write */ - n = 0; - for(i = 0; i < 4; i++) - for(j = 0; j < 3; j++) - for(k = 0; k < 2; k++) { - int l; - - buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); - buf53[i][j][k].len = i + 1; - for(l = 0; l < i + 1; l++) - ((int *)buf53[i][j][k].p)[l] = n++; - } - - sid = H5Screate_simple(3, dims3, NULL); - tid = H5Tvlen_create(H5T_NATIVE_INT); - did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53); - HDassert(status >= 0); - status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53); - HDassert(status >= 0); - status = H5Dclose(did); - status = H5Tclose(tid); - status = H5Sclose(sid); + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ -/*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - n=1; - for(i = 0; i < 24; i++) { - for(j = 0; j < (int)dimarray[0]; j++) { - buf63[i][j]=n++; - } - } + n=1; + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) { + buf33[i][j][k].a=n++; + buf33[i][j][k].b=n++; + } + } + } + tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); + H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); + H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + write_dset(loc_id,3,dims3,"compound3D",tid,buf33); + status = H5Tclose(tid); - tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); - write_dset(loc_id, 3, dims3, "array3D", tid, buf63); - status = H5Tclose(tid); + /*------------------------------------------------------------------------- + * H5T_REFERENCE + *------------------------------------------------------------------------- + */ + /* Create references to dataset */ + if(dset_name) + { + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) + status=H5Rcreate(&buf43[i][j][k],fid,dset_name,H5R_OBJECT,-1); + } + } + write_dset(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); + } -/*------------------------------------------------------------------------- - * H5T_INTEGER and H5T_FLOAT - *------------------------------------------------------------------------- - */ - n=1; f=1; - for(i = 0; i < 4; i++) { - for(j = 0; j < 3; j++) { - for(k = 0; k < 2; k++) { - buf73[i][j][k]=n++; - buf83[i][j][k]=f++; - } - } - } - write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73); - write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83); + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + tid = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(tid, "RED", (val = 0, &val)); + H5Tenum_insert(tid, "GREEN", (val = 1, &val)); + write_dset(loc_id,3,dims3,"enum3D",tid,0); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ + + /* Allocate and initialize VL dataset to write */ + n = 0; + for(i = 0; i < 4; i++) + for(j = 0; j < 3; j++) + for(k = 0; k < 2; k++) { + int l; + + buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); + buf53[i][j][k].len = i + 1; + for(l = 0; l < i + 1; l++) + ((int *)buf53[i][j][k].p)[l] = n++; + } + + sid = H5Screate_simple(3, dims3, NULL); + tid = H5Tvlen_create(H5T_NATIVE_INT); + did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53); + HDassert(status >= 0); + status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53); + HDassert(status >= 0); + status = H5Dclose(did); + status = H5Tclose(tid); + status = H5Sclose(sid); + + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + n=1; + for(i = 0; i < 24; i++) { + for(j = 0; j < (int)dimarray[0]; j++) { + buf63[i][j]=n++; + } + } + + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_dset(loc_id, 3, dims3, "array3D", tid, buf63); + status = H5Tclose(tid); + + /*------------------------------------------------------------------------- + * H5T_INTEGER and H5T_FLOAT + *------------------------------------------------------------------------- + */ + n=1; f=1; + for(i = 0; i < 4; i++) { + for(j = 0; j < 3; j++) { + for(k = 0; k < 2; k++) { + buf73[i][j][k]=n++; + buf83[i][j][k]=f++; + } + } + } + write_dset(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73); + write_dset(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83); } @@ -4699,18 +4700,18 @@ static void gent_attr_all(void) root_id = H5Gopen2(fid, "/", H5P_DEFAULT); /*------------------------------------------------------------------------- - * write a series of attributes on the dataset, group - *------------------------------------------------------------------------- - */ + * write a series of attributes on the dataset, group + *------------------------------------------------------------------------- + */ write_attr_in(did,"dset",fid); write_attr_in(group_id,NULL,0); write_attr_in(root_id,NULL,0); /*------------------------------------------------------------------------- - * write a series of datasets on group 2 - *------------------------------------------------------------------------- - */ + * write a series of datasets on group 2 + *------------------------------------------------------------------------- + */ write_dset_in(group2_id,"/dset",fid); @@ -4744,27 +4745,27 @@ static void gent_attr_all(void) static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, - hid_t tid, void *buf) + hid_t tid, void *buf) { - hid_t aid; - hid_t sid; - herr_t status; + hid_t aid; + hid_t sid; + herr_t status; - /* Create a buf space */ - sid = H5Screate_simple(rank, dims, NULL); + /* Create a buf space */ + sid = H5Screate_simple(rank, dims, NULL); - /* Create the attribute */ - aid = H5Acreate2(loc_id, attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT); + /* Create the attribute */ + aid = H5Acreate2(loc_id, attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT); - /* Write the buf */ - if(buf) - status = H5Awrite(aid, tid, buf); + /* Write the buf */ + if(buf) + status = H5Awrite(aid, tid, buf); - /* Close */ - status = H5Aclose(aid); - status = H5Sclose(sid); + /* Close */ + status = H5Aclose(aid); + status = H5Sclose(sid); - return status; + return status; } /*------------------------------------------------------------------------- @@ -4783,7 +4784,7 @@ int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, static int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, - hid_t tid, void *buf ) + hid_t tid, void *buf ) { hid_t did; hid_t sid; @@ -4811,23 +4812,23 @@ 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; + 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" - }; + "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', '!'}; @@ -4854,24 +4855,24 @@ static void gent_compound_complex(void) Array1[m].a = m; for(n = 0; n < F41_DIMb; n++) { - Array1[m].b[n] = quote[n]; - } + Array1[m].b[n] = quote[n]; + } - for(n = 0; n < F41_ARRAY_DIMc; 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; + 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 = (float)( m * .96 ); - for(n = 0; n < F41_ARRAY_DIMf; n++) { + for(n = 0; n < F41_ARRAY_DIMf; n++) { Array1[m].f[n] = ( m * 1024.9637 ); - } + } Array1[m].g = 'm'; } @@ -4882,7 +4883,7 @@ static void gent_compound_complex(void) /* Create the file */ datafile = H5Fcreate(FILE41, H5F_ACC_TRUNC, H5P_DEFAULT, - H5P_DEFAULT); + H5P_DEFAULT); HDassert(datafile >= 0); /* Copy the array data type for the string array */ @@ -4919,40 +4920,40 @@ static void gent_compound_complex(void) /* Insert the arrays and variables into the structure */ status = H5Tinsert(Array1Structid, "a_name", - HOFFSET(Array1Struct, a), H5T_NATIVE_INT); + HOFFSET(Array1Struct, a), H5T_NATIVE_INT); HDassert(status >= 0); status = H5Tinsert(Array1Structid, "b_name", - HOFFSET(Array1Struct, b), str_array_id); + HOFFSET(Array1Struct, b), str_array_id); HDassert(status >= 0); status = H5Tinsert(Array1Structid, "c_name", - HOFFSET(Array1Struct, c), array1_tid); + HOFFSET(Array1Struct, c), array1_tid); HDassert(status >= 0); status = H5Tinsert(Array1Structid, "d_name", - HOFFSET(Array1Struct, d), array2_tid); + HOFFSET(Array1Struct, d), array2_tid); HDassert(status >= 0); status = H5Tinsert(Array1Structid, "e_name", - HOFFSET(Array1Struct, e), H5T_NATIVE_FLOAT); + HOFFSET(Array1Struct, e), H5T_NATIVE_FLOAT); HDassert(status >= 0); status = H5Tinsert(Array1Structid, "f_name", - HOFFSET(Array1Struct, f), array4_tid); + HOFFSET(Array1Struct, f), array4_tid); HDassert(status >= 0); status = H5Tinsert(Array1Structid, "g_name", - HOFFSET(Array1Struct, g), H5T_NATIVE_CHAR); + HOFFSET(Array1Struct, g), H5T_NATIVE_CHAR); HDassert(status >= 0); /* Create the dataset */ dataset = H5Dcreate2(datafile, F41_DATASETNAME, Array1Structid, - dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write data to the dataset */ status = H5Dwrite(dataset, Array1Structid, H5S_ALL, H5S_ALL, - H5P_DEFAULT, Array1); + H5P_DEFAULT, Array1); HDassert(status >= 0); /* Release resources */ @@ -4987,106 +4988,106 @@ static void gent_compound_complex(void) static void gent_named_dtype_attr(void) { - hid_t fid; - hid_t did; - hid_t sid; - hid_t tid; - hid_t aid; - hid_t gid; - int data=8; - herr_t ret; - - /* Create a file */ - fid=H5Fcreate(FILE42, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - HDassert(fid>0); + hid_t fid; + hid_t did; + hid_t sid; + hid_t tid; + hid_t aid; + hid_t gid; + int data=8; + herr_t ret; -/*------------------------------------------------------------------------- - * datatype - *------------------------------------------------------------------------- - */ + /* Create a file */ + fid=H5Fcreate(FILE42, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(fid>0); + + /*------------------------------------------------------------------------- + * datatype + *------------------------------------------------------------------------- + */ - /* Create a datatype to commit and use */ - tid=H5Tcopy(H5T_NATIVE_INT); - HDassert(tid>0); + /* Create a datatype to commit and use */ + tid=H5Tcopy(H5T_NATIVE_INT); + HDassert(tid>0); - /* Commit datatype to file */ - ret = H5Tcommit2(fid, F42_TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - HDassert(ret >= 0); + /* Commit datatype to file */ + ret = H5Tcommit2(fid, F42_TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + HDassert(ret >= 0); - /* Create a hard link to the datatype */ - ret = H5Lcreate_hard(fid, F42_TYPENAME, fid, F42_LINKNAME, H5P_DEFAULT, H5P_DEFAULT); - HDassert(ret >= 0); + /* Create a hard link to the datatype */ + ret = H5Lcreate_hard(fid, F42_TYPENAME, fid, F42_LINKNAME, H5P_DEFAULT, H5P_DEFAULT); + HDassert(ret >= 0); - /* Create a scalar dataspace used for all objects */ - sid = H5Screate(H5S_SCALAR); - HDassert(sid > 0); + /* Create a scalar dataspace used for all objects */ + sid = H5Screate(H5S_SCALAR); + HDassert(sid > 0); - /* Create attribute on commited datatype */ - aid = H5Acreate2(tid, F42_ATTRNAME, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT); - HDassert(aid > 0); + /* Create attribute on commited datatype */ + aid = H5Acreate2(tid, F42_ATTRNAME, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT); + HDassert(aid > 0); - /* Write data into the attribute */ - ret = H5Awrite(aid, H5T_NATIVE_INT, &data); - HDassert(ret >= 0); + /* Write data into the attribute */ + ret = H5Awrite(aid, H5T_NATIVE_INT, &data); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * dataset - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * dataset + *------------------------------------------------------------------------- + */ - /* Create dataset */ - did = H5Dcreate2(fid, F42_DSETNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - HDassert(did > 0); + /* Create dataset */ + did = H5Dcreate2(fid, F42_DSETNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + HDassert(did > 0); - /* Create attribute on dataset */ - aid = H5Acreate2(did, F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT); - HDassert(aid > 0); + /* Create attribute on dataset */ + aid = H5Acreate2(did, F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT); + HDassert(aid > 0); - /* Write data into the attribute */ - ret = H5Awrite(aid, H5T_NATIVE_INT, &data); - HDassert(ret >= 0); + /* Write data into the attribute */ + ret = H5Awrite(aid, H5T_NATIVE_INT, &data); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * group - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * group + *------------------------------------------------------------------------- + */ - /* Create a group */ - gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - HDassert(gid > 0); + /* Create a group */ + gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + HDassert(gid > 0); - /* Create attribute on group */ - aid = H5Acreate2(gid, F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT); - HDassert(aid > 0); + /* Create attribute on group */ + aid = H5Acreate2(gid, F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT); + HDassert(aid > 0); - /* Write data into the attribute */ - ret = H5Awrite(aid, H5T_NATIVE_INT, &data); - HDassert(ret >= 0); + /* Write data into the attribute */ + ret = H5Awrite(aid, H5T_NATIVE_INT, &data); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ - /* Close attribute */ - ret = H5Aclose(aid); - HDassert(ret >= 0); + /* Close attribute */ + ret = H5Aclose(aid); + HDassert(ret >= 0); - /* Close dataset */ - ret = H5Dclose(did); - HDassert(ret >= 0); + /* Close dataset */ + ret = H5Dclose(did); + HDassert(ret >= 0); - /* Close dataspace */ - ret = H5Sclose(sid); - HDassert(ret >= 0); + /* Close dataspace */ + ret = H5Sclose(sid); + HDassert(ret >= 0); - /* Close datatype */ - ret = H5Tclose(tid); - HDassert(ret >= 0); + /* Close datatype */ + ret = H5Tclose(tid); + HDassert(ret >= 0); - /* Close file */ - ret = H5Fclose(fid); - HDassert(ret >= 0); + /* Close file */ + ret = H5Fclose(fid); + HDassert(ret >= 0); } @@ -5145,7 +5146,7 @@ static void gent_zero_dim_size(void) /* dataset */ dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT); /* nothing should be written */ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf); @@ -5169,11 +5170,11 @@ static void gent_zero_dim_size(void) */ static int make_dset(hid_t loc_id, - const char *name, - hid_t sid, - hid_t tid, - hid_t dcpl, - void *buf) + const char *name, + hid_t sid, + hid_t tid, + hid_t dcpl, + void *buf) { hid_t dsid; @@ -5191,7 +5192,7 @@ int make_dset(hid_t loc_id, return 0; -out: + out: H5E_BEGIN_TRY { H5Dclose(dsid); } H5E_END_TRY; @@ -5210,38 +5211,38 @@ out: static void make_external(hid_t fid) { - hid_t dcpl; /*dataset creation property list */ - hid_t sid; /*dataspace ID */ - hid_t dsid; /*dataset ID */ - hsize_t cur_size[1]; /*data space current size */ - hsize_t max_size[1]; /*data space maximum size */ - hsize_t size; /*bytes reserved for data in the external file*/ - int ret; + hid_t dcpl; /*dataset creation property list */ + hid_t sid; /*dataspace ID */ + hid_t dsid; /*dataset ID */ + hsize_t cur_size[1]; /*data space current size */ + hsize_t max_size[1]; /*data space maximum size */ + hsize_t size; /*bytes reserved for data in the external file*/ + int ret; - cur_size[0] = max_size[0] = 100; - size = (max_size[0]*sizeof(int)/2); + cur_size[0] = max_size[0] = 100; + size = (max_size[0]*sizeof(int)/2); - dcpl = H5Pcreate(H5P_DATASET_CREATE); - ret = H5Pset_external(dcpl, "ext1.bin", (off_t)0, size); - HDassert(ret >= 0); + dcpl = H5Pcreate(H5P_DATASET_CREATE); + ret = H5Pset_external(dcpl, "ext1.bin", (off_t)0, size); + HDassert(ret >= 0); - ret = H5Pset_external(dcpl, "ext2.bin", (off_t)0, size); - HDassert(ret >= 0); + ret = H5Pset_external(dcpl, "ext2.bin", (off_t)0, size); + HDassert(ret >= 0); - sid = H5Screate_simple(1, cur_size, max_size); - HDassert(ret >= 0); + sid = H5Screate_simple(1, cur_size, max_size); + HDassert(ret >= 0); - dsid = H5Dcreate2(fid, "external", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - HDassert(ret >= 0); + dsid = H5Dcreate2(fid, "external", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + HDassert(ret >= 0); - H5Dclose(dsid); - HDassert(ret >= 0); + H5Dclose(dsid); + HDassert(ret >= 0); - H5Sclose(sid); - HDassert(ret >= 0); + H5Sclose(sid); + HDassert(ret >= 0); - H5Pclose(dcpl); - HDassert(ret >= 0); + H5Pclose(dcpl); + HDassert(ret >= 0); } /*------------------------------------------------------------------------- @@ -5253,312 +5254,312 @@ make_external(hid_t fid) */ static void gent_filters(void) { - hid_t fid; /* file id */ - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ - hid_t tid; /* datatype ID */ + hid_t fid; /* file id */ + hid_t dcpl; /* dataset creation property list */ + hid_t sid; /* dataspace ID */ + hid_t tid; /* datatype ID */ #ifdef H5_HAVE_FILTER_SZIP - unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; - unsigned szip_pixels_per_block=4; + unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; + unsigned szip_pixels_per_block=4; #endif /* H5_HAVE_FILTER_SZIP */ - hsize_t dims1[RANK] = {DIM1,DIM2}; - hsize_t chunk_dims[RANK] = {CDIM1,CDIM2}; - int buf1[DIM1][DIM2]; - int i, j, n, ret; - - for(i=n=0; i<DIM1; i++){ - for(j=0; j<DIM2; j++){ - buf1[i][j]=n++; - } - } + hsize_t dims1[RANK] = {DIM1,DIM2}; + hsize_t chunk_dims[RANK] = {CDIM1,CDIM2}; + int buf1[DIM1][DIM2]; + int i, j, n, ret; + + for(i=n=0; i<DIM1; i++){ + for(j=0; j<DIM2; j++){ + buf1[i][j]=n++; + } + } - /* create a file */ - fid = H5Fcreate(FILE44, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - HDassert(fid>=0); + /* create a file */ + fid = H5Fcreate(FILE44, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(fid>=0); - /* create a space */ - sid = H5Screate_simple(SPACE2_RANK, dims1, NULL); + /* create a space */ + sid = H5Screate_simple(SPACE2_RANK, dims1, NULL); - /* create a dataset creation property list; the same DCPL is used for all dsets */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); + /* create a dataset creation property list; the same DCPL is used for all dsets */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); -/*------------------------------------------------------------------------- - * create a compact and contiguous storage layout dataset - * add a comment to the datasets - *------------------------------------------------------------------------- - */ - ret = H5Pset_layout(dcpl, H5D_COMPACT); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * create a compact and contiguous storage layout dataset + * add a comment to the datasets + *------------------------------------------------------------------------- + */ + ret = H5Pset_layout(dcpl, H5D_COMPACT); + HDassert(ret >= 0); - ret=make_dset(fid,"compact",sid,H5T_NATIVE_INT,dcpl,buf1); - HDassert(ret >= 0); + ret=make_dset(fid,"compact",sid,H5T_NATIVE_INT,dcpl,buf1); + HDassert(ret >= 0); - ret = H5Oset_comment_by_name(fid, "compact", "This is a dataset with compact storage", H5P_DEFAULT); - HDassert(ret >= 0); + ret = H5Oset_comment_by_name(fid, "compact", "This is a dataset with compact storage", H5P_DEFAULT); + HDassert(ret >= 0); - ret = H5Pset_layout(dcpl, H5D_CONTIGUOUS); - HDassert(ret >= 0); + ret = H5Pset_layout(dcpl, H5D_CONTIGUOUS); + HDassert(ret >= 0); - ret=make_dset(fid,"contiguous",sid,H5T_NATIVE_INT,dcpl,buf1); - HDassert(ret >= 0); + ret=make_dset(fid,"contiguous",sid,H5T_NATIVE_INT,dcpl,buf1); + HDassert(ret >= 0); - ret = H5Oset_comment_by_name(fid, "contiguous", "This is a dataset with contiguous storage", H5P_DEFAULT); - HDassert(ret >= 0); + ret = H5Oset_comment_by_name(fid, "contiguous", "This is a dataset with contiguous storage", H5P_DEFAULT); + HDassert(ret >= 0); - ret = H5Pset_layout(dcpl, H5D_CHUNKED); - HDassert(ret >= 0); + ret = H5Pset_layout(dcpl, H5D_CHUNKED); + HDassert(ret >= 0); - ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); - HDassert(ret >= 0); + ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); + HDassert(ret >= 0); - ret=make_dset(fid,"chunked",sid,H5T_NATIVE_INT,dcpl,buf1); - HDassert(ret >= 0); + ret=make_dset(fid,"chunked",sid,H5T_NATIVE_INT,dcpl,buf1); + HDassert(ret >= 0); - ret = H5Oset_comment_by_name(fid, "chunked", "This is a dataset with chunked storage", H5P_DEFAULT); - HDassert(ret >= 0); + ret = H5Oset_comment_by_name(fid, "chunked", "This is a dataset with chunked storage", H5P_DEFAULT); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * make several dataset with filters - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * make several dataset with filters + *------------------------------------------------------------------------- + */ - /* set up chunk */ - ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); - HDassert(ret >= 0); + /* set up chunk */ + ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * SZIP - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * SZIP + *------------------------------------------------------------------------- + */ #ifdef H5_HAVE_FILTER_SZIP - if(h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { - /* remove the filters from the dcpl */ - ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - HDassert(ret >= 0); - - /* set szip data */ - ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block); - HDassert(ret >= 0); - - ret=make_dset(fid,"szip",sid,H5T_NATIVE_INT,dcpl,buf1); - HDassert(ret >= 0); - } + if(h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { + /* remove the filters from the dcpl */ + ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); + HDassert(ret >= 0); + + /* set szip data */ + ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block); + HDassert(ret >= 0); + + ret=make_dset(fid,"szip",sid,H5T_NATIVE_INT,dcpl,buf1); + HDassert(ret >= 0); + } #endif /* H5_HAVE_FILTER_SZIP */ -/*------------------------------------------------------------------------- - * GZIP - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * GZIP + *------------------------------------------------------------------------- + */ #if defined (H5_HAVE_FILTER_DEFLATE) - /* remove the filters from the dcpl */ - ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - HDassert(ret >= 0); + /* remove the filters from the dcpl */ + ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); + HDassert(ret >= 0); - /* set deflate data */ - ret = H5Pset_deflate(dcpl, 9); - HDassert(ret >= 0); + /* set deflate data */ + ret = H5Pset_deflate(dcpl, 9); + HDassert(ret >= 0); - ret=make_dset(fid,"deflate",sid,H5T_NATIVE_INT,dcpl,buf1); - HDassert(ret >= 0); + ret=make_dset(fid,"deflate",sid,H5T_NATIVE_INT,dcpl,buf1); + HDassert(ret >= 0); #endif -/*------------------------------------------------------------------------- - * shuffle - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * shuffle + *------------------------------------------------------------------------- + */ #if defined (H5_HAVE_FILTER_SHUFFLE) - /* remove the filters from the dcpl */ - ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - HDassert(ret >= 0); + /* remove the filters from the dcpl */ + ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); + HDassert(ret >= 0); - /* set the shuffle filter */ - ret = H5Pset_shuffle(dcpl); - HDassert(ret >= 0); + /* set the shuffle filter */ + ret = H5Pset_shuffle(dcpl); + HDassert(ret >= 0); - ret=make_dset(fid,"shuffle",sid,H5T_NATIVE_INT,dcpl,buf1); - HDassert(ret >= 0); + ret=make_dset(fid,"shuffle",sid,H5T_NATIVE_INT,dcpl,buf1); + HDassert(ret >= 0); #endif -/*------------------------------------------------------------------------- - * checksum - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * checksum + *------------------------------------------------------------------------- + */ #if defined (H5_HAVE_FILTER_FLETCHER32) - /* remove the filters from the dcpl */ - ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - HDassert(ret >= 0); + /* remove the filters from the dcpl */ + ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); + HDassert(ret >= 0); - /* set the checksum filter */ - ret = H5Pset_fletcher32(dcpl); - HDassert(ret >= 0); + /* set the checksum filter */ + ret = H5Pset_fletcher32(dcpl); + HDassert(ret >= 0); - ret=make_dset(fid,"fletcher32",sid,H5T_NATIVE_INT,dcpl,buf1); - HDassert(ret >= 0); + ret=make_dset(fid,"fletcher32",sid,H5T_NATIVE_INT,dcpl,buf1); + HDassert(ret >= 0); #endif -/*------------------------------------------------------------------------- - * nbit - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * nbit + *------------------------------------------------------------------------- + */ #if defined (H5_HAVE_FILTER_NBIT) - /* remove the filters from the dcpl */ - ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - HDassert(ret >= 0); - - /* set the checksum filter */ - ret = H5Pset_nbit(dcpl); - HDassert(ret >= 0); - - tid=H5Tcopy(H5T_NATIVE_INT); - H5Tset_precision(tid,H5Tget_size(tid)-1); - ret=make_dset(fid,"nbit",sid,tid,dcpl,buf1); - HDassert(ret >= 0); + /* remove the filters from the dcpl */ + ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); + HDassert(ret >= 0); + + /* set the checksum filter */ + ret = H5Pset_nbit(dcpl); + HDassert(ret >= 0); + + tid=H5Tcopy(H5T_NATIVE_INT); + H5Tset_precision(tid,H5Tget_size(tid)-1); + ret=make_dset(fid,"nbit",sid,tid,dcpl,buf1); + HDassert(ret >= 0); #endif -/*------------------------------------------------------------------------- - * scaleoffset - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * scaleoffset + *------------------------------------------------------------------------- + */ #if defined (H5_HAVE_FILTER_SCALEOFFSET) - /* remove the filters from the dcpl */ - ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - HDassert(ret >= 0); + /* remove the filters from the dcpl */ + ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); + HDassert(ret >= 0); - /* set the scaleoffset filter */ - ret = H5Pset_scaleoffset(dcpl,H5Z_SO_INT,(int)H5Tget_size(H5T_NATIVE_INT)); - HDassert(ret >= 0); + /* set the scaleoffset filter */ + ret = H5Pset_scaleoffset(dcpl,H5Z_SO_INT,(int)H5Tget_size(H5T_NATIVE_INT)); + HDassert(ret >= 0); - ret=make_dset(fid,"scaleoffset",sid,H5T_NATIVE_INT,dcpl,buf1); - HDassert(ret >= 0); + ret=make_dset(fid,"scaleoffset",sid,H5T_NATIVE_INT,dcpl,buf1); + HDassert(ret >= 0); #endif -/*------------------------------------------------------------------------- - * all filters - *------------------------------------------------------------------------- - */ - /* remove the filters from the dcpl */ - ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * all filters + *------------------------------------------------------------------------- + */ + /* remove the filters from the dcpl */ + ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); + HDassert(ret >= 0); #if defined (H5_HAVE_FILTER_SHUFFLE) - /* set the shuffle filter */ - ret = H5Pset_shuffle(dcpl); - HDassert(ret >= 0); + /* set the shuffle filter */ + ret = H5Pset_shuffle(dcpl); + HDassert(ret >= 0); #endif #ifdef H5_HAVE_FILTER_SZIP - if(h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { - szip_options_mask=H5_SZIP_CHIP_OPTION_MASK | H5_SZIP_EC_OPTION_MASK; - /* set szip data */ - ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block); - HDassert(ret >= 0); - } + if(h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { + szip_options_mask=H5_SZIP_CHIP_OPTION_MASK | H5_SZIP_EC_OPTION_MASK; + /* set szip data */ + ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block); + HDassert(ret >= 0); + } #endif /* H5_HAVE_FILTER_SZIP */ #if defined (H5_HAVE_FILTER_DEFLATE) - /* set deflate data */ - ret = H5Pset_deflate(dcpl, 5); - HDassert(ret >= 0); + /* set deflate data */ + ret = H5Pset_deflate(dcpl, 5); + HDassert(ret >= 0); #endif #if defined (H5_HAVE_FILTER_FLETCHER32) - /* set the checksum filter */ - ret = H5Pset_fletcher32(dcpl); - HDassert(ret >= 0); + /* set the checksum filter */ + ret = H5Pset_fletcher32(dcpl); + HDassert(ret >= 0); #endif #if defined (H5_HAVE_FILTER_NBIT) - /* set the nbit filter */ - ret = H5Pset_nbit(dcpl); - HDassert(ret >= 0); + /* set the nbit filter */ + ret = H5Pset_nbit(dcpl); + HDassert(ret >= 0); #endif - ret=make_dset(fid,"all",sid,H5T_NATIVE_INT,dcpl,buf1); - HDassert(ret >= 0); + ret=make_dset(fid,"all",sid,H5T_NATIVE_INT,dcpl,buf1); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * user defined filter - *------------------------------------------------------------------------- - */ - /* remove the filters from the dcpl */ - ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * user defined filter + *------------------------------------------------------------------------- + */ + /* remove the filters from the dcpl */ + ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); + HDassert(ret >= 0); - ret = H5Zregister (H5Z_MYFILTER); - HDassert(ret >= 0); + ret = H5Zregister (H5Z_MYFILTER); + HDassert(ret >= 0); - ret = H5Pset_filter (dcpl, MYFILTER_ID, 0, 0, NULL); - HDassert(ret >= 0); + ret = H5Pset_filter (dcpl, MYFILTER_ID, 0, 0, NULL); + HDassert(ret >= 0); - ret=make_dset(fid,"myfilter",sid,H5T_NATIVE_INT,dcpl,buf1); - HDassert(ret >= 0); + ret=make_dset(fid,"myfilter",sid,H5T_NATIVE_INT,dcpl,buf1); + HDassert(ret >= 0); - /* remove the filters from the dcpl */ - ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - HDassert(ret >= 0); + /* remove the filters from the dcpl */ + ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * make an external dataset - *------------------------------------------------------------------------- - */ - make_external(fid); + /*------------------------------------------------------------------------- + * make an external dataset + *------------------------------------------------------------------------- + */ + make_external(fid); -/*------------------------------------------------------------------------- - * H5D_ALLOC_TIME_EARLY - *------------------------------------------------------------------------- - */ - ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY); - HDassert(ret >= 0); - ret=make_dset(fid,"alloc_time_early",sid,H5T_NATIVE_INT,dcpl,buf1); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * H5D_ALLOC_TIME_EARLY + *------------------------------------------------------------------------- + */ + ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY); + HDassert(ret >= 0); + ret=make_dset(fid,"alloc_time_early",sid,H5T_NATIVE_INT,dcpl,buf1); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * H5D_ALLOC_TIME_INCR - *------------------------------------------------------------------------- - */ - ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR); - HDassert(ret >= 0); - ret=make_dset(fid,"alloc_time_incr",sid,H5T_NATIVE_INT,dcpl,buf1); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * H5D_ALLOC_TIME_INCR + *------------------------------------------------------------------------- + */ + ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR); + HDassert(ret >= 0); + ret=make_dset(fid,"alloc_time_incr",sid,H5T_NATIVE_INT,dcpl,buf1); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * H5D_ALLOC_TIME_LATE - *------------------------------------------------------------------------- - */ - ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE); - HDassert(ret >= 0); - ret=make_dset(fid,"alloc_time_late",sid,H5T_NATIVE_INT,dcpl,buf1); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * H5D_ALLOC_TIME_LATE + *------------------------------------------------------------------------- + */ + ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE); + HDassert(ret >= 0); + ret=make_dset(fid,"alloc_time_late",sid,H5T_NATIVE_INT,dcpl,buf1); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * commit a H5G_TYPE type with a comment - *------------------------------------------------------------------------- - */ - tid = H5Tcopy(H5T_STD_B8LE); - ret = H5Tcommit2(fid, "mytype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * commit a H5G_TYPE type with a comment + *------------------------------------------------------------------------- + */ + tid = H5Tcopy(H5T_STD_B8LE); + ret = H5Tcommit2(fid, "mytype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + HDassert(ret >= 0); - ret = H5Oset_comment_by_name(fid, "mytype", "This is a commited datatype", H5P_DEFAULT); - HDassert(ret >= 0); + ret = H5Oset_comment_by_name(fid, "mytype", "This is a commited datatype", H5P_DEFAULT); + HDassert(ret >= 0); - ret = H5Tclose(tid); - HDassert(ret >= 0); + ret = H5Tclose(tid); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - ret = H5Sclose(sid); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + ret = H5Sclose(sid); + HDassert(ret >= 0); - ret = H5Pclose(dcpl); - HDassert(ret >= 0); + ret = H5Pclose(dcpl); + HDassert(ret >= 0); - ret = H5Fclose(fid); - HDassert(ret >= 0); + ret = H5Fclose(fid); + HDassert(ret >= 0); } @@ -5571,10 +5572,10 @@ static void gent_filters(void) */ static size_t myfilter(unsigned int UNUSED flags, size_t UNUSED cd_nelmts, - const unsigned int UNUSED *cd_values, size_t nbytes, - size_t UNUSED *buf_size, void UNUSED **buf) + const unsigned int UNUSED *cd_values, size_t nbytes, + size_t UNUSED *buf_size, void UNUSED **buf) { - return nbytes; + return nbytes; } @@ -5589,21 +5590,21 @@ myfilter(unsigned int UNUSED flags, size_t UNUSED cd_nelmts, static herr_t set_local_myfilter(hid_t dcpl_id, hid_t UNUSED tid, hid_t UNUSED sid) { - unsigned flags; /* Filter flags */ - size_t cd_nelmts = 0; /* Number of filter parameters */ - unsigned cd_values[2] = {5, 6}; /* Filter parameters */ + unsigned flags; /* Filter flags */ + size_t cd_nelmts = 0; /* Number of filter parameters */ + unsigned cd_values[2] = {5, 6}; /* Filter parameters */ - /* Get the filter's current parameters */ - if(H5Pget_filter_by_id2(dcpl_id, MYFILTER_ID, &flags, &cd_nelmts, cd_values, 0, NULL, NULL) < 0) - return(FAIL); + /* Get the filter's current parameters */ + if(H5Pget_filter_by_id2(dcpl_id, MYFILTER_ID, &flags, &cd_nelmts, cd_values, 0, NULL, NULL) < 0) + return(FAIL); - cd_nelmts = 2; + cd_nelmts = 2; - /* Modify the filter's parameters for this dataset */ - if(H5Pmodify_filter(dcpl_id, MYFILTER_ID, flags, cd_nelmts, cd_values) < 0) - return(FAIL); + /* Modify the filter's parameters for this dataset */ + if(H5Pmodify_filter(dcpl_id, MYFILTER_ID, flags, cd_nelmts, cd_values) < 0) + return(FAIL); - return(SUCCEED); + return(SUCCEED); } /*------------------------------------------------------------------------- @@ -5632,9 +5633,9 @@ static void gent_fcontents(void) /*------------------------------------------------------------------------- - * links - *------------------------------------------------------------------------- - */ + * links + *------------------------------------------------------------------------- + */ /* hard link to "dset" */ @@ -5683,9 +5684,9 @@ static void gent_fcontents(void) HDassert(ret >= 0); /*------------------------------------------------------------------------- - * datatypes - *------------------------------------------------------------------------- - */ + * datatypes + *------------------------------------------------------------------------- + */ tid = H5Tcopy(H5T_NATIVE_INT); ret = H5Tcommit2(fid, "mytype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); HDassert(ret >= 0); @@ -5705,9 +5706,9 @@ static void gent_fcontents(void) /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ + * close + *------------------------------------------------------------------------- + */ ret = H5Fclose(fid); @@ -5732,152 +5733,152 @@ static void gent_fcontents(void) */ static void gent_fvalues(void) { - /* compound datatype */ - typedef struct c_t - { - char a; - double b; - } c_t; - - - hid_t fid; /* file id */ - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ - hid_t tid; /* datatype ID */ - hid_t did; /* datasetID */ - hsize_t dims[1]={2}; - int buf[2]={1,2}; /* integer */ - int fillval1=-99; /* integer fill value */ - c_t buf2[2]={{1,2},{3,4}}; /* compound */ - c_t fillval2[1]={{1,2}}; /* compound fill value */ - hvl_t buf3[2]; /* vlen */ - hvl_t fillval3; /* vlen fill value */ - hsize_t dimarray[1]={3}; /* array dimension */ - int buf4[2][3]= {{1,2,3},{4,5,6}}; /* array */ - int ret; - - /* create a file */ - fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - HDassert(fid>=0); - - /* create a space */ - sid = H5Screate_simple(1, dims, NULL); - - /* create a dataset creation property list */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); + /* compound datatype */ + typedef struct c_t + { + char a; + double b; + } c_t; + + + hid_t fid; /* file id */ + hid_t dcpl; /* dataset creation property list */ + hid_t sid; /* dataspace ID */ + hid_t tid; /* datatype ID */ + hid_t did; /* datasetID */ + hsize_t dims[1]={2}; + int buf[2]={1,2}; /* integer */ + int fillval1=-99; /* integer fill value */ + c_t buf2[2]={{1,2},{3,4}}; /* compound */ + c_t fillval2[1]={{1,2}}; /* compound fill value */ + hvl_t buf3[2]; /* vlen */ + hvl_t fillval3; /* vlen fill value */ + hsize_t dimarray[1]={3}; /* array dimension */ + int buf4[2][3]= {{1,2,3},{4,5,6}}; /* array */ + int ret; -/*------------------------------------------------------------------------- - * make datasets with fill value combinations - * H5D_FILL_TIME_IFSET - *------------------------------------------------------------------------- - */ - ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET); - HDassert(ret >= 0); + /* create a file */ + fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(fid>=0); - ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1); - HDassert(ret >= 0); + /* create a space */ + sid = H5Screate_simple(1, dims, NULL); - ret=make_dset(fid,"fill_time_ifset",sid,H5T_NATIVE_INT,dcpl,buf); - HDassert(ret >= 0); + /* create a dataset creation property list */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); -/*------------------------------------------------------------------------- - * H5D_FILL_TIME_NEVER - *------------------------------------------------------------------------- - */ - ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * make datasets with fill value combinations + * H5D_FILL_TIME_IFSET + *------------------------------------------------------------------------- + */ + ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET); + HDassert(ret >= 0); - ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1); - HDassert(ret >= 0); + ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1); + HDassert(ret >= 0); - ret=make_dset(fid,"fill_time_never",sid,H5T_NATIVE_INT,dcpl,buf); - HDassert(ret >= 0); + ret=make_dset(fid,"fill_time_ifset",sid,H5T_NATIVE_INT,dcpl,buf); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * H5D_FILL_TIME_ALLOC - *------------------------------------------------------------------------- - */ - ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * H5D_FILL_TIME_NEVER + *------------------------------------------------------------------------- + */ + ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER); + HDassert(ret >= 0); - ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1); - HDassert(ret >= 0); + ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1); + HDassert(ret >= 0); - ret=make_dset(fid,"fill_time_alloc",sid,H5T_NATIVE_INT,dcpl,buf); - HDassert(ret >= 0); + ret=make_dset(fid,"fill_time_never",sid,H5T_NATIVE_INT,dcpl,buf); + HDassert(ret >= 0); - ret = H5Pclose(dcpl); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * H5D_FILL_TIME_ALLOC + *------------------------------------------------------------------------- + */ + ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * dataset with no fill value - *------------------------------------------------------------------------- - */ - write_dset(fid,1,dims,"no_fill",H5T_NATIVE_INT,buf); + ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * dataset with a H5T_COMPOUND fill value - *------------------------------------------------------------------------- - */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - tid = H5Tcreate (H5T_COMPOUND, sizeof(c_t)); - H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_CHAR); - H5Tinsert(tid, "b", HOFFSET(c_t, b), H5T_NATIVE_DOUBLE); - ret = H5Pset_fill_value(dcpl, tid, &fillval2); - HDassert(ret >= 0); - ret=make_dset(fid,"fill_compound",sid,tid,dcpl,buf2); - HDassert(ret >= 0); - ret = H5Tclose(tid); - HDassert(ret >= 0); - ret = H5Pclose(dcpl); - HDassert(ret >= 0); + ret=make_dset(fid,"fill_time_alloc",sid,H5T_NATIVE_INT,dcpl,buf); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * dataset with a H5T_VLEN fill value - *------------------------------------------------------------------------- - */ - buf3[0].len = 1; - buf3[0].p = HDmalloc( 1 * sizeof(int)); - ((int *)buf3[0].p)[0]=1; - buf3[1].len = 2; - buf3[1].p = HDmalloc(2 * sizeof(int)); - ((int *)buf3[1].p)[0] = 2; - ((int *)buf3[1].p)[1] = 3; - - tid = H5Tvlen_create(H5T_NATIVE_INT); - dcpl = H5Pcreate(H5P_DATASET_CREATE); - - fillval3.p=NULL; fillval3.len=0; - ret = H5Pset_fill_value(dcpl, tid, &fillval3); - HDassert(ret >= 0); - - did = H5Dcreate2(fid, "fill_vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - ret = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf3); - HDassert(ret >= 0); - ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf3); - HDassert(ret >= 0); - ret = H5Dclose(did); - ret = H5Tclose(tid); - ret = H5Pclose(dcpl); - HDassert(ret >= 0); + ret = H5Pclose(dcpl); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * dataset with a H5T_ARRAY fill value - *------------------------------------------------------------------------- - */ - tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); - write_dset(fid, 1, dims, "fill_array", tid, buf4); - ret = H5Tclose(tid); + /*------------------------------------------------------------------------- + * dataset with no fill value + *------------------------------------------------------------------------- + */ + write_dset(fid,1,dims,"no_fill",H5T_NATIVE_INT,buf); + /*------------------------------------------------------------------------- + * dataset with a H5T_COMPOUND fill value + *------------------------------------------------------------------------- + */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + tid = H5Tcreate (H5T_COMPOUND, sizeof(c_t)); + H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_CHAR); + H5Tinsert(tid, "b", HOFFSET(c_t, b), H5T_NATIVE_DOUBLE); + ret = H5Pset_fill_value(dcpl, tid, &fillval2); + HDassert(ret >= 0); + ret=make_dset(fid,"fill_compound",sid,tid,dcpl,buf2); + HDassert(ret >= 0); + ret = H5Tclose(tid); + HDassert(ret >= 0); + ret = H5Pclose(dcpl); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - ret = H5Sclose(sid); - HDassert(ret >= 0); - ret = H5Fclose(fid); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * dataset with a H5T_VLEN fill value + *------------------------------------------------------------------------- + */ + buf3[0].len = 1; + buf3[0].p = HDmalloc( 1 * sizeof(int)); + ((int *)buf3[0].p)[0]=1; + buf3[1].len = 2; + buf3[1].p = HDmalloc(2 * sizeof(int)); + ((int *)buf3[1].p)[0] = 2; + ((int *)buf3[1].p)[1] = 3; + + tid = H5Tvlen_create(H5T_NATIVE_INT); + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + fillval3.p=NULL; fillval3.len=0; + ret = H5Pset_fill_value(dcpl, tid, &fillval3); + HDassert(ret >= 0); + + did = H5Dcreate2(fid, "fill_vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + ret = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf3); + HDassert(ret >= 0); + ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf3); + HDassert(ret >= 0); + ret = H5Dclose(did); + ret = H5Tclose(tid); + ret = H5Pclose(dcpl); + HDassert(ret >= 0); + + /*------------------------------------------------------------------------- + * dataset with a H5T_ARRAY fill value + *------------------------------------------------------------------------- + */ + tid = H5Tarray_create2(H5T_NATIVE_INT, 1, dimarray); + write_dset(fid, 1, dims, "fill_array", tid, buf4); + ret = H5Tclose(tid); + + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + ret = H5Sclose(sid); + HDassert(ret >= 0); + ret = H5Fclose(fid); + HDassert(ret >= 0); } @@ -5890,103 +5891,103 @@ static void gent_fvalues(void) */ static void gent_string(void) { - /* compound datatype */ - typedef struct c_t - { - int a; - char str[255]; - } c_t; - - hid_t fid; /* file id */ - hid_t sid; /* dataspace ID */ - hid_t tid; /* datatype ID */ - hid_t str_tid; /* datatype ID */ - hid_t did; /* dataset ID */ - char buf1[]={"quote \" backspace\b form feed\f new line\n tab\t new line\n carriage return\r"}; - const char *buf2[SPACE1_DIM1]= { - "Four score and seven\n years ago our forefathers brought forth on this continent a new nation,", - "conceived in liberty\n and dedicated to the proposition that all men are created equal.", - "Now we are engaged\n in a great civil war,", - "testing whether that\n nation or any nation so conceived and so dedicated can long endure." - }; - c_t buf3 = {24, "Four score and seven\n years ago our forefathers brought forth on this continent a new nation"}; - char buf4[] = {"Four score and seven\n years ago our forefathers brought forth on this continent a new nation"}; - hsize_t dims1[] = {1}; - hsize_t dims2[] = {SPACE1_DIM1}; - hsize_t dims4[1]; - int ret; - - dims4[0] = sizeof(buf4); - - /* create a file */ - fid = H5Fcreate(FILE49, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - HDassert(fid>=0); + /* compound datatype */ + typedef struct c_t + { + int a; + char str[255]; + } c_t; + + hid_t fid; /* file id */ + hid_t sid; /* dataspace ID */ + hid_t tid; /* datatype ID */ + hid_t str_tid; /* datatype ID */ + hid_t did; /* dataset ID */ + char buf1[]={"quote \" backspace\b form feed\f new line\n tab\t new line\n carriage return\r"}; + const char *buf2[SPACE1_DIM1]= { + "Four score and seven\n years ago our forefathers brought forth on this continent a new nation,", + "conceived in liberty\n and dedicated to the proposition that all men are created equal.", + "Now we are engaged\n in a great civil war,", + "testing whether that\n nation or any nation so conceived and so dedicated can long endure." + }; + c_t buf3 = {24, "Four score and seven\n years ago our forefathers brought forth on this continent a new nation"}; + char buf4[] = {"Four score and seven\n years ago our forefathers brought forth on this continent a new nation"}; + hsize_t dims1[] = {1}; + hsize_t dims2[] = {SPACE1_DIM1}; + hsize_t dims4[1]; + int ret; -/*------------------------------------------------------------------------- - * str1 - *------------------------------------------------------------------------- - */ + dims4[0] = sizeof(buf4); - tid=H5Tcopy(H5T_C_S1); - ret = H5Tset_size(tid, sizeof(buf1)); - HDassert(ret >= 0); - write_dset(fid,1,dims1,"str1",tid,buf1); - HDassert(ret >= 0); - ret = H5Tclose(tid); - HDassert(ret >= 0); + /* create a file */ + fid = H5Fcreate(FILE49, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + HDassert(fid>=0); -/*------------------------------------------------------------------------- - * str2 - *------------------------------------------------------------------------- - */ - sid = H5Screate_simple(SPACE1_RANK, dims2, NULL); - tid = H5Tcopy(H5T_C_S1); - ret = H5Tset_size(tid, H5T_VARIABLE); - HDassert(ret >= 0); - did = H5Dcreate2(fid, "str2", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - ret = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); - HDassert(ret >= 0); - ret = H5Tclose(tid); - HDassert(ret >= 0); - ret = H5Dclose(did); - HDassert(ret >= 0); - ret = H5Sclose(sid); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * str1 + *------------------------------------------------------------------------- + */ -/*------------------------------------------------------------------------- - * str3 - *------------------------------------------------------------------------- - */ - sid = H5Screate_simple(SPACE1_RANK, dims1, NULL); - tid = H5Tcreate (H5T_COMPOUND, sizeof(c_t)); - str_tid = H5Tcopy( H5T_C_S1 ); - H5Tset_size( str_tid, 255 ); - H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_INT); - H5Tinsert(tid, "str", HOFFSET(c_t, str), str_tid ); - ret=make_dset(fid,"str3",sid,tid,H5P_DEFAULT,&buf3); - HDassert(ret >= 0); - ret = H5Tclose(tid); - HDassert(ret >= 0); - ret = H5Tclose(str_tid); - HDassert(ret >= 0); - ret = H5Sclose(sid); - HDassert(ret >= 0); + tid=H5Tcopy(H5T_C_S1); + ret = H5Tset_size(tid, sizeof(buf1)); + HDassert(ret >= 0); + write_dset(fid,1,dims1,"str1",tid,buf1); + HDassert(ret >= 0); + ret = H5Tclose(tid); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * str4 - *------------------------------------------------------------------------- - */ - sid = H5Screate_simple(SPACE1_RANK, dims4, NULL); - ret=make_dset(fid,"str4",sid,H5T_NATIVE_CHAR,H5P_DEFAULT,buf4); - ret = H5Sclose(sid); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * str2 + *------------------------------------------------------------------------- + */ + sid = H5Screate_simple(SPACE1_RANK, dims2, NULL); + tid = H5Tcopy(H5T_C_S1); + ret = H5Tset_size(tid, H5T_VARIABLE); + HDassert(ret >= 0); + did = H5Dcreate2(fid, "str2", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + ret = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); + HDassert(ret >= 0); + ret = H5Tclose(tid); + HDassert(ret >= 0); + ret = H5Dclose(did); + HDassert(ret >= 0); + ret = H5Sclose(sid); + HDassert(ret >= 0); -/*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - ret = H5Fclose(fid); - HDassert(ret >= 0); + /*------------------------------------------------------------------------- + * str3 + *------------------------------------------------------------------------- + */ + sid = H5Screate_simple(SPACE1_RANK, dims1, NULL); + tid = H5Tcreate (H5T_COMPOUND, sizeof(c_t)); + str_tid = H5Tcopy( H5T_C_S1 ); + H5Tset_size( str_tid, 255 ); + H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_INT); + H5Tinsert(tid, "str", HOFFSET(c_t, str), str_tid ); + ret=make_dset(fid,"str3",sid,tid,H5P_DEFAULT,&buf3); + HDassert(ret >= 0); + ret = H5Tclose(tid); + HDassert(ret >= 0); + ret = H5Tclose(str_tid); + HDassert(ret >= 0); + ret = H5Sclose(sid); + HDassert(ret >= 0); + + /*------------------------------------------------------------------------- + * str4 + *------------------------------------------------------------------------- + */ + sid = H5Screate_simple(SPACE1_RANK, dims4, NULL); + ret=make_dset(fid,"str4",sid,H5T_NATIVE_CHAR,H5P_DEFAULT,buf4); + ret = H5Sclose(sid); + HDassert(ret >= 0); + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + ret = H5Fclose(fid); + HDassert(ret >= 0); } @@ -6032,18 +6033,18 @@ static void gent_aindices(void) HDassert(fid>=0); /*------------------------------------------------------------------------- - * root datasets - *------------------------------------------------------------------------- - */ + * root datasets + *------------------------------------------------------------------------- + */ write_dset(fid,1,dims1,"1d",H5T_NATIVE_INT,buf1); write_dset(fid,2,dims2,"2d",H5T_NATIVE_INT,buf2); write_dset(fid,3,dims3,"3d",H5T_NATIVE_INT,buf3); write_dset(fid,4,dims4,"4d",H5T_NATIVE_INT,buf4); /*------------------------------------------------------------------------- - * test with group indentation - *------------------------------------------------------------------------- - */ + * test with group indentation + *------------------------------------------------------------------------- + */ gid[0] = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); gid[1] = H5Gcreate2(fid, "g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); gid[2] = H5Gcreate2(fid, "g1/g2/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -6058,9 +6059,9 @@ static void gent_aindices(void) H5Gclose(gid[i]); /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ + * close + *------------------------------------------------------------------------- + */ ret = H5Fclose(fid); HDassert(ret >= 0); @@ -6126,45 +6127,45 @@ static void gent_longlinks(void) */ static int gent_ldouble(void) { - hid_t fid; - hid_t did; - hid_t tid; - hid_t sid; - hsize_t dims[1] = {3}; - long double buf[3] = {1,2,3}; + hid_t fid; + hid_t did; + hid_t tid; + hid_t sid; + hsize_t dims[1] = {3}; + long double buf[3] = {1,2,3}; - if((fid = H5Fcreate(FILE52, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + if((fid = H5Fcreate(FILE52, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; - if((sid = H5Screate_simple(1, dims, NULL)) < 0) - goto error; + if((sid = H5Screate_simple(1, dims, NULL)) < 0) + goto error; - if((tid = H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) - goto error; + if((tid = H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) + goto error; - if(H5Tget_size(tid) == 0) - goto error; + if(H5Tget_size(tid) == 0) + goto error; - if((did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + if((did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; - if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto error; + if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + goto error; - if(H5Sclose(sid) < 0) - goto error; - if(H5Tclose(tid) < 0) - goto error; - if(H5Dclose(did) < 0) - goto error; - if(H5Fclose(fid) < 0) - goto error; + if(H5Sclose(sid) < 0) + goto error; + if(H5Tclose(tid) < 0) + goto error; + if(H5Dclose(did) < 0) + goto error; + if(H5Fclose(fid) < 0) + goto error; - return 0; + return 0; -error: - printf("error !\n"); - return -1; + error: + printf("error !\n"); + return -1; } @@ -6183,48 +6184,48 @@ error: static void gent_binary(void) { - hid_t fid, sid, did, aid; - hsize_t dims[1] = {6}; - int ibuf[6] = {1,2,3,4,5,6}; - float fbuf[6] = {1,2,3,4,5,6}; - double dbuf[6] = {1,2,3,4,5,6}; + hid_t fid, sid, did, aid; + hsize_t dims[1] = {6}; + int ibuf[6] = {1,2,3,4,5,6}; + float fbuf[6] = {1,2,3,4,5,6}; + double dbuf[6] = {1,2,3,4,5,6}; - fid = H5Fcreate(FILE55, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - sid = H5Screate_simple(1, dims, NULL); + fid = H5Fcreate(FILE55, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + sid = H5Screate_simple(1, dims, NULL); -/*------------------------------------------------------------------------- - * integer - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * integer + *------------------------------------------------------------------------- + */ - did = H5Dcreate2(fid, "integer", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf); - H5Dclose(did); + did = H5Dcreate2(fid, "integer", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf); + H5Dclose(did); -/*------------------------------------------------------------------------- - * float - *------------------------------------------------------------------------- - */ - did = H5Dcreate2(fid, "float", H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbuf); - H5Dclose(did); + /*------------------------------------------------------------------------- + * float + *------------------------------------------------------------------------- + */ + did = H5Dcreate2(fid, "float", H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbuf); + H5Dclose(did); -/*------------------------------------------------------------------------- - * double - *------------------------------------------------------------------------- - */ - did = H5Dcreate2(fid, "double", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf); - /* create an attribute */ - aid = H5Acreate2(did, "attr", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT); - H5Aclose(aid); - H5Dclose(did); + /*------------------------------------------------------------------------- + * double + *------------------------------------------------------------------------- + */ + did = H5Dcreate2(fid, "double", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf); + /* create an attribute */ + aid = H5Acreate2(did, "attr", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT); + H5Aclose(aid); + H5Dclose(did); - /* close */ - H5Sclose(sid); - H5Fclose(fid); + /* close */ + H5Sclose(sid); + H5Fclose(fid); } /*------------------------------------------------------------------------- @@ -6325,7 +6326,7 @@ gent_bigdims(void) return; -out: + out: printf("Error.....\n"); H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -6401,10 +6402,10 @@ gent_group_creation_order(void) if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) goto out; -/*------------------------------------------------------------------------- - * create a group "2" - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create a group "2" + *------------------------------------------------------------------------- + */ if((gid = H5Gcreate2(fid, "2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) @@ -6440,7 +6441,7 @@ gent_group_creation_order(void) goto out; gid = -1; - if((gid = H5Gcreate2(fid, "2/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "2/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; @@ -6452,10 +6453,10 @@ gent_group_creation_order(void) gid = -1; -/*------------------------------------------------------------------------- - * create a group "1" with H5P_CRT_ORDER_TRACKED set - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create a group "1" with H5P_CRT_ORDER_TRACKED set + *------------------------------------------------------------------------- + */ if(H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0) goto out; @@ -6493,7 +6494,7 @@ gent_group_creation_order(void) goto out; gid = -1; - if((gid = H5Gcreate2(fid, "1/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "1/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; @@ -6517,7 +6518,7 @@ gent_group_creation_order(void) return; -out: + out: printf("Error.....\n"); H5E_BEGIN_TRY { H5Gclose(gid); @@ -6584,10 +6585,10 @@ gent_attr_creation_order(void) if((sid = H5Screate(H5S_SCALAR)) < 0) goto out; -/*------------------------------------------------------------------------- - * create a dataset with creation order tracked for attributes and atributes in it - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create a dataset with creation order tracked for attributes and atributes in it + *------------------------------------------------------------------------- + */ /* create a dataset */ if((did = H5Dcreate2(fid, "dt", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) @@ -6610,10 +6611,10 @@ gent_attr_creation_order(void) did = -1; -/*------------------------------------------------------------------------- - * create a dataset without creation order tracked for attributes and atributes in it - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create a dataset without creation order tracked for attributes and atributes in it + *------------------------------------------------------------------------- + */ /* create a dataset */ if((did = H5Dcreate2(fid, "d", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -6637,10 +6638,10 @@ gent_attr_creation_order(void) -/*------------------------------------------------------------------------- - * create a group with creation order tracked for attributes and atributes in it - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create a group with creation order tracked for attributes and atributes in it + *------------------------------------------------------------------------- + */ if((gid = H5Gcreate2(fid, "gt", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; @@ -6661,10 +6662,10 @@ gent_attr_creation_order(void) goto out; gid = -1; -/*------------------------------------------------------------------------- - * create a group without creation order tracked for attributes and atributes in it - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create a group without creation order tracked for attributes and atributes in it + *------------------------------------------------------------------------- + */ if((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; @@ -6685,10 +6686,10 @@ gent_attr_creation_order(void) goto out; gid = -1; -/*------------------------------------------------------------------------- - * create a named datatype with creation order tracked for attributes and atributes in it - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create a named datatype with creation order tracked for attributes and atributes in it + *------------------------------------------------------------------------- + */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) goto out; @@ -6712,10 +6713,10 @@ gent_attr_creation_order(void) goto out; tid = -1; -/*------------------------------------------------------------------------- - * create a named datatype without creation order tracked for attributes and atributes in it - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create a named datatype without creation order tracked for attributes and atributes in it + *------------------------------------------------------------------------- + */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) goto out; @@ -6739,10 +6740,10 @@ gent_attr_creation_order(void) goto out; tid = -1; -/*------------------------------------------------------------------------- - * add some attributes to the root group - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * add some attributes to the root group + *------------------------------------------------------------------------- + */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) goto out; @@ -6762,10 +6763,10 @@ gent_attr_creation_order(void) goto out; gid = -1; -/*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ if(H5Sclose(sid) < 0) goto out; sid = -1; @@ -6786,7 +6787,7 @@ gent_attr_creation_order(void) return; -out: + out: printf("Error.....\n"); H5E_BEGIN_TRY { H5Gclose(gid); @@ -6815,35 +6816,35 @@ out: static void gent_fpformat(void) { - hid_t fid, sid, did; - hsize_t dims[1] = {6}; - double dbuf[6] = {-0.1234567, 0.1234567, 0, 0, 0, 0}; - float fbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0}; + hid_t fid, sid, did; + hsize_t dims[1] = {6}; + double dbuf[6] = {-0.1234567, 0.1234567, 0, 0, 0, 0}; + float fbuf[6] = {-0.1234567f, 0.1234567f, 0, 0, 0, 0}; - fid = H5Fcreate(FILE60, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - sid = H5Screate_simple(1, dims, NULL); + fid = H5Fcreate(FILE60, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + sid = H5Screate_simple(1, dims, NULL); -/*------------------------------------------------------------------------- - * double - *------------------------------------------------------------------------- - */ - did = H5Dcreate2(fid, "double", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf); - H5Dclose(did); + /*------------------------------------------------------------------------- + * double + *------------------------------------------------------------------------- + */ + did = H5Dcreate2(fid, "double", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf); + H5Dclose(did); -/*------------------------------------------------------------------------- - * float - *------------------------------------------------------------------------- - */ - did = H5Dcreate2(fid, "float", H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbuf); - H5Dclose(did); + /*------------------------------------------------------------------------- + * float + *------------------------------------------------------------------------- + */ + did = H5Dcreate2(fid, "float", H5T_NATIVE_FLOAT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbuf); + H5Dclose(did); - /* close */ - H5Sclose(sid); - H5Fclose(fid); + /* close */ + H5Sclose(sid); + H5Fclose(fid); } /*------------------------------------------------------------------------- @@ -6858,75 +6859,75 @@ gent_fpformat(void) static void gent_extlinks(void) { - hid_t source_fid, target_fid, far_fid, sid, did, gid, gid2, tid; - hsize_t dims[1] = {6}; - int buf[6] = {1, 2, 3, 4, 5, 6}; + hid_t source_fid, target_fid, far_fid, sid, did, gid, gid2, tid; + hsize_t dims[1] = {6}; + int buf[6] = {1, 2, 3, 4, 5, 6}; - /* create two files, a source and a target */ - source_fid = H5Fcreate(FILE61, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - target_fid = H5Fcreate(FILE62, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - far_fid = H5Fcreate(FILE63, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + /* create two files, a source and a target */ + source_fid = H5Fcreate(FILE61, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + target_fid = H5Fcreate(FILE62, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + far_fid = H5Fcreate(FILE63, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); -/*------------------------------------------------------------------------- - * create Groups, a Dataset, a committed Datatype, external links, and a - * cycle in the target - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create Groups, a Dataset, a committed Datatype, external links, and a + * cycle in the target + *------------------------------------------------------------------------- + */ - gid = H5Gcreate2(target_fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(H5Gcreate2(target_fid, "empty_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)); - sid = H5Screate_simple(1, dims, NULL); - did = H5Dcreate2(gid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - H5Lcreate_external(FILE61, "/", gid, "elink_t1", H5P_DEFAULT, H5P_DEFAULT); - H5Lcreate_external(FILE61, "/ext_link4", gid, "elink_t2", H5P_DEFAULT, H5P_DEFAULT); + gid = H5Gcreate2(target_fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Gclose(H5Gcreate2(target_fid, "empty_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)); + sid = H5Screate_simple(1, dims, NULL); + did = H5Dcreate2(gid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + H5Lcreate_external(FILE61, "/", gid, "elink_t1", H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_external(FILE61, "/ext_link4", gid, "elink_t2", H5P_DEFAULT, H5P_DEFAULT); - gid2 = H5Gcreate2(gid, "subgroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Lcreate_hard(target_fid, "/group", gid2, "link_to_group", H5P_DEFAULT, H5P_DEFAULT); + gid2 = H5Gcreate2(gid, "subgroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_hard(target_fid, "/group", gid2, "link_to_group", H5P_DEFAULT, H5P_DEFAULT); - H5Dclose(did); - H5Sclose(sid); - H5Gclose(gid2); - H5Gclose(gid); + H5Dclose(did); + H5Sclose(sid); + H5Gclose(gid2); + H5Gclose(gid); - sid = H5Screate_simple(1, dims, NULL); - did = H5Dcreate2(target_fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - H5Dclose(did); - H5Sclose(sid); + sid = H5Screate_simple(1, dims, NULL); + did = H5Dcreate2(target_fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + H5Dclose(did); + H5Sclose(sid); - tid = H5Tcopy(H5T_NATIVE_INT); - H5Tcommit2(target_fid, "type", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Tclose(tid); + tid = H5Tcopy(H5T_NATIVE_INT); + H5Tcommit2(target_fid, "type", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Tclose(tid); -/*------------------------------------------------------------------------- - * create external links in the source file pointing to the target objects - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create external links in the source file pointing to the target objects + *------------------------------------------------------------------------- + */ - H5Lcreate_external(FILE62, "group", source_fid, "ext_link1", H5P_DEFAULT, H5P_DEFAULT); - H5Lcreate_external(FILE62, "dset", source_fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT); - H5Lcreate_external(FILE62, "type", source_fid, "ext_link3", H5P_DEFAULT, H5P_DEFAULT); - H5Lcreate_external(FILE62, "group/elink_t2", source_fid, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); - H5Lcreate_external(FILE62, "empty_group", source_fid, "ext_link5", H5P_DEFAULT, H5P_DEFAULT); -/* external link to soft link which linked to a dataset */ - H5Lcreate_external(FILE4_1, "/soft_dset1", source_fid, "ext2soft_link1", H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_external(FILE62, "group", source_fid, "ext_link1", H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_external(FILE62, "dset", source_fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_external(FILE62, "type", source_fid, "ext_link3", H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_external(FILE62, "group/elink_t2", source_fid, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_external(FILE62, "empty_group", source_fid, "ext_link5", H5P_DEFAULT, H5P_DEFAULT); + /* external link to soft link which linked to a dataset */ + H5Lcreate_external(FILE4_1, "/soft_dset1", source_fid, "ext2soft_link1", H5P_DEFAULT, H5P_DEFAULT); -/* external link to dangle soft link */ - H5Lcreate_external(FILE4_1, "/soft_dangle", source_fid, "ext2softdangle_link1", H5P_DEFAULT, H5P_DEFAULT); + /* external link to dangle soft link */ + H5Lcreate_external(FILE4_1, "/soft_dangle", source_fid, "ext2softdangle_link1", H5P_DEFAULT, H5P_DEFAULT); -/*------------------------------------------------------------------------- - * create external link in the "far" file pointing to the source file - *------------------------------------------------------------------------- - */ - H5Lcreate_external(FILE61, "/", far_fid, "src_file", H5P_DEFAULT, H5P_DEFAULT); + /*------------------------------------------------------------------------- + * create external link in the "far" file pointing to the source file + *------------------------------------------------------------------------- + */ + H5Lcreate_external(FILE61, "/", far_fid, "src_file", H5P_DEFAULT, H5P_DEFAULT); - /* close */ - H5Fclose(source_fid); - H5Fclose(target_fid); - H5Fclose(far_fid); + /* close */ + H5Fclose(source_fid); + H5Fclose(target_fid); + H5Fclose(far_fid); } /*------------------------------------------------------------------------- @@ -6966,11 +6967,11 @@ gent_packedbits(void) valu8bits = (uint8_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu8[i][0] = valu8bits; - for(j = 1; j < dims[1]; j++) { - dsetu8[i][j] = dsetu8[i][j-1] << 1; - } - valu8bits <<= 1; + dsetu8[i][0] = valu8bits; + for(j = 1; j < dims[1]; j++) { + dsetu8[i][j] = dsetu8[i][j-1] << 1; + } + valu8bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); @@ -6984,11 +6985,11 @@ gent_packedbits(void) valu16bits = (uint16_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu16[i][0] = valu16bits; - for(j = 1; j < dims[1]; j++) { - dsetu16[i][j] = dsetu16[i][j-1] << 1; - } - valu16bits <<= 1; + dsetu16[i][0] = valu16bits; + for(j = 1; j < dims[1]; j++) { + dsetu16[i][j] = dsetu16[i][j-1] << 1; + } + valu16bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); @@ -7002,11 +7003,11 @@ gent_packedbits(void) valu32bits = (uint32_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu32[i][0] = valu32bits; - for(j = 1; j < dims[1]; j++) { - dsetu32[i][j] = dsetu32[i][j-1] << 1; - } - valu32bits <<= 1; + dsetu32[i][0] = valu32bits; + for(j = 1; j < dims[1]; j++) { + dsetu32[i][j] = dsetu32[i][j-1] << 1; + } + valu32bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32); @@ -7020,11 +7021,11 @@ gent_packedbits(void) valu64bits = (uint64_t) ~0Lu; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu64[i][0] = valu64bits; - for(j = 1; j < dims[1]; j++) { - dsetu64[i][j] = dsetu64[i][j-1] << 1; - } - valu64bits <<= 1; + dsetu64[i][0] = valu64bits; + for(j = 1; j < dims[1]; j++) { + dsetu64[i][j] = dsetu64[i][j-1] << 1; + } + valu64bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64); @@ -7038,11 +7039,11 @@ gent_packedbits(void) val8bits = (int8_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset8[i][0] = val8bits; - for(j = 1; j < dims[1]; j++) { - dset8[i][j] = dset8[i][j-1] << 1; - } - val8bits <<= 1; + dset8[i][0] = val8bits; + for(j = 1; j < dims[1]; j++) { + dset8[i][j] = dset8[i][j-1] << 1; + } + val8bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); @@ -7056,11 +7057,11 @@ gent_packedbits(void) val16bits = (int16_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset16[i][0] = val16bits; - for(j = 1; j < dims[1]; j++) { - dset16[i][j] = dset16[i][j-1] << 1; - } - val16bits <<= 1; + dset16[i][0] = val16bits; + for(j = 1; j < dims[1]; j++) { + dset16[i][j] = dset16[i][j-1] << 1; + } + val16bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); @@ -7074,11 +7075,11 @@ gent_packedbits(void) val32bits = (int32_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset32[i][0] = val32bits; - for(j = 1; j < dims[1]; j++) { - dset32[i][j] = dset32[i][j-1] << 1; - } - val32bits <<= 1; + dset32[i][0] = val32bits; + for(j = 1; j < dims[1]; j++) { + dset32[i][j] = dset32[i][j-1] << 1; + } + val32bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32); @@ -7092,11 +7093,11 @@ gent_packedbits(void) val64bits = (int64_t) ~0L; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset64[i][0] = val64bits; - for(j = 1; j < dims[1]; j++) { - dset64[i][j] = dset64[i][j-1] << 1; - } - val64bits <<= 1; + dset64[i][0] = val64bits; + for(j = 1; j < dims[1]; j++) { + dset64[i][j] = dset64[i][j-1] << 1; + } + val64bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64); @@ -7109,8 +7110,8 @@ gent_packedbits(void) dataset = H5Dcreate2(fid, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < dims[0]; i++) - for(j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001 * j + i; + for(j = 0; j < dims[1]; j++) + dsetdbl[i][j] = 0.0001 * j + i; H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); @@ -7158,7 +7159,7 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++){ dsetu8[i][0] = valu8bits; for(j = 1; j < dims[1]; j++) { - dsetu8[i][j] = dsetu8[i][j-1] << 1; + dsetu8[i][j] = dsetu8[i][j-1] << 1; } valu8bits <<= 1; } @@ -7176,7 +7177,7 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++){ dsetu16[i][0] = valu16bits; for(j = 1; j < dims[1]; j++) { - dsetu16[i][j] = dsetu16[i][j-1] << 1; + dsetu16[i][j] = dsetu16[i][j-1] << 1; } valu16bits <<= 1; } @@ -7194,7 +7195,7 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++){ dsetu32[i][0] = valu32bits; for(j = 1; j < dims[1]; j++) { - dsetu32[i][j] = dsetu32[i][j-1] << 1; + dsetu32[i][j] = dsetu32[i][j-1] << 1; } valu32bits <<= 1; } @@ -7212,7 +7213,7 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++){ dsetu64[i][0] = valu64bits; for(j = 1; j < dims[1]; j++) { - dsetu64[i][j] = dsetu64[i][j-1] << 1; + dsetu64[i][j] = dsetu64[i][j-1] << 1; } valu64bits <<= 1; } @@ -7230,7 +7231,7 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++){ dset8[i][0] = val8bits; for(j = 1; j < dims[1]; j++) { - dset8[i][j] = dset8[i][j-1] << 1; + dset8[i][j] = dset8[i][j-1] << 1; } val8bits <<= 1; } @@ -7248,7 +7249,7 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++){ dset16[i][0] = val16bits; for(j = 1; j < dims[1]; j++) { - dset16[i][j] = dset16[i][j-1] << 1; + dset16[i][j] = dset16[i][j-1] << 1; } val16bits <<= 1; } @@ -7266,7 +7267,7 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++){ dset32[i][0] = val32bits; for(j = 1; j < dims[1]; j++) { - dset32[i][j] = dset32[i][j-1] << 1; + dset32[i][j] = dset32[i][j-1] << 1; } val32bits <<= 1; } @@ -7284,7 +7285,7 @@ gent_attr_intsize(void) for(i = 0; i < dims[0]; i++){ dset64[i][0] = val64bits; for(j = 1; j < dims[1]; j++) { - dset64[i][j] = dset64[i][j-1] << 1; + dset64[i][j] = dset64[i][j-1] << 1; } val64bits <<= 1; } @@ -7299,8 +7300,8 @@ gent_attr_intsize(void) attr = H5Acreate2(root, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < dims[0]; i++) - for(j = 0; j < dims[1]; j++) - dsetdbl[i][j] = 0.0001 * j + i; + for(j = 0; j < dims[1]; j++) + dsetdbl[i][j] = 0.0001 * j + i; H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl); @@ -7505,8 +7506,8 @@ static void gent_compound_intsizes(void) { dims[0] = F70_XDIM; dims[1] = F70_YDIM8; for(n = 0; n < dims[0]; n++) - for(o = 0; o < dims[1]; o++) - Array1[m].dsetdbl[n][o] = 0.0001 * o + n; + for(o = 0; o < dims[1]; o++) + Array1[m].dsetdbl[n][o] = 0.0001 * o + n; } /* Create the array data type for the 8 bits signed int array */ @@ -7780,8 +7781,8 @@ static void gent_compound_attr_intsizes(void) { dims[0] = F70_XDIM; dims[1] = F70_YDIM8; for(n = 0; n < dims[0]; n++) - for(o = 0; o < dims[1]; o++) - Array1[m].dsetdbl[n][o] = 0.0001 * o + n; + for(o = 0; o < dims[1]; o++) + Array1[m].dsetdbl[n][o] = 0.0001 * o + n; } /* Create the array data type for the 8 bits signed int array */ @@ -7910,6 +7911,155 @@ static void gent_compound_attr_intsizes(void) { HDassert(status >= 0); } +static void gent_nested_compound_dt(void) { /* test nested data type */ + hid_t fid, group, dataset, space, type, create_plist, type1, type2; + hid_t array_dt, enum_dt; + enumtype val; + + typedef struct { + int a; + float b; + } dset1_t; + dset1_t dset1[10]; + + typedef struct { + int a; + float b; + enumtype c; + } dset2_t; + dset2_t dset2[10]; + + typedef struct { + int a[5]; + float b[5][6]; + dset1_t c; + } dset3_t; + dset3_t dset3[10]; + + enumtype dset4[] = {RED, GREEN, BLUE, GREEN, WHITE, BLUE}; + dset1_t dset5[10]; + + int i, j, k; + unsigned ndims; + hsize_t dim[2]; + + hsize_t sdim, maxdim; + + sdim = 10; + for(i = 0; i < (int)sdim; i++) { + dset1[i].a = i; + dset1[i].b = (float)(i*i); + + dset2[i].a = i; + dset2[i].b = (float)(i+i*0.1); + dset2[i].c = GREEN; + + for(j = 0; j < 5; j++) { + dset3[i].a[j] = i*j; + for(k = 0; k < 6; k++) { + dset3[i].b[j][k] = (float)(i*j*k*1.0); + } + } + dset3[i].c.a = i; + dset3[i].c.b = (float)(i*1.0); + } + + fid = H5Fcreate(FILE72, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + create_plist = H5Pcreate(H5P_DATASET_CREATE); + + sdim = 2; + H5Pset_chunk(create_plist, 1, &sdim); + + + sdim = 6; + maxdim = H5S_UNLIMITED; + + space = H5Screate_simple(1, &sdim, &maxdim); + + type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0])); + H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32LE); + H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32LE); + + dataset = H5Dcreate2(fid, "/dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT); + + H5Dwrite(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); + + H5Tclose(type); + H5Dclose(dataset); + + /* Create the shared enumerated datatype. */ + enum_dt = H5Tenum_create (H5T_NATIVE_INT); + val = (enumtype) RED; + H5Tenum_insert (enum_dt, "Red", &val); + val = (enumtype) GREEN; + H5Tenum_insert (enum_dt, "Green", &val); + val = (enumtype) BLUE; + H5Tenum_insert (enum_dt, "Blue", &val); + val = (enumtype) WHITE; + H5Tenum_insert (enum_dt, "White", &val); + val = (enumtype) BLACK; + H5Tenum_insert (enum_dt, "Black", &val); + H5Tcommit2(fid, "enumtype", enum_dt, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2[0])); + + H5Tinsert(type2, "a_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT); + H5Tinsert(type2, "b_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT); + H5Tinsert(type2, "c_name", HOFFSET(dset2_t, c), enum_dt); + + dataset = H5Dcreate2(fid, "/dset2", type2, space, H5P_DEFAULT, create_plist, H5P_DEFAULT); + + H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); + + H5Tclose(type2); + + dataset = H5Dcreate2(fid, "/dset4", enum_dt, space, H5P_DEFAULT, create_plist, H5P_DEFAULT); + H5Dwrite(dataset, enum_dt, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset4); + + H5Tclose(enum_dt); + H5Dclose(dataset); + + /* shared data type 1 */ + type1 = H5Tcreate(H5T_COMPOUND, sizeof(dset1_t)); + H5Tinsert(type1, "int_name", HOFFSET(dset1_t, a), H5T_STD_I32LE); + H5Tinsert(type1, "float_name", HOFFSET(dset1_t, b), H5T_IEEE_F32LE); + H5Tcommit2(fid, "type1", type1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + group = H5Gcreate2(fid, "/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t)); + + ndims = 1; dim[0] = 5; + array_dt = H5Tarray_create2(H5T_STD_I32LE, ndims, dim); + H5Tinsert(type2, "int_name", HOFFSET(dset3_t, a), array_dt); + H5Tclose(array_dt); + + ndims = 2; dim[0] = 5; dim[1] = 6; + array_dt = H5Tarray_create2(H5T_IEEE_F32LE, ndims, dim); + H5Tinsert(type2, "float_name", HOFFSET(dset3_t, b), array_dt); + H5Tclose(array_dt); + + H5Tinsert (type2, "cmpd_name", HOFFSET (dset3_t, c), type1); + + dataset = H5Dcreate2(group, "dset3", type2, space, H5P_DEFAULT, create_plist, H5P_DEFAULT); + + H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3); + + dataset = H5Dcreate2(fid, "/dset5", type1, space, H5P_DEFAULT, create_plist, H5P_DEFAULT); + H5Dwrite(dataset, type1, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); + + H5Tclose(type1); + H5Tclose(type2); + H5Sclose(space); + H5Dclose(dataset); + H5Gclose(group); + + H5Pclose(create_plist); + + H5Fclose(fid); + +} /*------------------------------------------------------------------------- * Function: main @@ -7991,6 +8141,8 @@ int main(void) gent_compound_intsizes(); gent_compound_attr_intsizes(); + gent_nested_compound_dt(); + return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index fe78693..6f29fa6 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -141,6 +141,7 @@ $SRC_H5DUMP_TESTFILES/tmulti-r.h5 $SRC_H5DUMP_TESTFILES/tmulti-s.h5 $SRC_H5DUMP_TESTFILES/tnamed_dtype_attr.h5 $SRC_H5DUMP_TESTFILES/tnestedcomp.h5 +$SRC_H5DUMP_TESTFILES/tnestedcmpddt.h5 $SRC_H5DUMP_TESTFILES/tno-subset.h5 $SRC_H5DUMP_TESTFILES/tnullspace.h5 $SRC_H5DUMP_TESTFILES/zerodim.h5 @@ -161,6 +162,7 @@ $SRC_H5DUMP_TESTFILES/tvldtypes4.h5 $SRC_H5DUMP_TESTFILES/tvldtypes5.h5 $SRC_H5DUMP_TESTFILES/tvlstr.h5 $SRC_H5DUMP_TESTFILES/tvms.h5 +$SRC_H5DUMP_TESTFILES/twidedisplay.ddl " LIST_OTHER_TEST_FILES=" @@ -256,6 +258,7 @@ $SRC_H5DUMP_TESTFILES/tqmarkfile.ddl $SRC_H5DUMP_TESTFILES/tstarfile.ddl $SRC_H5DUMP_TESTFILES/tnamed_dtype_attr.ddl $SRC_H5DUMP_TESTFILES/tnestcomp-1.ddl +$SRC_H5DUMP_TESTFILES/tnestedcmpddt.ddl $SRC_H5DUMP_TESTFILES/tnbit.ddl $SRC_H5DUMP_TESTFILES/tno-subset.ddl $SRC_H5DUMP_TESTFILES/tnullspace.ddl @@ -269,6 +272,8 @@ $SRC_H5DUMP_TESTFILES/torderattr1.ddl $SRC_H5DUMP_TESTFILES/torderattr2.ddl $SRC_H5DUMP_TESTFILES/torderattr3.ddl $SRC_H5DUMP_TESTFILES/torderattr4.ddl +$SRC_H5DUMP_TESTFILES/tordercontents1.ddl +$SRC_H5DUMP_TESTFILES/tordercontents2.ddl $SRC_H5DUMP_TESTFILES/tperror.ddl $SRC_H5DUMP_TESTFILES/treference.ddl $SRC_H5DUMP_TESTFILES/tsaf.ddl @@ -570,6 +575,9 @@ COPY_TESTFILES_TO_TESTDIR #TOOLTEST h5dump-help.txt -h +# test for maximum display datasets +TOOLTEST twidedisplay.ddl -w0 --enable-error-stack packedbits.h5 + # test for signed/unsigned datasets TOOLTEST packedbits.ddl --enable-error-stack packedbits.h5 # test for compound signed/unsigned datasets @@ -627,6 +635,7 @@ TOOLTEST tcomp-4.ddl --enable-error-stack tcompound_complex.h5 #test for the nested compound type TOOLTEST tnestcomp-1.ddl --enable-error-stack tnestedcomp.h5 +TOOLTEST tnestedcmpddt.ddl --enable-error-stack tnestedcmpddt.h5 # test for options # JIRA HDFFV-7936 TOOLTEST tall-1.ddl --enable-error-stack tall.h5 @@ -717,6 +726,8 @@ TOOLTEST3 tperror.ddl --enable-error-stack -p -d bogus tfcontents1.h5 # test for file contents TOOLTEST tcontents.ddl --enable-error-stack -n tfcontents1.h5 +TOOLTEST tordercontents1.ddl --enable-error-stack -n --sort_by=name --sort_order=ascending tfcontents1.h5 +TOOLTEST tordercontents2.ddl --enable-error-stack -n --sort_by=name --sort_order=descending tfcontents1.h5 # tests for storage layout # compact diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt index a96ebc4..bbe73a8 100644 --- a/tools/h5import/CMakeLists.txt +++ b/tools/h5import/CMakeLists.txt @@ -92,7 +92,7 @@ IF (BUILD_TESTING) ENDFOREACH (conf_file ${HDF5_REFERENCE_CONF_FILES}) FOREACH (txt_file ${HDF5_REFERENCE_TXT_FILES}) - SET (dest "${PROJECT_BINARY_DIR}/${txt_file}") + SET (dest "${PROJECT_BINARY_DIR}/testfiles/${txt_file}") #MESSAGE (STATUS " Copying ${txt_file}") ADD_CUSTOM_COMMAND ( TARGET h5import @@ -119,24 +119,22 @@ IF (BUILD_TESTING) ############################################################################## ############################################################################## MACRO (ADD_H5_TEST testname importfile conffile testfile) - IF (NOT HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST ( - NAME H5IMPORT-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${testfile} - ${testfile}.new - ${testfile}.new.err - ${testfile}.out - ${testfile}.out.err - ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "H5IMPORT-${testname}-clear-objects") - ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST ( + NAME H5IMPORT-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${testfile} + ${testfile}.new + ${testfile}.new.err + ${testfile}.out + ${testfile}.out.err + ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5IMPORT-${testname}-clear-objects") - ADD_TEST (NAME H5IMPORT-${testname} COMMAND $<TARGET_FILE:h5import> ${importfile} -c testfiles/${conffile} -o ${testfile}) + ADD_TEST (NAME H5IMPORT-${testname} COMMAND $<TARGET_FILE:h5import> ${importfile} -c ${conffile} -o ${testfile}) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5IMPORT-${testname} PROPERTIES DEPENDS ${last_test}) ENDIF (NOT "${last_test}" STREQUAL "") @@ -192,8 +190,6 @@ IF (BUILD_TESTING) binin32.bin binuin16.bin binuin32.bin - txtin16.txt - txtin32.txt ${HDF5_REFERENCE_TEST_FILES} ) SET (last_test "H5IMPORT-clear-objects") @@ -205,52 +201,52 @@ IF (BUILD_TESTING) SET (last_test "H5IMPORT-h5importtest") # ----- TESTING "ASCII I32 rank 3 - Output BE " ; - ADD_H5_TEST (ASCII_I32 txtin32.txt txtin32.conf txtin32.h5) + ADD_H5_TEST (ASCII_I32 testfiles/txtin32.txt testfiles/txtin32.conf txtin32.h5) # ----- TESTING "ASCII I16 rank 3 - Output LE - CHUNKED - extended" - ADD_H5_TEST (ASCII_I16 txtin16.txt txtin16.conf txtin16.h5) + ADD_H5_TEST (ASCII_I16 testfiles/txtin16.txt testfiles/txtin16.conf txtin16.h5) # ----- TESTING "ASCII I8 - rank 3 - Output I8 LE-Chunked+Extended+Compressed " - ADD_H5_TEST (ASCII_I8 txtin8.txt txtin8.conf txtin8.h5) - - # ----- TESTING "ASCII UI32 - rank 3 - Output BE" - ADD_H5_TEST (ASCII_UI32 txtuin32.txt txtuin32.conf txtuin32.h5) + ADD_H5_TEST (ASCII_I8 testfiles/txtin8.txt testfiles/txtin8.conf txtin8.h5) # ----- TESTING "ASCII UI16 - rank 2 - Output LE+Chunked+Compressed " - ADD_H5_TEST (ASCII_UI16 txtuin16.txt txtuin16.conf txtuin16.h5) + ADD_H5_TEST (ASCII_UI16 testfiles/txtuin16.txt testfiles/txtuin16.conf txtuin16.h5) + + # ----- TESTING "ASCII UI32 - rank 3 - Output BE" + ADD_H5_TEST (ASCII_UI32 testfiles/txtuin32.txt testfiles/txtuin32.conf txtuin32.h5) # ----- TESTING "ASCII F32 - rank 3 - Output LE " - ADD_H5_TEST (ASCII_F32 txtfp32.txt txtfp32.conf txtfp32.h5) + ADD_H5_TEST (ASCII_F32 testfiles/txtfp32.txt testfiles/txtfp32.conf txtfp32.h5) # ----- TESTING "ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed " - ADD_H5_TEST (ASCII_F64 txtfp64.txt txtfp64.conf txtfp64.h5) + ADD_H5_TEST (ASCII_F64 testfiles/txtfp64.txt testfiles/txtfp64.conf txtfp64.h5) # ----- TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed " - ADD_H5_TEST (BINARY_F64 binfp64.bin binfp64.conf binfp64.h5) - - # ----- TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended " - ADD_H5_TEST (BINARY_I16 binin16.bin binin16.conf binin16.h5) + ADD_H5_TEST (BINARY_F64 binfp64.bin testfiles/binfp64.conf binfp64.h5) # ----- TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed " - ADD_H5_TEST (BINARY_I8 binin8.bin binin8.conf binin8.h5) + ADD_H5_TEST (BINARY_I8 binin8.bin testfiles/binin8.conf binin8.h5) + + # ----- TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended " + ADD_H5_TEST (BINARY_I16 binin16.bin testfiles/binin16.conf binin16.h5) # ----- TESTING "BINARY I32 - rank 3 - Output BE + CHUNKED " - ADD_H5_TEST (BINARY_I32 binin32.bin binin32.conf binin32.h5) + ADD_H5_TEST (BINARY_I32 binin32.bin testfiles/binin32.conf binin32.h5) # ----- TESTING "BINARY UI16 - rank 3 - Output byte BE + CHUNKED " - ADD_H5_TEST (BINARY_UI16 binuin16.bin binuin16.conf binuin16.h5) + ADD_H5_TEST (BINARY_UI16 binuin16.bin testfiles/binuin16.conf binuin16.h5) # ----- TESTING "BINARY UI32 - rank 3 - Output LE + CHUNKED " - ADD_H5_TEST (BINARY_UI32 binuin32.bin binuin32.conf binuin32.h5) + ADD_H5_TEST (BINARY_UI32 binuin32.bin testfiles/binuin32.conf binuin32.h5) # ----- TESTING "STR" - ADD_H5_TEST (STR txtstr.txt txtstr.conf txtstr.h5) + ADD_H5_TEST (STR testfiles/txtstr.txt testfiles/txtstr.conf txtstr.h5) # ----- TESTING "BINARY I8 CR LF EOF" - ADD_H5_TEST (BINARY_I8_EOF binin8w.bin binin8w.conf binin8w.h5) + ADD_H5_TEST (BINARY_I8_EOF binin8w.bin testfiles/binin8w.conf binin8w.h5) # ----- TESTING "ASCII F64 - rank 1 - INPUT-CLASS TEXTFPE " - ADD_H5_TEST (ASCII_F64_R1 textpfe64.txt textpfe.conf textpfe.h5) + ADD_H5_TEST (ASCII_F64_R1 testfiles/textpfe64.txt testfiles/textpfe.conf textpfe.h5) ENDIF (BUILD_TESTING) diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c index 434cba7..49f977c 100644 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c @@ -165,21 +165,38 @@ main(void) #ifndef UNICOS +#ifdef REBUILDTEXTFILES /*------------------------------------------------------------------------- - * TOOLTEST txtin16.txt -c $srcdir/testfiles/txtin16.conf -o txtin16.h5 + * TOOLTEST txtin8.txt -c $srcdir/testfiles/txtin8.conf -o txtin8.h5 *------------------------------------------------------------------------- */ + sp = HDfopen("txtin8.txt", "w"); + for (k = 0; k < npln; k++) + { + for (i = 0; i < nrow; i++) + { + for (j = 0; j < ncol; j++) + (void) fprintf(sp, "%10u", b8i3[k][i][j]); + (void) fprintf(sp, "\n"); + } + } + (void) HDfclose(sp); + + /*------------------------------------------------------------------------- + * TOOLTEST txtin16.txt -c $srcdir/testfiles/txtin16.conf -o txtin16.h5 + *------------------------------------------------------------------------- + */ sp = HDfopen("txtin16.txt", "w"); for (k = 0; k < npln; k++) { - for (i = 0; i < nrow; i++) - { - for (j = 0; j < ncol; j++) - (void) fprintf(sp, "%10u", b16i3[k][i][j]); - (void) fprintf(sp, "\n"); - } + for (i = 0; i < nrow; i++) + { + for (j = 0; j < ncol; j++) + (void) fprintf(sp, "%10u", b16i3[k][i][j]); + (void) fprintf(sp, "\n"); + } } (void) HDfclose(sp); @@ -199,6 +216,7 @@ main(void) } } (void) HDfclose(sp); +#endif /*------------------------------------------------------------------------- * TOOLTEST binin32.bin -c $srcdir/testfiles/binin32.conf -o binin32.h5 diff --git a/tools/h5import/h5importtestutil.sh b/tools/h5import/h5importtestutil.sh index 37613dd..7289b2a 100755 --- a/tools/h5import/h5importtestutil.sh +++ b/tools/h5import/h5importtestutil.sh @@ -181,20 +181,20 @@ TOOLTEST $TESTDIR/txtin32.txt -c $TESTDIR/txtin32.conf -o txtin32.h5 TESTING "ASCII I16 rank 3 - Output LE - CHUNKED - extended" TOOLTEST $TESTDIR/txtin16.txt -c $TESTDIR/txtin16.conf -o txtin16.h5 - TESTING "ASCII I8 - rank 3 - Output I8 LE-Chunked+Extended+Compressed " TOOLTEST $TESTDIR/txtin8.txt -c $TESTDIR/txtin8.conf -o txtin8.h5 -TESTING "ASCII UI32 - rank 3 - Output BE" -TOOLTEST $TESTDIR/txtuin32.txt -c $TESTDIR/txtuin32.conf -o txtuin32.h5 TESTING "ASCII UI16 - rank 2 - Output LE+Chunked+Compressed " TOOLTEST $TESTDIR/txtuin16.txt -c $TESTDIR/txtuin16.conf -o txtuin16.h5 +TESTING "ASCII UI32 - rank 3 - Output BE" +TOOLTEST $TESTDIR/txtuin32.txt -c $TESTDIR/txtuin32.conf -o txtuin32.h5 + + TESTING "ASCII F32 - rank 3 - Output LE " TOOLTEST $TESTDIR/txtfp32.txt -c $TESTDIR/txtfp32.conf -o txtfp32.h5 - TESTING "ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed " TOOLTEST $TESTDIR/txtfp64.txt -c $TESTDIR/txtfp64.conf -o txtfp64.h5 @@ -202,13 +202,11 @@ TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed " TOOLTEST binfp64.bin -c $TESTDIR/binfp64.conf -o binfp64.h5 -TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended " -TOOLTEST binin16.bin -c $TESTDIR/binin16.conf -o binin16.h5 - - TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed " TOOLTEST binin8.bin -c $TESTDIR/binin8.conf -o binin8.h5 +TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended " +TOOLTEST binin16.bin -c $TESTDIR/binin16.conf -o binin16.h5 TESTING "BINARY I32 - rank 3 - Output BE + CHUNKED " TOOLTEST binin32.bin -c $TESTDIR/binin32.conf -o binin32.h5 @@ -224,6 +222,7 @@ TOOLTEST binuin32.bin -c $TESTDIR/binuin32.conf -o binuin32.h5 TESTING "STR" TOOLTEST $TESTDIR/txtstr.txt -c $TESTDIR/txtstr.conf -o txtstr.h5 + TESTING "BINARY I8 CR LF EOF" TOOLTEST binin8w.bin -c $TESTDIR/binin8w.conf -o binin8w.h5 @@ -231,8 +230,7 @@ TESTING "ASCII F64 - rank 1 - INPUT-CLASS TEXTFPE " TOOLTEST $TESTDIR/textpfe64.txt -c $TESTDIR/textpfe.conf -o textpfe.h5 - -rm -f txtin32.txt txtin16.txt txtin8.txt txtuin32.txt txtuin16.txt *.bin *.h5 +rm -f txtin32.txt txtin16.txt txtin8.txt txtuin32.txt txtuin16.txt *.bin *.h5 rm -rf tmp_testfiles else echo "** h5import or h5importtest not available ***" diff --git a/tools/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in index 7c2691a..110c651 100644 --- a/tools/h5ls/testh5ls.sh.in +++ b/tools/h5ls/testh5ls.sh.in @@ -337,8 +337,11 @@ TOOLTEST tcomp-1.ls 0 -w80 -r -d tcompound.h5 #test for the nested compound type TOOLTEST tnestcomp-1.ls 0 -w80 -r -d tnestedcomp.h5 + TOOLTEST tnestcomp-2.ls 0 -w80 -r -d -S tnestedcomp.h5 + TOOLTEST tnestcomp-3.ls 0 -w80 -r -d -l tnestedcomp.h5 + TOOLTEST tnestcomp-4.ls 0 -w80 -r -d -l -S tnestedcomp.h5 # test for loop detection diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index ad8b9fe..833b8c4 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -61,6 +61,13 @@ static void trav_table_addlink(trav_table_t *table, const char *path); /*------------------------------------------------------------------------- + * local variables + *------------------------------------------------------------------------- + */ +static H5_index_t trav_index_by = H5_INDEX_NAME; +static H5_iter_order_t trav_index_order = H5_ITER_INC; + +/*------------------------------------------------------------------------- * "h5trav info" public functions. used in h5diff *------------------------------------------------------------------------- */ @@ -255,12 +262,12 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start, /* Check for iteration of links vs. visiting all links recursively */ if(recurse) { /* Visit all links in group, recursively */ - if(H5Lvisit_by_name(file_id, grp_name, H5_INDEX_NAME, H5_ITER_INC, traverse_cb, &udata, H5P_DEFAULT) < 0) + if(H5Lvisit_by_name(file_id, grp_name, trav_index_by, trav_index_order, traverse_cb, &udata, H5P_DEFAULT) < 0) return -1; } /* end if */ else { /* Iterate over links in group */ - if(H5Literate_by_name(file_id, grp_name, H5_INDEX_NAME, H5_ITER_INC, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0) + if(H5Literate_by_name(file_id, grp_name, trav_index_by, trav_index_order, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0) return -1; } /* end else */ @@ -948,11 +955,14 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) */ int -h5trav_print(hid_t fid) +h5trav_print(hid_t fid, H5_index_t print_index_by, H5_iter_order_t print_index_order) { trav_print_udata_t print_udata; /* User data for traversal */ trav_visitor_t print_visitor; /* Visitor structure for printing objects */ + trav_index_by = print_index_by; + trav_index_order = print_index_order; + /* Init user data for printing */ print_udata.fid = fid; diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index da8dc69..7311897 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -158,7 +158,7 @@ H5TOOLS_DLL int h5trav_getindext(const char *obj, const trav_table_t *travt); * "h5trav print" public functions *------------------------------------------------------------------------- */ -H5TOOLS_DLL int h5trav_print(hid_t fid); +H5TOOLS_DLL int h5trav_print(hid_t fid, H5_index_t print_index_by, H5_iter_order_t print_index_order); #ifdef __cplusplus } diff --git a/tools/testfiles/tnestedcmpddt.ddl b/tools/testfiles/tnestedcmpddt.ddl new file mode 100644 index 0000000..db949f0 --- /dev/null +++ b/tools/testfiles/tnestedcmpddt.ddl @@ -0,0 +1,220 @@ +HDF5 "tnestedcmpddt.h5" { +GROUP "/" { + DATASET "dset1" { + DATATYPE H5T_COMPOUND { + H5T_STD_I32LE "a_name"; + H5T_IEEE_F32LE "b_name"; + } + DATASPACE SIMPLE { ( 6 ) / ( H5S_UNLIMITED ) } + DATA { + (0): { + 0, + 0 + }, + (1): { + 1, + 1 + }, + (2): { + 2, + 4 + }, + (3): { + 3, + 9 + }, + (4): { + 4, + 16 + }, + (5): { + 5, + 25 + } + } + } + DATASET "dset2" { + DATATYPE H5T_COMPOUND { + H5T_STD_I32LE "a_name"; + H5T_IEEE_F32LE "b_name"; + H5T_ENUM { + H5T_STD_I32LE; + "Red" 0; + "Green" 1; + "Blue" 2; + "White" 3; + "Black" 4; + } "c_name"; + } + DATASPACE SIMPLE { ( 6 ) / ( H5S_UNLIMITED ) } + DATA { + (0): { + 0, + 0, + Green + }, + (1): { + 1, + 1.1, + Green + }, + (2): { + 2, + 2.2, + Green + }, + (3): { + 3, + 3.3, + Green + }, + (4): { + 4, + 4.4, + Green + }, + (5): { + 5, + 5.5, + Green + } + } + } + DATASET "dset4" { + DATATYPE "/enumtype" + DATASPACE SIMPLE { ( 6 ) / ( H5S_UNLIMITED ) } + DATA { + (0): Red, Green, Blue, Green, White, Blue + } + } + DATASET "dset5" { + DATATYPE "/type1" + DATASPACE SIMPLE { ( 6 ) / ( H5S_UNLIMITED ) } + DATA { + (0): { + 0, + 0 + }, + (1): { + 1, + 1 + }, + (2): { + 2, + 4 + }, + (3): { + 3, + 9 + }, + (4): { + 4, + 16 + }, + (5): { + 5, + 25 + } + } + } + DATATYPE "enumtype" H5T_ENUM { + H5T_STD_I32LE; + "Red" 0; + "Green" 1; + "Blue" 2; + "White" 3; + "Black" 4; + }; + GROUP "group1" { + DATASET "dset3" { + DATATYPE H5T_COMPOUND { + H5T_ARRAY { [5] H5T_STD_I32LE } "int_name"; + H5T_ARRAY { [5][6] H5T_IEEE_F32LE } "float_name"; + H5T_COMPOUND { + H5T_STD_I32LE "int_name"; + H5T_IEEE_F32LE "float_name"; + } "cmpd_name"; + } + DATASPACE SIMPLE { ( 6 ) / ( H5S_UNLIMITED ) } + DATA { + (0): { + [ 0, 0, 0, 0, 0 ], + [ 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 ], + { + 0, + 0 + } + }, + (1): { + [ 0, 1, 2, 3, 4 ], + [ 0, 0, 0, 0, 0, 0, + 0, 1, 2, 3, 4, 5, + 0, 2, 4, 6, 8, 10, + 0, 3, 6, 9, 12, 15, + 0, 4, 8, 12, 16, 20 ], + { + 1, + 1 + } + }, + (2): { + [ 0, 2, 4, 6, 8 ], + [ 0, 0, 0, 0, 0, 0, + 0, 2, 4, 6, 8, 10, + 0, 4, 8, 12, 16, 20, + 0, 6, 12, 18, 24, 30, + 0, 8, 16, 24, 32, 40 ], + { + 2, + 2 + } + }, + (3): { + [ 0, 3, 6, 9, 12 ], + [ 0, 0, 0, 0, 0, 0, + 0, 3, 6, 9, 12, 15, + 0, 6, 12, 18, 24, 30, + 0, 9, 18, 27, 36, 45, + 0, 12, 24, 36, 48, 60 ], + { + 3, + 3 + } + }, + (4): { + [ 0, 4, 8, 12, 16 ], + [ 0, 0, 0, 0, 0, 0, + 0, 4, 8, 12, 16, 20, + 0, 8, 16, 24, 32, 40, + 0, 12, 24, 36, 48, 60, + 0, 16, 32, 48, 64, 80 ], + { + 4, + 4 + } + }, + (5): { + [ 0, 5, 10, 15, 20 ], + [ 0, 0, 0, 0, 0, 0, + 0, 5, 10, 15, 20, 25, + 0, 10, 20, 30, 40, 50, + 0, 15, 30, 45, 60, 75, + 0, 20, 40, 60, 80, 100 ], + { + 5, + 5 + } + } + } + } + } + DATATYPE "type1" H5T_COMPOUND { + H5T_STD_I32LE "int_name"; + H5T_IEEE_F32LE "float_name"; + } +} +} diff --git a/tools/testfiles/tnestedcmpddt.h5 b/tools/testfiles/tnestedcmpddt.h5 Binary files differnew file mode 100644 index 0000000..f2af756 --- /dev/null +++ b/tools/testfiles/tnestedcmpddt.h5 diff --git a/tools/testfiles/tordercontents1.ddl b/tools/testfiles/tordercontents1.ddl new file mode 100644 index 0000000..14e12d6 --- /dev/null +++ b/tools/testfiles/tordercontents1.ddl @@ -0,0 +1,20 @@ +HDF5 "tfcontents1.h5" { +FILE_CONTENTS { + datatype /#5616 + group / + dataset /dset + dataset /dset3 -> /dset + dataset /dset4 -> /dset + dataset /dsetmytype2 + ext link /extlink -> fname oname + group /g1 + dataset /g1/dset1 -> /dset + group /g1/g1.1 + dataset /g1/g1.1/dset2 -> /dset + group /g2 -> /g1/g1.1 + link /mylink -> mylink + datatype /mytype + link /softlink -> /dset + unknown type of UD link /udlink -> ??? + } +} diff --git a/tools/testfiles/tordercontents2.ddl b/tools/testfiles/tordercontents2.ddl new file mode 100644 index 0000000..6757338 --- /dev/null +++ b/tools/testfiles/tordercontents2.ddl @@ -0,0 +1,20 @@ +HDF5 "tfcontents1.h5" { +FILE_CONTENTS { + datatype /#5616 + group / + unknown type of UD link /udlink -> ??? + link /softlink -> /dset + datatype /mytype + link /mylink -> mylink + group /g2 + dataset /g2/dset2 + group /g1 + group /g1/g1.1 -> /g2 + dataset /g1/dset1 -> /g2/dset2 + ext link /extlink -> fname oname + dataset /dsetmytype2 + dataset /dset4 -> /g2/dset2 + dataset /dset3 -> /g2/dset2 + dataset /dset -> /g2/dset2 + } +} diff --git a/tools/testfiles/twidedisplay.ddl b/tools/testfiles/twidedisplay.ddl new file mode 100644 index 0000000..1e6ffee --- /dev/null +++ b/tools/testfiles/twidedisplay.ddl @@ -0,0 +1,130 @@ +HDF5 "packedbits.h5" { +GROUP "/" { + DATASET "DS08BITS" { + DATATYPE H5T_STD_I8LE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + (0,0): -1, -2, -4, -8, -16, -32, -64, -128, + (1,0): -2, -4, -8, -16, -32, -64, -128, 0, + (2,0): -4, -8, -16, -32, -64, -128, 0, 0, + (3,0): -8, -16, -32, -64, -128, 0, 0, 0, + (4,0): -16, -32, -64, -128, 0, 0, 0, 0, + (5,0): -32, -64, -128, 0, 0, 0, 0, 0, + (6,0): -64, -128, 0, 0, 0, 0, 0, 0, + (7,0): -128, 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "DS16BITS" { + DATATYPE H5T_STD_I16LE + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + (0,0): -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, + (1,0): -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, + (2,0): -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, 0, + (3,0): -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, 0, 0, + (4,0): -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, 0, 0, 0, + (5,0): -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, 0, 0, 0, 0, + (6,0): -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, 0, 0, 0, 0, 0, + (7,0): -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "DS32BITS" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + DATA { + (0,0): -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, + (1,0): -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, 0, + (2,0): -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, 0, 0, + (3,0): -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, + (4,0): -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, 0, + (5,0): -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, 0, 0, + (6,0): -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, 0, 0, 0, + (7,0): -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "DS64BITS" { + DATATYPE H5T_STD_I64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + DATA { + (0,0): -1, -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, -549755813888, -1099511627776, -2199023255552, -4398046511104, -8796093022208, -17592186044416, -35184372088832, -70368744177664, -140737488355328, -281474976710656, -562949953421312, -1125899906842624, -2251799813685248, -4503599627370496, -9007199254740992, -18014398509481984, -36028797018963968, -72057594037927936, -144115188075855872, -288230376151711744, -576460752303423488, -1152921504606846976, -2305843009213693952, -4611686018427387904, -9223372036854775808, + (1,0): -2, -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, -549755813888, -1099511627776, -2199023255552, -4398046511104, -8796093022208, -17592186044416, -35184372088832, -70368744177664, -140737488355328, -281474976710656, -562949953421312, -1125899906842624, -2251799813685248, -4503599627370496, -9007199254740992, -18014398509481984, -36028797018963968, -72057594037927936, -144115188075855872, -288230376151711744, -576460752303423488, -1152921504606846976, -2305843009213693952, -4611686018427387904, -9223372036854775808, 0, + (2,0): -4, -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, -549755813888, -1099511627776, -2199023255552, -4398046511104, -8796093022208, -17592186044416, -35184372088832, -70368744177664, -140737488355328, -281474976710656, -562949953421312, -1125899906842624, -2251799813685248, -4503599627370496, -9007199254740992, -18014398509481984, -36028797018963968, -72057594037927936, -144115188075855872, -288230376151711744, -576460752303423488, -1152921504606846976, -2305843009213693952, -4611686018427387904, -9223372036854775808, 0, 0, + (3,0): -8, -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, -549755813888, -1099511627776, -2199023255552, -4398046511104, -8796093022208, -17592186044416, -35184372088832, -70368744177664, -140737488355328, -281474976710656, -562949953421312, -1125899906842624, -2251799813685248, -4503599627370496, -9007199254740992, -18014398509481984, -36028797018963968, -72057594037927936, -144115188075855872, -288230376151711744, -576460752303423488, -1152921504606846976, -2305843009213693952, -4611686018427387904, -9223372036854775808, 0, 0, 0, + (4,0): -16, -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, -549755813888, -1099511627776, -2199023255552, -4398046511104, -8796093022208, -17592186044416, -35184372088832, -70368744177664, -140737488355328, -281474976710656, -562949953421312, -1125899906842624, -2251799813685248, -4503599627370496, -9007199254740992, -18014398509481984, -36028797018963968, -72057594037927936, -144115188075855872, -288230376151711744, -576460752303423488, -1152921504606846976, -2305843009213693952, -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, + (5,0): -32, -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, -549755813888, -1099511627776, -2199023255552, -4398046511104, -8796093022208, -17592186044416, -35184372088832, -70368744177664, -140737488355328, -281474976710656, -562949953421312, -1125899906842624, -2251799813685248, -4503599627370496, -9007199254740992, -18014398509481984, -36028797018963968, -72057594037927936, -144115188075855872, -288230376151711744, -576460752303423488, -1152921504606846976, -2305843009213693952, -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, + (6,0): -64, -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, -549755813888, -1099511627776, -2199023255552, -4398046511104, -8796093022208, -17592186044416, -35184372088832, -70368744177664, -140737488355328, -281474976710656, -562949953421312, -1125899906842624, -2251799813685248, -4503599627370496, -9007199254740992, -18014398509481984, -36028797018963968, -72057594037927936, -144115188075855872, -288230376151711744, -576460752303423488, -1152921504606846976, -2305843009213693952, -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, 0, + (7,0): -128, -256, -512, -1024, -2048, -4096, -8192, -16384, -32768, -65536, -131072, -262144, -524288, -1048576, -2097152, -4194304, -8388608, -16777216, -33554432, -67108864, -134217728, -268435456, -536870912, -1073741824, -2147483648, -4294967296, -8589934592, -17179869184, -34359738368, -68719476736, -137438953472, -274877906944, -549755813888, -1099511627776, -2199023255552, -4398046511104, -8796093022208, -17592186044416, -35184372088832, -70368744177664, -140737488355328, -281474976710656, -562949953421312, -1125899906842624, -2251799813685248, -4503599627370496, -9007199254740992, -18014398509481984, -36028797018963968, -72057594037927936, -144115188075855872, -288230376151711744, -576460752303423488, -1152921504606846976, -2305843009213693952, -4611686018427387904, -9223372036854775808, 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "DU08BITS" { + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + (0,0): 255, 254, 252, 248, 240, 224, 192, 128, + (1,0): 254, 252, 248, 240, 224, 192, 128, 0, + (2,0): 252, 248, 240, 224, 192, 128, 0, 0, + (3,0): 248, 240, 224, 192, 128, 0, 0, 0, + (4,0): 240, 224, 192, 128, 0, 0, 0, 0, + (5,0): 224, 192, 128, 0, 0, 0, 0, 0, + (6,0): 192, 128, 0, 0, 0, 0, 0, 0, + (7,0): 128, 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "DU16BITS" { + DATATYPE H5T_STD_U16LE + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + (0,0): 65535, 65534, 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, + (1,0): 65534, 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, 0, + (2,0): 65532, 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, 0, 0, + (3,0): 65528, 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, 0, 0, 0, + (4,0): 65520, 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, 0, 0, 0, 0, + (5,0): 65504, 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, 0, 0, 0, 0, 0, + (6,0): 65472, 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, 0, 0, 0, 0, 0, 0, + (7,0): 65408, 65280, 65024, 64512, 63488, 61440, 57344, 49152, 32768, 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "DU32BITS" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 8, 32 ) / ( 8, 32 ) } + DATA { + (0,0): 4294967295, 4294967294, 4294967292, 4294967288, 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, + (1,0): 4294967294, 4294967292, 4294967288, 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, 0, + (2,0): 4294967292, 4294967288, 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, + (3,0): 4294967288, 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, + (4,0): 4294967280, 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, 0, + (5,0): 4294967264, 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, 0, 0, + (6,0): 4294967232, 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, 0, 0, 0, + (7,0): 4294967168, 4294967040, 4294966784, 4294966272, 4294965248, 4294963200, 4294959104, 4294950912, 4294934528, 4294901760, 4294836224, 4294705152, 4294443008, 4293918720, 4292870144, 4290772992, 4286578688, 4278190080, 4261412864, 4227858432, 4160749568, 4026531840, 3758096384, 3221225472, 2147483648, 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "DU64BITS" { + DATATYPE H5T_STD_U64LE + DATASPACE SIMPLE { ( 8, 64 ) / ( 8, 64 ) } + DATA { + (0,0): 18446744073709551615, 18446744073709551614, 18446744073709551612, 18446744073709551608, 18446744073709551600, 18446744073709551584, 18446744073709551552, 18446744073709551488, 18446744073709551360, 18446744073709551104, 18446744073709550592, 18446744073709549568, 18446744073709547520, 18446744073709543424, 18446744073709535232, 18446744073709518848, 18446744073709486080, 18446744073709420544, 18446744073709289472, 18446744073709027328, 18446744073708503040, 18446744073707454464, 18446744073705357312, 18446744073701163008, 18446744073692774400, 18446744073675997184, 18446744073642442752, 18446744073575333888, 18446744073441116160, 18446744073172680704, 18446744072635809792, 18446744071562067968, 18446744069414584320, 18446744065119617024, 18446744056529682432, 18446744039349813248, 18446744004990074880, 18446743936270598144, 18446743798831644672, 18446743523953737728, 18446742974197923840, 18446741874686296064, 18446739675663040512, 18446735277616529408, 18446726481523507200, 18446708889337462784, 18446673704965373952, 18446603336221196288, 18446462598732840960, 18446181123756130304, 18445618173802708992, 18444492273895866368, 18442240474082181120, 18437736874454810624, 18428729675200069632, 18410715276690587648, 18374686479671623680, 18302628885633695744, 18158513697557839872, 17870283321406128128, 17293822569102704640, 16140901064495857664, 13835058055282163712, 9223372036854775808, + (1,0): 18446744073709551614, 18446744073709551612, 18446744073709551608, 18446744073709551600, 18446744073709551584, 18446744073709551552, 18446744073709551488, 18446744073709551360, 18446744073709551104, 18446744073709550592, 18446744073709549568, 18446744073709547520, 18446744073709543424, 18446744073709535232, 18446744073709518848, 18446744073709486080, 18446744073709420544, 18446744073709289472, 18446744073709027328, 18446744073708503040, 18446744073707454464, 18446744073705357312, 18446744073701163008, 18446744073692774400, 18446744073675997184, 18446744073642442752, 18446744073575333888, 18446744073441116160, 18446744073172680704, 18446744072635809792, 18446744071562067968, 18446744069414584320, 18446744065119617024, 18446744056529682432, 18446744039349813248, 18446744004990074880, 18446743936270598144, 18446743798831644672, 18446743523953737728, 18446742974197923840, 18446741874686296064, 18446739675663040512, 18446735277616529408, 18446726481523507200, 18446708889337462784, 18446673704965373952, 18446603336221196288, 18446462598732840960, 18446181123756130304, 18445618173802708992, 18444492273895866368, 18442240474082181120, 18437736874454810624, 18428729675200069632, 18410715276690587648, 18374686479671623680, 18302628885633695744, 18158513697557839872, 17870283321406128128, 17293822569102704640, 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, + (2,0): 18446744073709551612, 18446744073709551608, 18446744073709551600, 18446744073709551584, 18446744073709551552, 18446744073709551488, 18446744073709551360, 18446744073709551104, 18446744073709550592, 18446744073709549568, 18446744073709547520, 18446744073709543424, 18446744073709535232, 18446744073709518848, 18446744073709486080, 18446744073709420544, 18446744073709289472, 18446744073709027328, 18446744073708503040, 18446744073707454464, 18446744073705357312, 18446744073701163008, 18446744073692774400, 18446744073675997184, 18446744073642442752, 18446744073575333888, 18446744073441116160, 18446744073172680704, 18446744072635809792, 18446744071562067968, 18446744069414584320, 18446744065119617024, 18446744056529682432, 18446744039349813248, 18446744004990074880, 18446743936270598144, 18446743798831644672, 18446743523953737728, 18446742974197923840, 18446741874686296064, 18446739675663040512, 18446735277616529408, 18446726481523507200, 18446708889337462784, 18446673704965373952, 18446603336221196288, 18446462598732840960, 18446181123756130304, 18445618173802708992, 18444492273895866368, 18442240474082181120, 18437736874454810624, 18428729675200069632, 18410715276690587648, 18374686479671623680, 18302628885633695744, 18158513697557839872, 17870283321406128128, 17293822569102704640, 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, + (3,0): 18446744073709551608, 18446744073709551600, 18446744073709551584, 18446744073709551552, 18446744073709551488, 18446744073709551360, 18446744073709551104, 18446744073709550592, 18446744073709549568, 18446744073709547520, 18446744073709543424, 18446744073709535232, 18446744073709518848, 18446744073709486080, 18446744073709420544, 18446744073709289472, 18446744073709027328, 18446744073708503040, 18446744073707454464, 18446744073705357312, 18446744073701163008, 18446744073692774400, 18446744073675997184, 18446744073642442752, 18446744073575333888, 18446744073441116160, 18446744073172680704, 18446744072635809792, 18446744071562067968, 18446744069414584320, 18446744065119617024, 18446744056529682432, 18446744039349813248, 18446744004990074880, 18446743936270598144, 18446743798831644672, 18446743523953737728, 18446742974197923840, 18446741874686296064, 18446739675663040512, 18446735277616529408, 18446726481523507200, 18446708889337462784, 18446673704965373952, 18446603336221196288, 18446462598732840960, 18446181123756130304, 18445618173802708992, 18444492273895866368, 18442240474082181120, 18437736874454810624, 18428729675200069632, 18410715276690587648, 18374686479671623680, 18302628885633695744, 18158513697557839872, 17870283321406128128, 17293822569102704640, 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, 0, + (4,0): 18446744073709551600, 18446744073709551584, 18446744073709551552, 18446744073709551488, 18446744073709551360, 18446744073709551104, 18446744073709550592, 18446744073709549568, 18446744073709547520, 18446744073709543424, 18446744073709535232, 18446744073709518848, 18446744073709486080, 18446744073709420544, 18446744073709289472, 18446744073709027328, 18446744073708503040, 18446744073707454464, 18446744073705357312, 18446744073701163008, 18446744073692774400, 18446744073675997184, 18446744073642442752, 18446744073575333888, 18446744073441116160, 18446744073172680704, 18446744072635809792, 18446744071562067968, 18446744069414584320, 18446744065119617024, 18446744056529682432, 18446744039349813248, 18446744004990074880, 18446743936270598144, 18446743798831644672, 18446743523953737728, 18446742974197923840, 18446741874686296064, 18446739675663040512, 18446735277616529408, 18446726481523507200, 18446708889337462784, 18446673704965373952, 18446603336221196288, 18446462598732840960, 18446181123756130304, 18445618173802708992, 18444492273895866368, 18442240474082181120, 18437736874454810624, 18428729675200069632, 18410715276690587648, 18374686479671623680, 18302628885633695744, 18158513697557839872, 17870283321406128128, 17293822569102704640, 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, 0, 0, + (5,0): 18446744073709551584, 18446744073709551552, 18446744073709551488, 18446744073709551360, 18446744073709551104, 18446744073709550592, 18446744073709549568, 18446744073709547520, 18446744073709543424, 18446744073709535232, 18446744073709518848, 18446744073709486080, 18446744073709420544, 18446744073709289472, 18446744073709027328, 18446744073708503040, 18446744073707454464, 18446744073705357312, 18446744073701163008, 18446744073692774400, 18446744073675997184, 18446744073642442752, 18446744073575333888, 18446744073441116160, 18446744073172680704, 18446744072635809792, 18446744071562067968, 18446744069414584320, 18446744065119617024, 18446744056529682432, 18446744039349813248, 18446744004990074880, 18446743936270598144, 18446743798831644672, 18446743523953737728, 18446742974197923840, 18446741874686296064, 18446739675663040512, 18446735277616529408, 18446726481523507200, 18446708889337462784, 18446673704965373952, 18446603336221196288, 18446462598732840960, 18446181123756130304, 18445618173802708992, 18444492273895866368, 18442240474082181120, 18437736874454810624, 18428729675200069632, 18410715276690587648, 18374686479671623680, 18302628885633695744, 18158513697557839872, 17870283321406128128, 17293822569102704640, 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, 0, 0, 0, + (6,0): 18446744073709551552, 18446744073709551488, 18446744073709551360, 18446744073709551104, 18446744073709550592, 18446744073709549568, 18446744073709547520, 18446744073709543424, 18446744073709535232, 18446744073709518848, 18446744073709486080, 18446744073709420544, 18446744073709289472, 18446744073709027328, 18446744073708503040, 18446744073707454464, 18446744073705357312, 18446744073701163008, 18446744073692774400, 18446744073675997184, 18446744073642442752, 18446744073575333888, 18446744073441116160, 18446744073172680704, 18446744072635809792, 18446744071562067968, 18446744069414584320, 18446744065119617024, 18446744056529682432, 18446744039349813248, 18446744004990074880, 18446743936270598144, 18446743798831644672, 18446743523953737728, 18446742974197923840, 18446741874686296064, 18446739675663040512, 18446735277616529408, 18446726481523507200, 18446708889337462784, 18446673704965373952, 18446603336221196288, 18446462598732840960, 18446181123756130304, 18445618173802708992, 18444492273895866368, 18442240474082181120, 18437736874454810624, 18428729675200069632, 18410715276690587648, 18374686479671623680, 18302628885633695744, 18158513697557839872, 17870283321406128128, 17293822569102704640, 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, 0, 0, 0, 0, + (7,0): 18446744073709551488, 18446744073709551360, 18446744073709551104, 18446744073709550592, 18446744073709549568, 18446744073709547520, 18446744073709543424, 18446744073709535232, 18446744073709518848, 18446744073709486080, 18446744073709420544, 18446744073709289472, 18446744073709027328, 18446744073708503040, 18446744073707454464, 18446744073705357312, 18446744073701163008, 18446744073692774400, 18446744073675997184, 18446744073642442752, 18446744073575333888, 18446744073441116160, 18446744073172680704, 18446744072635809792, 18446744071562067968, 18446744069414584320, 18446744065119617024, 18446744056529682432, 18446744039349813248, 18446744004990074880, 18446743936270598144, 18446743798831644672, 18446743523953737728, 18446742974197923840, 18446741874686296064, 18446739675663040512, 18446735277616529408, 18446726481523507200, 18446708889337462784, 18446673704965373952, 18446603336221196288, 18446462598732840960, 18446181123756130304, 18445618173802708992, 18444492273895866368, 18442240474082181120, 18437736874454810624, 18428729675200069632, 18410715276690587648, 18374686479671623680, 18302628885633695744, 18158513697557839872, 17870283321406128128, 17293822569102704640, 16140901064495857664, 13835058055282163712, 9223372036854775808, 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "DummyDBL" { + DATATYPE H5T_IEEE_F64BE + DATASPACE SIMPLE { ( 8, 8 ) / ( 8, 8 ) } + DATA { + (0,0): 0, 0.0001, 0.0002, 0.0003, 0.0004, 0.0005, 0.0006, 0.0007, + (1,0): 1, 1.0001, 1.0002, 1.0003, 1.0004, 1.0005, 1.0006, 1.0007, + (2,0): 2, 2.0001, 2.0002, 2.0003, 2.0004, 2.0005, 2.0006, 2.0007, + (3,0): 3, 3.0001, 3.0002, 3.0003, 3.0004, 3.0005, 3.0006, 3.0007, + (4,0): 4, 4.0001, 4.0002, 4.0003, 4.0004, 4.0005, 4.0006, 4.0007, + (5,0): 5, 5.0001, 5.0002, 5.0003, 5.0004, 5.0005, 5.0006, 5.0007, + (6,0): 6, 6.0001, 6.0002, 6.0003, 6.0004, 6.0005, 6.0006, 6.0007, + (7,0): 7, 7.0001, 7.0002, 7.0003, 7.0004, 7.0005, 7.0006, 7.0007 + } + } +} +} |