From 18a656663a73a693cabf49d6f4858f7af311e6f5 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Mon, 21 Jun 2004 15:59:07 -0500 Subject: [svn-r8714] *** empty log message *** --- tools/h5dump/h5dump.c | 5 +++- tools/h5dump/h5dumpgentest.c | 55 +++++++++++++++++++++++++++-------------- tools/h5dump/testh5dump.sh.in | 5 ++-- tools/h5dump/testh5dumpxml.sh | 3 +++ tools/testfiles/tattr-1.ddl | 6 ----- tools/testfiles/tattr.h5 | Bin 3024 -> 3024 bytes tools/testfiles/tattr.h5.xml | 13 ---------- tools/testfiles/tdset-1.ddl | 6 ----- tools/testfiles/tdset-1.ls | 2 -- tools/testfiles/tdset-2.ddl | 6 +---- tools/testfiles/tdset.h5 | Bin 9168 -> 7648 bytes tools/testfiles/tdset.h5.xml | 21 ---------------- tools/testfiles/tnullspace.ddl | 19 ++++++++++++++ tools/testfiles/tnullspace.h5 | Bin 0 -> 3624 bytes 14 files changed, 67 insertions(+), 74 deletions(-) create mode 100644 tools/testfiles/tnullspace.ddl create mode 100644 tools/testfiles/tnullspace.h5 diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 57af6d7..9c50fbf 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -1068,7 +1068,7 @@ dump_dataspace(hid_t space) break; case H5S_NULL: - /* nulldataspace */ + /* null dataspace */ HDfprintf(stdout, "%s %s", dump_header_format->dataspacedescriptionbegin, S_NULL); break; @@ -4740,11 +4740,14 @@ xml_dump_dataspace(hid_t space) printf("\n", xmlnsprefix ); break; +#ifdef TMP + /* Commented out: wait until the schema is updated first */ case H5S_NULL: /* null dataspace (just a tag, no XML attrs. defined */ printf("<%sNullDataspace />\n",xmlnsprefix); break; +#endif /* TMP */ case H5S_COMPLEX: printf("\n"); diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index f540c25..ffe24b1 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -70,6 +70,7 @@ #define FILE42 "tnamed_dtype_attr.h5" #define FILE43 "tvldtypes5.h5" #define FILE44 "tfilters.h5" +#define FILE45 "tnullspace.h5" /*------------------------------------------------------------------------- @@ -236,7 +237,6 @@ static void gent_dataset(void) hsize_t dims[2]; int dset1[10][20]; double dset2[30][20]; - int dset3 = 10; int i, j; fid = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -264,18 +264,9 @@ static void gent_dataset(void) dset2[i][j] = 0.0001*j+i; H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); - H5Sclose(space); H5Dclose(dataset); - /* dset3 - null space */ - space = H5Screate(H5S_NULL); - dataset = H5Dcreate(fid, "/dset3", H5T_STD_I32BE, space, H5P_DEFAULT); - /* nothing should be written */ - H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset3); - - H5Sclose(space); - H5Dclose(dataset); H5Fclose(fid); } @@ -386,14 +377,7 @@ static void gent_attribute(void) H5Sclose(space); H5Aclose(attr); - /* attribute 6 - null dataspace */ - space = H5Screate(H5S_NULL); - attr = H5Acreate (root, "attr6", H5T_NATIVE_UINT, space, H5P_DEFAULT); - H5Awrite(attr, H5T_NATIVE_INT, &point); /* Nothing can be written */ - H5Tclose(type); - H5Sclose(space); - H5Aclose(attr); H5Gclose(root); H5Fclose(fid); } @@ -4880,8 +4864,41 @@ set_local_myfilter(hid_t dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id) return(FAIL); return(SUCCEED); -} +} +/*------------------------------------------------------------------------- + * Function: gent_null_space + * + * Purpose: generates dataset and attribute of null dataspace + *------------------------------------------------------------------------- + */ +static void gent_null_space(void) +{ + hid_t fid, root, dataset, space, attr; + int dset_buf = 10; + int point = 4; + + fid = H5Fcreate(FILE45, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + root = H5Gopen (fid, "/"); + + /* null space */ + space = H5Screate(H5S_NULL); + + /* dataset */ + dataset = H5Dcreate(fid, "dset", H5T_STD_I32BE, space, H5P_DEFAULT); + /* nothing should be written */ + H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf); + + /* attribute */ + attr = H5Acreate (root, "attr", H5T_NATIVE_UINT, space, H5P_DEFAULT); + H5Awrite(attr, H5T_NATIVE_INT, &point); /* Nothing can be written */ + + H5Dclose(dataset); + H5Aclose(attr); + H5Gclose(root); + H5Sclose(space); + H5Fclose(fid); +} /*------------------------------------------------------------------------- * Function: main @@ -4952,5 +4969,7 @@ int main(void) gent_filters(); + gent_null_space(); + return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 067d0f0..19aa89a 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -112,7 +112,7 @@ TOOLTEST tgroup-2.ddl --group=/g2 --group / -g /y tgroup.h5 # test for displaying simple space datasets TOOLTEST tdset-1.ddl tdset.h5 # test for displaying selected datasets -TOOLTEST tdset-2.ddl -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5 +TOOLTEST tdset-2.ddl -H -d dset1 -d /dset2 tdset.h5 # test for displaying attributes TOOLTEST tattr-1.ddl tattr.h5 @@ -272,7 +272,8 @@ fi # user defined TOOLTEST tuserfilter.ddl -H -d myfilter tfilters.h5 - +# test for displaying dataset and attribute of null space +TOOLTEST tnullspace.ddl tnullspace.h5 if test $nerrors -eq 0 ; then diff --git a/tools/h5dump/testh5dumpxml.sh b/tools/h5dump/testh5dumpxml.sh index d5e3ad5..6af3836 100755 --- a/tools/h5dump/testh5dumpxml.sh +++ b/tools/h5dump/testh5dumpxml.sh @@ -132,6 +132,9 @@ TOOLTEST tvlstr.h5.xml --xml tvlstr.h5 TOOLTEST tsaf.h5.xml --xml tsaf.h5 TOOLTEST tempty.h5.xml --xml tempty.h5 TOOLTEST tnamed_dtype_attr.h5.xml --xml tnamed_dtype_attr.h5 +##Test dataset and attribute of null space. Commented out: +## wait until the XML schema is updated for null space. +##TOOLTEST tnullspace.h5.xml --xml tnulspace.h5 # other options for xml diff --git a/tools/testfiles/tattr-1.ddl b/tools/testfiles/tattr-1.ddl index ad473af..b5b8afe 100644 --- a/tools/testfiles/tattr-1.ddl +++ b/tools/testfiles/tattr-1.ddl @@ -44,11 +44,5 @@ GROUP "/" { "string attribute" } } - ATTRIBUTE "attr6" { - DATATYPE H5T_STD_U32LE - DATASPACE NULL - DATA { - } - } } } diff --git a/tools/testfiles/tattr.h5 b/tools/testfiles/tattr.h5 index 4314cdf..578a20a 100644 Binary files a/tools/testfiles/tattr.h5 and b/tools/testfiles/tattr.h5 differ diff --git a/tools/testfiles/tattr.h5.xml b/tools/testfiles/tattr.h5.xml index 71154f6..eb2941b 100644 --- a/tools/testfiles/tattr.h5.xml +++ b/tools/testfiles/tattr.h5.xml @@ -86,18 +86,5 @@ Expected output for 'h5dump --xml tattr.h5' - - - - - - - - - - - - - diff --git a/tools/testfiles/tdset-1.ddl b/tools/testfiles/tdset-1.ddl index 9154436..8843c6e 100644 --- a/tools/testfiles/tdset-1.ddl +++ b/tools/testfiles/tdset-1.ddl @@ -125,11 +125,5 @@ GROUP "/" { (29,14) 29.0014, 29.0015, 29.0016, 29.0017, 29.0018, 29.0019 } } - DATASET "dset3" { - DATATYPE H5T_STD_I32BE - DATASPACE NULL - DATA { - } - } } } diff --git a/tools/testfiles/tdset-1.ls b/tools/testfiles/tdset-1.ls index dad8ef6..6853429 100644 --- a/tools/testfiles/tdset-1.ls +++ b/tools/testfiles/tdset-1.ls @@ -99,5 +99,3 @@ (28,19) 28.0019, 29, 29.0001, 29.0002, 29.0003, 29.0004, 29.0005, (29,6) 29.0006, 29.0007, 29.0008, 29.0009, 29.001, 29.0011, 29.0012, (29,13) 29.0013, 29.0014, 29.0015, 29.0016, 29.0017, 29.0018, 29.0019 -/dset3 Dataset {NULL} - Data: diff --git a/tools/testfiles/tdset-2.ddl b/tools/testfiles/tdset-2.ddl index 3d75089..8bb18f2 100644 --- a/tools/testfiles/tdset-2.ddl +++ b/tools/testfiles/tdset-2.ddl @@ -1,5 +1,5 @@ ############################# -Expected output for 'h5dump -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5' +Expected output for 'h5dump -H -d dset1 -d /dset2 tdset.h5' ############################# HDF5 "tdset.h5" { DATASET "dset1" { @@ -10,8 +10,4 @@ DATASET "/dset2" { DATATYPE H5T_IEEE_F64BE DATASPACE SIMPLE { ( 30, 20 ) / ( 30, 20 ) } } -DATASET "dset3" { - DATATYPE H5T_STD_I32BE - DATASPACE NULL -} } diff --git a/tools/testfiles/tdset.h5 b/tools/testfiles/tdset.h5 index c3b7c9c..3cb9a69 100644 Binary files a/tools/testfiles/tdset.h5 and b/tools/testfiles/tdset.h5 differ diff --git a/tools/testfiles/tdset.h5.xml b/tools/testfiles/tdset.h5.xml index 9f375a7..85b54b6 100644 --- a/tools/testfiles/tdset.h5.xml +++ b/tools/testfiles/tdset.h5.xml @@ -144,26 +144,5 @@ Expected output for 'h5dump --xml tdset.h5' - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/testfiles/tnullspace.ddl b/tools/testfiles/tnullspace.ddl new file mode 100644 index 0000000..5507b08 --- /dev/null +++ b/tools/testfiles/tnullspace.ddl @@ -0,0 +1,19 @@ +############################# +Expected output for 'h5dump tnullspace.h5' +############################# +HDF5 "tnullspace.h5" { +GROUP "/" { + ATTRIBUTE "attr" { + DATATYPE H5T_STD_U32LE + DATASPACE NULL + DATA { + } + } + DATASET "dset" { + DATATYPE H5T_STD_I32BE + DATASPACE NULL + DATA { + } + } +} +} diff --git a/tools/testfiles/tnullspace.h5 b/tools/testfiles/tnullspace.h5 new file mode 100644 index 0000000..54242ca Binary files /dev/null and b/tools/testfiles/tnullspace.h5 differ -- cgit v0.12