summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/h5dumpgentest.c184
1 files changed, 91 insertions, 93 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 862ae60..16fe91b 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -379,7 +379,7 @@ gent_attribute(void)
/* attribute 1 */
dims[0] = 24;
space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate (root, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT);
+ attr = H5Acreate2(root, ".", "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(buf, "attribute of root group");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@@ -388,7 +388,7 @@ gent_attribute(void)
/* attribute 2 */
dims[0] = 10;
space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate (root, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT);
+ attr = H5Acreate2(root, ".", "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for (i = 0; i < 10; i++) data[i] = i+1;
@@ -399,7 +399,7 @@ gent_attribute(void)
/* attribute 3 */
dims[0] = 10;
space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate (root, "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT);
+ attr = H5Acreate2(root, ".", "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for (i = 0; i < 10; i++) d[i] = 0.1 * i;
@@ -409,7 +409,7 @@ gent_attribute(void)
/* attribute 4 */
space = H5Screate(H5S_SCALAR);
- attr = H5Acreate (root, "attr4", H5T_STD_I32BE, space, H5P_DEFAULT);
+ attr = H5Acreate2(root, ".", "attr4", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT, &point);
H5Sclose(space);
H5Aclose(attr);
@@ -418,7 +418,7 @@ gent_attribute(void)
space = H5Screate(H5S_SCALAR);
type = H5Tcopy(H5T_C_S1);
H5Tset_size(type, 17);
- attr = H5Acreate (root, "attr5", type, space, H5P_DEFAULT);
+ attr = H5Acreate2(root, ".", "attr5", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, type, string);
H5Tclose(type);
@@ -931,7 +931,7 @@ static void gent_all(void)
dims[0] = 10;
space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate (group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT);
+ attr = H5Acreate2(group, ".", "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(buf, "abcdefghi");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@@ -939,7 +939,7 @@ static void gent_all(void)
dims[0] = 2; dims[1] = 2;
space = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate (group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT);
+ attr = H5Acreate2(group, ".", "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
H5Awrite(attr, H5T_NATIVE_INT, data);
H5Sclose(space);
@@ -962,7 +962,7 @@ static void gent_all(void)
/* attributes of dset1.1.1 */
dims[0] = 27;
space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate (dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT);
+ attr = H5Acreate2(dataset, ".", "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(buf, "1st attribute of dset1.1.1");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@@ -970,7 +970,7 @@ static void gent_all(void)
dims[0] = 27;
space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate (dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT);
+ attr = H5Acreate2(dataset, ".", "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(buf, "2nd attribute of dset1.1.1");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@@ -1165,7 +1165,7 @@ static void gent_many(void)
/* add attributes to dset1 */
dims[0] = 10;
space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate (dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT);
+ attr = H5Acreate2(dataset, ".", "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(buf, "abcdefghi");
H5Awrite(attr, H5T_NATIVE_CHAR, buf);
H5Sclose(space2);
@@ -1173,7 +1173,7 @@ static void gent_many(void)
dims[0] = 2; dims[1] = 2;
space2 = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate (dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT);
+ attr = H5Acreate2(dataset, ".", "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
H5Awrite(attr, H5T_NATIVE_INT, data);
H5Sclose(space2);
@@ -1181,7 +1181,7 @@ static void gent_many(void)
dims[0] = 10;
space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate (dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT);
+ attr = H5Acreate2(dataset, ".", "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for (i = 0; i < 10; i++)
d[i] = 0.1 * i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
@@ -1489,7 +1489,7 @@ hsize_t sdim;
dims[0] = 3;
space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate (dataset, "attr1", fxdlenstr2, space2, H5P_DEFAULT);
+ attr = H5Acreate2(dataset, ".", "attr1", fxdlenstr2, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(&(buf2[0*LENSTR2]), "0123456789");
sprintf(&(buf2[1*LENSTR2]), "abcdefghij");
sprintf(&(buf2[2*LENSTR2]), "ABCDEFGHIJ");
@@ -2950,7 +2950,7 @@ void gent_split_file(void)
dims[0] = 1;
space = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate(root, "Metadata", atype, space, H5P_DEFAULT);
+ attr = H5Acreate2(root, ".", "Metadata", atype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, atype, meta);
H5Tclose(atype);
H5Sclose(space);
@@ -3120,7 +3120,7 @@ static void gent_vlstr(void)
root = H5Gopen2(fid1, "/", H5P_DEFAULT);
dataspace = H5Screate(H5S_SCALAR);
- att = H5Acreate(root, "test_scalar", tid1, dataspace, H5P_DEFAULT);
+ att = H5Acreate2(root, ".", "test_scalar", tid1, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(att, tid1, &string_att);
/* Close */
@@ -3312,20 +3312,20 @@ 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[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[1].p = malloc(2 * sizeof(int));
+ ((int *)buf5[1].p)[0] = 2;
+ ((int *)buf5[1].p)[1] = 3;
- sid = H5Screate_simple(1,dims,NULL);
+ sid = H5Screate_simple(1, dims, NULL);
tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate(loc_id,"vlen",tid,sid,H5P_DEFAULT);
- status = H5Awrite(aid,tid,buf5);
- assert(status>=0);
- status = H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf5);
- assert(status>=0);
+ aid = H5Acreate2(loc_id, ".", "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(aid, tid, buf5);
+ assert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
+ assert(status >= 0);
status = H5Aclose(aid);
status = H5Tclose(tid);
status = H5Sclose(sid);
@@ -3419,23 +3419,24 @@ 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++) {
+ 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++;
+ for(l = 0; l < i + 1; l++)
+ ((int *)buf52[i][j].p)[l] = n++;
}
}
- sid = H5Screate_simple(2,dims2,NULL);
+ sid = H5Screate_simple(2, dims2, NULL);
tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate(loc_id,"vlen2D",tid,sid,H5P_DEFAULT);
- status = H5Awrite(aid,tid,buf52);
- assert(status>=0);
- status = H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf52);
- assert(status>=0);
+ aid = H5Acreate2(loc_id, ".", "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(aid, tid, buf52);
+ assert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
+ assert(status >= 0);
status = H5Aclose(aid);
status = H5Tclose(tid);
status = H5Sclose(sid);
@@ -3548,26 +3549,27 @@ 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++) {
+ 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++;
+ for(l = 0; l < i + 1; l++)
+ ((int *)buf53[i][j][k].p)[l] = n++;
}
}
}
- sid = H5Screate_simple(3,dims3,NULL);
+ sid = H5Screate_simple(3, dims3, NULL);
tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate(loc_id,"vlen3D",tid,sid,H5P_DEFAULT);
- status = H5Awrite(aid,tid,buf53);
- assert(status>=0);
- status = H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf53);
- assert(status>=0);
+ aid = H5Acreate2(loc_id, ".", "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Awrite(aid, tid, buf53);
+ assert(status >= 0);
+ status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
+ assert(status >= 0);
status = H5Aclose(aid);
status = H5Tclose(tid);
status = H5Sclose(sid);
@@ -4154,18 +4156,19 @@ int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
herr_t status;
/* Create a buf space */
- sid = H5Screate_simple(rank,dims,NULL);
+ sid = H5Screate_simple(rank, dims, NULL);
/* Create the attribute */
- aid = H5Acreate(loc_id,attr_name,tid,sid,H5P_DEFAULT);
+ aid = H5Acreate2(loc_id, ".", attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write the buf */
- if ( buf )
- status = H5Awrite(aid,tid,buf);
+ if(buf)
+ status = H5Awrite(aid, tid, buf);
/* Close */
status = H5Aclose(aid);
status = H5Sclose(sid);
+
return status;
}
@@ -4417,16 +4420,16 @@ static void gent_named_dtype_attr(void)
assert(ret >= 0);
/* Create a scalar dataspace used for all objects */
- sid=H5Screate(H5S_SCALAR);
- assert(sid>0);
+ sid = H5Screate(H5S_SCALAR);
+ assert(sid > 0);
/* Create attribute on commited datatype */
- aid=H5Acreate(tid,F42_ATTRNAME,H5T_STD_I32LE,sid,H5P_DEFAULT);
- assert(aid>0);
+ aid = H5Acreate2(tid, ".", F42_ATTRNAME, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ assert(aid > 0);
/* Write data into the attribute */
- ret=H5Awrite(aid,H5T_NATIVE_INT,&data);
- assert(ret>=0);
+ ret = H5Awrite(aid, H5T_NATIVE_INT, &data);
+ assert(ret >= 0);
/*-------------------------------------------------------------------------
* dataset
@@ -4434,16 +4437,16 @@ static void gent_named_dtype_attr(void)
*/
/* Create dataset */
- did=H5Dcreate(fid,F42_DSETNAME,tid,sid,H5P_DEFAULT);
- assert(did>0);
+ did = H5Dcreate(fid, F42_DSETNAME, tid, sid, H5P_DEFAULT);
+ assert(did > 0);
/* Create attribute on dataset */
- aid=H5Acreate(did,F42_ATTRNAME,tid,sid,H5P_DEFAULT);
- assert(aid>0);
+ aid = H5Acreate2(did, ".", F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ assert(aid > 0);
/* Write data into the attribute */
- ret=H5Awrite(aid,H5T_NATIVE_INT,&data);
- assert(ret>=0);
+ ret = H5Awrite(aid, H5T_NATIVE_INT, &data);
+ assert(ret >= 0);
/*-------------------------------------------------------------------------
* group
@@ -4452,15 +4455,15 @@ static void gent_named_dtype_attr(void)
/* Create a group */
gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- assert(gid>0);
+ assert(gid > 0);
/* Create attribute on group */
- aid=H5Acreate(gid,F42_ATTRNAME,tid,sid,H5P_DEFAULT);
- assert(aid>0);
+ aid = H5Acreate2(gid, ".", F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ assert(aid > 0);
/* Write data into the attribute */
- ret=H5Awrite(aid,H5T_NATIVE_INT,&data);
- assert(ret>=0);
+ ret = H5Awrite(aid, H5T_NATIVE_INT, &data);
+ assert(ret >= 0);
/*-------------------------------------------------------------------------
* close
@@ -4513,7 +4516,7 @@ static void gent_null_space(void)
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf);
/* attribute */
- attr = H5Acreate (root, "attr", H5T_NATIVE_UINT, space, H5P_DEFAULT);
+ attr = H5Acreate2(root, ".", "attr", H5T_NATIVE_UINT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT, &point); /* Nothing can be written */
H5Dclose(dataset);
@@ -5762,7 +5765,7 @@ gent_hyperslab(void)
*-------------------------------------------------------------------------
*/
static void
-gent_group_creation_order()
+gent_group_creation_order(void)
{
hid_t fid; /* file ID */
hid_t gid; /* group ID */
@@ -5902,7 +5905,7 @@ out:
*-------------------------------------------------------------------------
*/
static void
-gent_attr_creation_order()
+gent_attr_creation_order(void)
{
hid_t fid; /* file id */
hid_t gid; /* group id */
@@ -5910,11 +5913,11 @@ gent_attr_creation_order()
hid_t sid; /* space id */
hid_t aid; /* attribute id */
hid_t gcpl_id; /* group creation property list ID */
- hid_t dcpl_id; /* dataset creation property list ID */
+ hid_t dcpl_id; /* dataset creation property list ID */
int i;
- char *attr_name[3] = {"c", "b", "a" };
+ const char *attr_name[3] = {"c", "b", "a" };
- if ((fid = H5Fcreate(FILE59, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if((fid = H5Fcreate(FILE59, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* create group creation property list */
@@ -5939,23 +5942,21 @@ gent_attr_creation_order()
*/
/* create dataspace for dataset */
- if ((sid = H5Screate(H5S_SCALAR)) < 0)
+ if((sid = H5Screate(H5S_SCALAR)) < 0)
goto out;
/* create a dataset */
- if ((did = H5Dcreate(fid, "dset", H5T_NATIVE_UCHAR, sid, dcpl_id)) < 0)
+ if((did = H5Dcreate(fid, "dset", H5T_NATIVE_UCHAR, sid, dcpl_id)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if ((aid = H5Acreate(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT)) < 0)
+ for(i = 0; i < 3; i++) {
+ if((aid = H5Acreate2(did, ".", attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if (H5Aclose(aid) < 0)
+ if(H5Aclose(aid) < 0)
goto out;
-
} /* end for */
if (H5Dclose(did) < 0)
@@ -5967,33 +5968,30 @@ gent_attr_creation_order()
*-------------------------------------------------------------------------
*/
- if ((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++)
- {
- if ((aid = H5Acreate(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT)) < 0)
+ for(i = 0; i < 3; i++) {
+ if((aid = H5Acreate2(gid, ".", attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if (H5Aclose(aid) < 0)
+ if(H5Aclose(aid) < 0)
goto out;
-
} /* end for */
if (H5Gclose(gid) < 0)
goto out;
-
/* close */
- if (H5Sclose(sid) < 0)
+ if(H5Sclose(sid) < 0)
goto out;
- if (H5Pclose(dcpl_id) < 0)
+ if(H5Pclose(dcpl_id) < 0)
goto out;
- if (H5Pclose(gcpl_id) < 0)
+ if(H5Pclose(gcpl_id) < 0)
goto out;
- if (H5Fclose(fid) < 0)
+ if(H5Fclose(fid) < 0)
goto out;
return;