diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-06-10 21:04:13 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-06-10 21:04:13 (GMT) |
commit | 3382eea1daf1def893bc7751e30bf08300d6315f (patch) | |
tree | 4d73146c8cba9fb5d2e143e4071bed6bef6ad591 /tools | |
parent | b795b5bf2e0a8dc75956c388d0709db43e3efcf4 (diff) | |
download | hdf5-3382eea1daf1def893bc7751e30bf08300d6315f.zip hdf5-3382eea1daf1def893bc7751e30bf08300d6315f.tar.gz hdf5-3382eea1daf1def893bc7751e30bf08300d6315f.tar.bz2 |
[svn-r8650] Purpose:
h5dump update
Description:
updated the h5dump test file generator so that it coincides with the 1.7 branch
Solution:
Platforms tested:
linux (small change)
Misc. update:
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 576 | ||||
-rw-r--r-- | tools/testfiles/tcontents.ddl | 1 | ||||
-rw-r--r-- | tools/testfiles/tfilters.h5 | bin | 43936 -> 48928 bytes | |||
-rw-r--r-- | tools/testfiles/treference.ddl | 4 | ||||
-rw-r--r-- | tools/testfiles/tszip.ddl | 20 |
5 files changed, 310 insertions, 291 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index f9fcdd7..4cee24b 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -100,11 +100,11 @@ set_local_myfilter(hid_t dcpl_id, hid_t type_id, hid_t UNUSED space_id); /* This message derives from H5Z */ const H5Z_class_t H5Z_MYFILTER[1] = {{ - MYFILTER_ID, /* Filter id number */ - "myfilter", /* Filter name for debugging */ + MYFILTER_ID, /* Filter id number */ + "myfilter", /* Filter name for debugging */ NULL, /* The "can apply" callback */ set_local_myfilter, /* The "set local" callback */ - myfilter, /* The actual filter function */ + myfilter, /* The actual filter function */ }}; @@ -2241,13 +2241,13 @@ static void gent_vldatatypes4(void) static void gent_vldatatypes5(void) { hvl_t wdata [SPACE1_DIM1]; - hid_t fid1; - hid_t dataset; - hid_t sid1; - hid_t tid1; - hsize_t dims1[] = {SPACE1_DIM1}; + hid_t fid1; + hid_t dataset; + hid_t sid1; + hid_t tid1; + hsize_t dims1[] = {SPACE1_DIM1}; int i,j; /* counting variable */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* initialize data for dataset */ for(i=0; i<SPACE1_DIM1; i++) { @@ -3079,13 +3079,13 @@ 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 file_id) + const char* dset_name, /* for saving reference to dataset*/ + hid_t file_id) { /* Compound datatype */ typedef struct s_t { - char a; + char a; double b; } s_t; @@ -3100,55 +3100,55 @@ static void write_attr_in(hid_t loc_id, hid_t type_id; herr_t status; int val, i, j, k, n; - float f; + float f; - /* create 1D attributes with dimension [2], 2 elements */ + /* create 1D attributes with dimension [2], 2 elements */ hsize_t dims[1]={2}; - char buf1[2][2]= {"ab","de"}; /* string */ + 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 */ + int buf7[2]= {1,2}; /* integer */ + float buf8[2]= {1,2}; /* float */ - /* create 2D attributes with dimension [3][2], 6 elements */ + /* 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 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 */ + 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 */ + /* 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 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 */ + int buf73[4][3][2]; /* integer */ + float buf83[4][3][2]; /* float */ /*------------------------------------------------------------------------- * 1D attributes *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ - type_id = H5Tcopy(H5T_C_S1); + type_id = H5Tcopy(H5T_C_S1); status = H5Tset_size(type_id, 2); write_attr(loc_id,1,dims,"string",type_id,buf1); status = H5Tclose(type_id); @@ -3176,7 +3176,7 @@ static void write_attr_in(hid_t loc_id, */ type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_attr(loc_id,1,dims,"compound",type_id,buf3); status = H5Tclose(type_id); @@ -3185,12 +3185,12 @@ static void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - status=H5Rcreate(&buf4[0],file_id,dset_name,H5R_OBJECT,-1); - status=H5Rcreate(&buf4[1],file_id,dset_name,H5R_OBJECT,-1); - write_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); - } + if (dset_name) + { + status=H5Rcreate(&buf4[0],file_id,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf4[1],file_id,dset_name,H5R_OBJECT,-1); + write_attr(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); + } /*------------------------------------------------------------------------- * H5T_ENUM @@ -3209,13 +3209,13 @@ static void write_attr_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ - buf5[0].len = 1; - buf5[0].p = malloc( 1 * sizeof(int)); - ((int *)buf5[0].p)[0]=1; - buf5[1].len = 2; - buf5[1].p = malloc( 2 * sizeof(int)); - ((int *)buf5[1].p)[0]=2; - ((int *)buf5[1].p)[1]=3; + buf5[0].len = 1; + buf5[0].p = malloc( 1 * sizeof(int)); + ((int *)buf5[0].p)[0]=1; + buf5[1].len = 2; + buf5[1].p = malloc( 2 * sizeof(int)); + ((int *)buf5[1].p)[0]=2; + ((int *)buf5[1].p)[1]=3; space_id = H5Screate_simple(1,dims,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); @@ -3253,7 +3253,7 @@ static void write_attr_in(hid_t loc_id, * H5T_STRING *------------------------------------------------------------------------- */ - type_id = H5Tcopy(H5T_C_S1); + type_id = H5Tcopy(H5T_C_S1); status = H5Tset_size(type_id, 2); write_attr(loc_id,2,dims2,"string2D",type_id,buf12); status = H5Tclose(type_id); @@ -3281,7 +3281,7 @@ static void write_attr_in(hid_t loc_id, */ type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_attr(loc_id,2,dims2,"compound2D",type_id,buf32); status = H5Tclose(type_id); @@ -3290,15 +3290,15 @@ static void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 3; i++) { + if (dset_name) + { + for (i = 0; i < 3; i++) { for (j = 0; j < 2; j++) { status=H5Rcreate(&buf42[i][j],file_id,dset_name,H5R_OBJECT,-1); - } - } - write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); - } + } + } + write_attr(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); + } /*------------------------------------------------------------------------- * H5T_ENUM @@ -3315,17 +3315,17 @@ static void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - /* 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 = malloc((i + 1) * sizeof(int)); - buf52[i][j].len = i + 1; - for (l = 0; l < i + 1; l++) - ((int *)buf52[i][j].p)[l] = n++; - } - } + /* 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 = malloc((i + 1) * sizeof(int)); + buf52[i][j].len = i + 1; + for (l = 0; l < i + 1; l++) + ((int *)buf52[i][j].p)[l] = n++; + } + } space_id = H5Screate_simple(2,dims2,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); @@ -3353,7 +3353,7 @@ static void write_attr_in(hid_t loc_id, write_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72); write_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - + /*------------------------------------------------------------------------- * 3D attributes *------------------------------------------------------------------------- @@ -3363,7 +3363,7 @@ static void write_attr_in(hid_t loc_id, * H5T_STRING *------------------------------------------------------------------------- */ - type_id = H5Tcopy(H5T_C_S1); + type_id = H5Tcopy(H5T_C_S1); status = H5Tset_size(type_id, 2); write_attr(loc_id,3,dims3,"string3D",type_id,buf13); status = H5Tclose(type_id); @@ -3373,14 +3373,14 @@ static void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - 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++; - } - } - } + 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++; + } + } + } type_id = H5Tcopy(H5T_STD_B8LE); write_attr(loc_id,3,dims3,"bitfield3D",type_id,buf23); status = H5Tclose(type_id); @@ -3399,18 +3399,18 @@ static void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - 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++; - } - } - } + 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++; + } + } + } type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_attr(loc_id,3,dims3,"compound3D",type_id,buf33); status = H5Tclose(type_id); @@ -3419,16 +3419,16 @@ static void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 4; i++) { + 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],file_id,dset_name,H5R_OBJECT,-1); - } - } - write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); - } + } + } + write_attr(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); + } /*------------------------------------------------------------------------- * H5T_ENUM @@ -3445,19 +3445,19 @@ static void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - /* 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 = malloc((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++; - } - } - } + /* 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 = malloc((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++; + } + } + } space_id = H5Screate_simple(3,dims3,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); @@ -3475,11 +3475,11 @@ static void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ n=1; - for (i = 0; i < 24; i++) { - for (j = 0; j < (int)dimarray[0]; j++) { - buf63[i][j]=n++; - } - } + for (i = 0; i < 24; i++) { + for (j = 0; j < (int)dimarray[0]; j++) { + buf63[i][j]=n++; + } + } type_id = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); write_attr(loc_id,3,dims3,"array3D",type_id,buf63); @@ -3489,15 +3489,15 @@ static void write_attr_in(hid_t loc_id, * 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++; - } - } - } + 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); } @@ -3519,13 +3519,13 @@ 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 file_id) + const char* dset_name, /* for saving reference to dataset*/ + hid_t file_id) { /* Compound datatype */ typedef struct s_t { - char a; + char a; double b; } s_t; @@ -3538,59 +3538,59 @@ static void write_dset_in(hid_t loc_id, hid_t dset_id; hid_t space_id; hid_t type_id; - hid_t plist_id; + hid_t plist_id; herr_t status; int val, i, j, k, n; - float f; - int fillvalue=2; + float f; + int fillvalue=2; - /* create 1D attributes with dimension [2], 2 elements */ + /* create 1D attributes with dimension [2], 2 elements */ hsize_t dims[1]={2}; - char buf1[2][2]= {"ab","de"}; /* string */ + 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 */ + int buf7[2]= {1,2}; /* integer */ + float buf8[2]= {1,2}; /* float */ - /* create 2D attributes with dimension [3][2], 6 elements */ + /* 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 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 */ + 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 */ + /* 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 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 */ + int buf73[4][3][2]; /* integer */ + float buf83[4][3][2]; /* float */ /*------------------------------------------------------------------------- * 1D *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ - type_id = H5Tcopy(H5T_C_S1); + type_id = H5Tcopy(H5T_C_S1); status = H5Tset_size(type_id, 2); write_dset(loc_id,1,dims,"string",type_id,buf1); status = H5Tclose(type_id); @@ -3618,7 +3618,7 @@ static void write_dset_in(hid_t loc_id, */ type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,1,dims,"compound",type_id,buf3); status = H5Tclose(type_id); @@ -3627,12 +3627,12 @@ static void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - status=H5Rcreate(&buf4[0],file_id,dset_name,H5R_OBJECT,-1); - status=H5Rcreate(&buf4[1],file_id,dset_name,H5R_OBJECT,-1); - write_dset(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); - } + if (dset_name) + { + status=H5Rcreate(&buf4[0],file_id,dset_name,H5R_OBJECT,-1); + status=H5Rcreate(&buf4[1],file_id,dset_name,H5R_OBJECT,-1); + write_dset(loc_id,1,dims,"reference",H5T_STD_REF_OBJ,buf4); + } /*------------------------------------------------------------------------- * H5T_ENUM @@ -3651,13 +3651,13 @@ static void write_dset_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ - buf5[0].len = 1; - buf5[0].p = malloc( 1 * sizeof(int)); - ((int *)buf5[0].p)[0]=1; - buf5[1].len = 2; - buf5[1].p = malloc( 2 * sizeof(int)); - ((int *)buf5[1].p)[0]=2; - ((int *)buf5[1].p)[1]=3; + buf5[0].len = 1; + buf5[0].p = malloc( 1 * sizeof(int)); + ((int *)buf5[0].p)[0]=1; + buf5[1].len = 2; + buf5[1].p = malloc( 2 * sizeof(int)); + ((int *)buf5[1].p)[0]=2; + ((int *)buf5[1].p)[1]=3; space_id = H5Screate_simple(1,dims,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); @@ -3695,7 +3695,7 @@ static void write_dset_in(hid_t loc_id, * H5T_STRING *------------------------------------------------------------------------- */ - type_id = H5Tcopy(H5T_C_S1); + type_id = H5Tcopy(H5T_C_S1); status = H5Tset_size(type_id, 2); write_dset(loc_id,2,dims2,"string2D",type_id,buf12); status = H5Tclose(type_id); @@ -3723,7 +3723,7 @@ static void write_dset_in(hid_t loc_id, */ type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,2,dims2,"compound2D",type_id,buf32); status = H5Tclose(type_id); @@ -3732,15 +3732,15 @@ static void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 3; i++) { + if (dset_name) + { + for (i = 0; i < 3; i++) { for (j = 0; j < 2; j++) { status=H5Rcreate(&buf42[i][j],file_id,dset_name,H5R_OBJECT,-1); - } - } - write_dset(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); - } + } + } + write_dset(loc_id,2,dims2,"reference2D",H5T_STD_REF_OBJ,buf42); + } /*------------------------------------------------------------------------- * H5T_ENUM @@ -3757,17 +3757,17 @@ static void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - /* 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 = malloc((i + 1) * sizeof(int)); - buf52[i][j].len = i + 1; - for (l = 0; l < i + 1; l++) - ((int *)buf52[i][j].p)[l] = n++; - } - } + /* 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 = malloc((i + 1) * sizeof(int)); + buf52[i][j].len = i + 1; + for (l = 0; l < i + 1; l++) + ((int *)buf52[i][j].p)[l] = n++; + } + } space_id = H5Screate_simple(2,dims2,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); @@ -3792,13 +3792,13 @@ static void write_dset_in(hid_t loc_id, * H5T_INTEGER, write a fill value *------------------------------------------------------------------------- */ - plist_id = H5Pcreate(H5P_DATASET_CREATE); - status = H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue); - space_id = H5Screate_simple(2,dims2,NULL); - dset_id = H5Dcreate(loc_id,"integer2D",H5T_NATIVE_INT,space_id,plist_id); - status = H5Dwrite(dset_id,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf72); - status = H5Pclose(plist_id); - status = H5Dclose(dset_id); + plist_id = H5Pcreate(H5P_DATASET_CREATE); + status = H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue); + space_id = H5Screate_simple(2,dims2,NULL); + dset_id = H5Dcreate(loc_id,"integer2D",H5T_NATIVE_INT,space_id,plist_id); + status = H5Dwrite(dset_id,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf72); + status = H5Pclose(plist_id); + status = H5Dclose(dset_id); status = H5Sclose(space_id); /*------------------------------------------------------------------------- @@ -3808,7 +3808,7 @@ static void write_dset_in(hid_t loc_id, write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - + /*------------------------------------------------------------------------- * 3D *------------------------------------------------------------------------- @@ -3818,7 +3818,7 @@ static void write_dset_in(hid_t loc_id, * H5T_STRING *------------------------------------------------------------------------- */ - type_id = H5Tcopy(H5T_C_S1); + type_id = H5Tcopy(H5T_C_S1); status = H5Tset_size(type_id, 2); write_dset(loc_id,3,dims3,"string3D",type_id,buf13); status = H5Tclose(type_id); @@ -3828,14 +3828,14 @@ static void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - 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++; - } - } - } + 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++; + } + } + } type_id = H5Tcopy(H5T_STD_B8LE); write_dset(loc_id,3,dims3,"bitfield3D",type_id,buf23); status = H5Tclose(type_id); @@ -3854,18 +3854,18 @@ static void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - 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++; - } - } - } + 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++; + } + } + } type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); + H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,3,dims3,"compound3D",type_id,buf33); status = H5Tclose(type_id); @@ -3874,16 +3874,16 @@ static void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ /* Create references to dataset */ - if (dset_name) - { - for (i = 0; i < 4; i++) { + 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],file_id,dset_name,H5R_OBJECT,-1); - } - } - write_dset(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); - } + } + } + write_dset(loc_id,3,dims3,"reference3D",H5T_STD_REF_OBJ,buf43); + } /*------------------------------------------------------------------------- * H5T_ENUM @@ -3900,19 +3900,19 @@ static void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - /* 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 = malloc((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++; - } - } - } + /* 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 = malloc((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++; + } + } + } space_id = H5Screate_simple(3,dims3,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); @@ -3930,11 +3930,11 @@ static void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ n=1; - for (i = 0; i < 24; i++) { - for (j = 0; j < (int)dimarray[0]; j++) { - buf63[i][j]=n++; - } - } + for (i = 0; i < 24; i++) { + for (j = 0; j < (int)dimarray[0]; j++) { + buf63[i][j]=n++; + } + } type_id = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); write_dset(loc_id,3,dims3,"array3D",type_id,buf63); @@ -3944,15 +3944,15 @@ static void write_dset_in(hid_t loc_id, * 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++; - } - } - } + 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); } @@ -3978,25 +3978,25 @@ static void gent_attr_all(void) { hid_t file_id; hid_t dset_id; - hid_t group_id; - hid_t group2_id; - hid_t root_id; - hid_t space_id; - hsize_t dims[1]={2}; + hid_t group_id; + hid_t group2_id; + hid_t root_id; + hid_t space_id; + hsize_t dims[1]={2}; herr_t status; /* Create a file and a dataset */ file_id = H5Fcreate(FILE40, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - /* Create a 1D dataset */ + /* Create a 1D dataset */ space_id = H5Screate_simple(1,dims,NULL); dset_id = H5Dcreate(file_id,"dset",H5T_NATIVE_INT,space_id,H5P_DEFAULT); status = H5Sclose(space_id); assert(status>=0); - /* Create groups */ + /* Create groups */ group_id = H5Gcreate(file_id,"g1",0); - group2_id = H5Gcreate(file_id,"g2",0); + group2_id = H5Gcreate(file_id,"g2",0); root_id = H5Gopen(file_id, "/"); /*------------------------------------------------------------------------- @@ -4004,28 +4004,28 @@ static void gent_attr_all(void) *------------------------------------------------------------------------- */ - write_attr_in(dset_id,"dset",file_id); - write_attr_in(group_id,NULL,0); - write_attr_in(root_id,NULL,0); + write_attr_in(dset_id,"dset",file_id); + write_attr_in(group_id,NULL,0); + write_attr_in(root_id,NULL,0); /*------------------------------------------------------------------------- * write a series of datasets on group 2 *------------------------------------------------------------------------- */ - write_dset_in(group2_id,"/dset",file_id); + write_dset_in(group2_id,"/dset",file_id); /* Close */ status = H5Dclose(dset_id); assert(status>=0); - status = H5Gclose(group_id); + status = H5Gclose(group_id); assert(status>=0); - status = H5Gclose(group2_id); + status = H5Gclose(group2_id); assert(status>=0); - status = H5Gclose(root_id); + status = H5Gclose(root_id); assert(status>=0); - /* Close file */ + /* Close file */ status = H5Fclose(file_id); assert(status>=0); } @@ -4118,12 +4118,12 @@ 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; + 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]; @@ -4160,24 +4160,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'; } @@ -4188,7 +4188,7 @@ static void gent_compound_complex(void) /* Create the file */ datafile = H5Fcreate(FILE41, H5F_ACC_TRUNC, H5P_DEFAULT, - H5P_DEFAULT); + H5P_DEFAULT); assert (datafile >= 0); /* Copy the array data type for the string array */ @@ -4201,7 +4201,7 @@ static void gent_compound_complex(void) /* Create the array data type for the string array */ str_array_id = H5Tarray_create(array_tid, F41_ARRAY_RANK, - array_dimb, NULL); + array_dimb, NULL); assert (str_array_id >= 0); /* Copy the array data type for the character array */ @@ -4214,12 +4214,12 @@ static void gent_compound_complex(void) /* Create the array data type for the character array */ array2_tid = H5Tarray_create(H5T_NATIVE_SHORT, F41_ARRAY_RANKd, - array_dimd, NULL); + array_dimd, NULL); assert (array2_tid >= 0); /* Create the array data type for the character array */ array4_tid = H5Tarray_create(H5T_NATIVE_DOUBLE, F41_ARRAY_RANK, - array_dimf, NULL); + array_dimf, NULL); assert (array4_tid >= 0); /* Create the memory data type */ @@ -4228,40 +4228,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); assert (status >= 0); status = H5Tinsert(Array1Structid, "b_name", - HOFFSET(Array1Struct, b), str_array_id); + HOFFSET(Array1Struct, b), str_array_id); assert (status >= 0); status = H5Tinsert(Array1Structid, "c_name", - HOFFSET(Array1Struct, c), array1_tid); + HOFFSET(Array1Struct, c), array1_tid); assert (status >= 0); status = H5Tinsert(Array1Structid, "d_name", - HOFFSET(Array1Struct, d), array2_tid); + HOFFSET(Array1Struct, d), array2_tid); assert (status >= 0); status = H5Tinsert(Array1Structid, "e_name", - HOFFSET(Array1Struct, e), H5T_NATIVE_FLOAT); + HOFFSET(Array1Struct, e), H5T_NATIVE_FLOAT); assert (status >= 0); status = H5Tinsert(Array1Structid, "f_name", - HOFFSET(Array1Struct, f), array4_tid); + HOFFSET(Array1Struct, f), array4_tid); assert (status >= 0); status = H5Tinsert(Array1Structid, "g_name", - HOFFSET(Array1Struct, g), H5T_NATIVE_CHAR); + HOFFSET(Array1Struct, g), H5T_NATIVE_CHAR); assert (status >= 0); /* Create the dataset */ dataset = H5Dcreate(datafile, F41_DATASETNAME, Array1Structid, - dataspace, H5P_DEFAULT); + dataspace, H5P_DEFAULT); /* Write data to the dataset */ status = H5Dwrite(dataset, Array1Structid, H5S_ALL, H5S_ALL, - H5P_DEFAULT, Array1); + H5P_DEFAULT, Array1); assert (status >= 0); /* Release resources */ @@ -4404,9 +4404,9 @@ 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 */ + 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; @@ -4741,13 +4741,13 @@ static void gent_filters() *------------------------------------------------------------------------- */ - buf2[0].len = 1; - buf2[0].p = malloc( 1 * sizeof(int)); - ((int *)buf2[0].p)[0]=1; - buf2[1].len = 2; - buf2[1].p = malloc( 2 * sizeof(int)); - ((int *)buf2[1].p)[0]=2; - ((int *)buf2[1].p)[1]=3; + buf2[0].len = 1; + buf2[0].p = malloc( 1 * sizeof(int)); + ((int *)buf2[0].p)[0]=1; + buf2[1].len = 2; + buf2[1].p = malloc( 2 * sizeof(int)); + ((int *)buf2[1].p)[0]=2; + ((int *)buf2[1].p)[1]=3; sid1=H5Screate_simple(1,dims2,NULL); tid=H5Tvlen_create(H5T_NATIVE_INT); diff --git a/tools/testfiles/tcontents.ddl b/tools/testfiles/tcontents.ddl index 4838c0a..5e5b683 100644 --- a/tools/testfiles/tcontents.ddl +++ b/tools/testfiles/tcontents.ddl @@ -22,6 +22,7 @@ FILE_CONTENTS { dataset /reference dataset /shuffle dataset /string + dataset /szip dataset /vlen } } diff --git a/tools/testfiles/tfilters.h5 b/tools/testfiles/tfilters.h5 Binary files differindex faf5e48..699a1f7 100644 --- a/tools/testfiles/tfilters.h5 +++ b/tools/testfiles/tfilters.h5 diff --git a/tools/testfiles/treference.ddl b/tools/testfiles/treference.ddl index 754a840..a470d73 100644 --- a/tools/testfiles/treference.ddl +++ b/tools/testfiles/treference.ddl @@ -6,8 +6,8 @@ DATASET "reference" { DATATYPE H5T_REFERENCE DATASPACE SIMPLE { ( 5 ) / ( 5 ) } DATA { - (0) DATASET 0:976 /compact , DATATYPE 0:15955 /myvlen , - (2) DATASET 0:976 /compact , DATATYPE 0:15955 /myvlen , + (0) DATASET 0:976 /compact , DATATYPE 0:4008 /myvlen , + (2) DATASET 0:976 /compact , DATATYPE 0:4008 /myvlen , (4) DATASET 0:2376 /contiguous } } diff --git a/tools/testfiles/tszip.ddl b/tools/testfiles/tszip.ddl index 02a5fd3..99ed2c9 100644 --- a/tools/testfiles/tszip.ddl +++ b/tools/testfiles/tszip.ddl @@ -3,6 +3,24 @@ Expected output for 'h5dump -H -p -d szip tfilters.h5' ############################# HDF5 "tfilters.h5" { DATASET "szip" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } + STORAGE_LAYOUT CHUNKED { + SIZE 372 ( 10, 5 ) } + FILTERS { + COMPRESSION SZIP { + PIXELS_PER_BLOCK 4 + MODE K13 + CODING NEAREST NEIGHBOUR + BYTE_ORDER LSB + HEADER RAW + } + } + FILLVALUE { + FILL_TIME IFSET + ALLOC_TIME INCR + VALUE -99 + } +} } -h5dump error: unable to open dataset "szip" |