diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2006-09-26 15:47:36 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2006-09-26 15:47:36 (GMT) |
commit | e9188e385af4ac913ee28e26717e9c8fb4336d2f (patch) | |
tree | 40ea75ee2506293321c648413e45ae235850a8ce /tools/h5dump/h5dumpgentest.c | |
parent | 53a2d21415105951dd5d81969ee6f21d9e7216f8 (diff) | |
download | hdf5-e9188e385af4ac913ee28e26717e9c8fb4336d2f.zip hdf5-e9188e385af4ac913ee28e26717e9c8fb4336d2f.tar.gz hdf5-e9188e385af4ac913ee28e26717e9c8fb4336d2f.tar.bz2 |
[svn-r12683]
revised binary flags, added a new file to the test generator program to
be used in the binary tests
usage is now
-o F, --output=F Output raw data into file F
-b F, --binary=F Binary output, of form F (into file -o F).
Recommended usage is with --dataset=P
Form F of binary output is: MEMORY for memory type,
FILE for the disk file type, LE or BE for pre-existing
little or big endian types
example
./h5dump -d integer -b MEMORY -o out.bin tbinary.h5
Diffstat (limited to 'tools/h5dump/h5dumpgentest.c')
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 09328f0..572558f 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -81,6 +81,7 @@ #define FILE52 "tldouble.h5" #define FILE53 "textlink.h5" #define FILE54 "tudlink.h5" +#define FILE55 "tbinary.h5" @@ -5551,6 +5552,44 @@ error: } + +/*------------------------------------------------------------------------- + * Function: gent_binary + * + * Purpose: Generate a file to be used in the binary output test + * Contains: + * 1) an integer dataset + * 2) a float dataset + * + *------------------------------------------------------------------------- + */ +static void gent_binary() +{ + hid_t fid, sid, idid, fdid; + hsize_t dims[1] = {6}; + int ibuf[6] = {1,2,3,4,5,6}; + float fbuf[6] = {1,2,3,4,5,6}; + + fid = H5Fcreate(FILE55, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* create dataspace */ + sid = H5Screate_simple(1, dims, NULL); + + /* create datasets */ + idid = H5Dcreate(fid, "integer", H5T_NATIVE_INT, sid, H5P_DEFAULT); + fdid = H5Dcreate(fid, "float", H5T_NATIVE_FLOAT, sid, H5P_DEFAULT); + + /* write */ + H5Dwrite(idid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf); + H5Dwrite(fdid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbuf); + + /* close */ + H5Sclose(sid); + H5Dclose(idid); + H5Dclose(fdid); + H5Fclose(fid); +} + /*------------------------------------------------------------------------- * Function: main * @@ -5613,6 +5652,7 @@ int main(void) gent_aindices(); gent_longlinks(); gent_ldouble(); + gent_binary(); return 0; } |