From f623908727bd87575dc88f8ec2e928e07cacdf1b Mon Sep 17 00:00:00 2001 From: Patrick Lu Date: Mon, 28 Jun 1999 13:00:03 -0500 Subject: [svn-r1389] added 2 functions to create a file for data regions and obj references --- tools/testfiles/h5dumptst.c | 259 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 258 insertions(+), 1 deletion(-) diff --git a/tools/testfiles/h5dumptst.c b/tools/testfiles/h5dumptst.c index 207fbb4..e97677a 100644 --- a/tools/testfiles/h5dumptst.c +++ b/tools/testfiles/h5dumptst.c @@ -20,9 +20,23 @@ #define FILE13 "tstr.h5" #define FILE14 "tstr2.h5" #define FILE15 "enum.h5" +#define FILE16 "objref.h5" +#define FILE17 "datareg.h5" #define LENSTR 50 #define LENSTR2 11 +#define SPACE2_RANK 2 +#define SPACE2_DIM1 10 +#define SPACE2_DIM2 10 + +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 + + +/* Element selection information */ +#define POINT1_NPOINTS 10 + + typedef enum{ RED, GREEN, @@ -31,6 +45,14 @@ typedef enum{ BLACK, } enumtype; +/* Compound datatype */ +typedef struct s1_t { + unsigned int a; + unsigned int b; + float c; +} s1_t; + + static void test_group(void) { hid_t fid, group; @@ -1239,7 +1261,7 @@ hsize_t sdim, maxdim; void test_enum(){ -/*this code is taken from enum.c in the test dir */ +/*some code is taken from enum.c in the test dir */ hid_t file, type, space, dset; int val; signed char val8; @@ -1269,6 +1291,238 @@ void test_enum(){ H5Fclose(file); } + + +void test_objref(){ +/*some code is taken from enum.c in the test dir */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ + hid_t group; /* Group ID */ + hid_t sid1; /* Dataspace ID */ + 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 */ + uint32_t *tu32; /* Temporary pointer to uint32 data */ + intn i; /* counting variables */ + const char *write_comment="Foo!"; /* Comments for group */ + char read_comment[10]; + herr_t ret; /* Generic return value */ + + + /* Allocate write & read buffers */ + wbuf=malloc(sizeof(hobj_ref_t)*SPACE1_DIM1); + rbuf=malloc(sizeof(hobj_ref_t)*SPACE1_DIM1); + tbuf=malloc(sizeof(hobj_ref_t)*SPACE1_DIM1); + + /* Create file */ + fid1 = H5Fcreate(FILE16, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create dataspace for datasets */ + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + + /* Create a group */ + group=H5Gcreate(fid1,"Group1",-1); + + /* Set group's comment */ + ret=H5Gset_comment(group,".",write_comment); + + /* Create a dataset (inside Group1) */ + dataset=H5Dcreate(group,"Dataset1",H5T_STD_U32LE,sid1,H5P_DEFAULT); + + for(tu32=(uint32_t *)wbuf,i=0; i