From 68d93b7f4e458ace2ac255c1c7d9dd8873132b51 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 2 Mar 2012 09:21:13 -0500 Subject: [svn-r22013] HDFFV-7560: Merge 1.8 and h5dump/tools and tests based on tools library from trunk. Reduced warnings. HDFFV-7949: Remove duplicated functions in h5ls Tested: local linux,h5committest --- MANIFEST | 20 +- config/cmake/ConfigureChecks.cmake | 4 +- configure | 2 +- hl/tools/gif2h5/gif2hdf.c | 4 + hl/tools/gif2h5/gif2mem.c | 2 +- hl/tools/gif2h5/hdf2gif.c | 4 + perform/pio_engine.c | 40 +- perform/pio_perf.c | 5 + perform/pio_perf.h | 1 + perform/pio_timer.c | 66 +- perform/pio_timer.h | 4 +- perform/sio_engine.c | 28 +- perform/sio_perf.c | 5 + perform/sio_perf.h | 29 +- perform/sio_timer.c | 36 +- perform/sio_timer.h | 6 +- perform/zip_perf.c | 4 + release_docs/RELEASE.txt | 5 + tools/h5copy/CMakeLists.txt | 2 +- tools/h5copy/h5copy.c | 9 +- tools/h5copy/h5copygentest.c | 11 +- tools/h5diff/CMakeLists.txt | 2 +- tools/h5diff/h5diff_common.c | 5 +- tools/h5diff/h5diff_main.c | 6 +- tools/h5diff/h5diffgentest.c | 61 +- tools/h5diff/ph5diff_main.c | 4 + tools/h5dump/CMakeLists.txt | 313 +- tools/h5dump/Makefile.am | 3 + tools/h5dump/Makefile.in | 14 +- tools/h5dump/h5dump.c | 8083 +++------------------- tools/h5dump/h5dump.h | 217 +- tools/h5dump/h5dump_ddl.c | 1917 +++++ tools/h5dump/h5dump_ddl.h | 50 + tools/h5dump/h5dump_defines.h | 54 + tools/h5dump/h5dump_extern.h | 112 + tools/h5dump/h5dump_xml.c | 4456 ++++++++++++ tools/h5dump/h5dump_xml.h | 128 + tools/h5dump/h5dumpgentest.c | 789 ++- tools/h5dump/testh5dump.sh.in | 316 +- tools/h5import/h5import.c | 866 +-- tools/h5import/h5import.h | 2 +- tools/h5jam/CMakeLists.txt | 2 +- tools/h5jam/getub.c | 28 +- tools/h5jam/h5jam.c | 6 +- tools/h5jam/h5jamgentest.c | 24 +- tools/h5jam/h5unjam.c | 5 +- tools/h5jam/tellub.c | 26 +- tools/h5ls/h5ls.c | 2183 ++++-- tools/h5repack/h5repack.c | 18 +- tools/h5repack/h5repack_copy.c | 16 +- tools/h5repack/h5repack_filters.c | 3 +- tools/h5repack/h5repack_main.c | 36 +- tools/h5repack/h5repack_opttable.c | 15 +- tools/h5repack/h5repack_parse.c | 107 +- tools/h5repack/h5repack_refs.c | 2 +- tools/h5repack/h5repack_verify.c | 9 +- tools/h5repack/h5repacktst.c | 49 +- tools/h5repack/testh5repack_detect_szip.c | 4 + tools/h5stat/CMakeLists.txt | 2 +- tools/h5stat/h5stat.c | 87 +- tools/h5stat/h5stat_gentest.c | 16 +- tools/lib/CMakeLists.txt | 2 + tools/lib/Makefile.am | 2 +- tools/lib/Makefile.in | 11 +- tools/lib/h5diff.c | 80 +- tools/lib/h5diff_array.c | 338 +- tools/lib/h5diff_dset.c | 42 +- tools/lib/h5diff_util.c | 2 +- tools/lib/h5tools.c | 3019 +------- tools/lib/h5tools.h | 108 +- tools/lib/h5tools_dump.c | 3921 +++++++++++ tools/lib/h5tools_dump.h | 85 + tools/lib/h5tools_str.c | 201 +- tools/lib/h5tools_str.h | 24 +- tools/lib/h5tools_type.c | 226 +- tools/lib/h5tools_utils.c | 218 +- tools/lib/h5tools_utils.h | 12 +- tools/lib/h5trav.c | 6 +- tools/misc/h5debug.c | 90 +- tools/misc/h5mkgrp.c | 8 +- tools/testfiles/filter_fail.ddl | 2 +- tools/testfiles/h5dump-help.txt | 2 + tools/testfiles/tall-2A.h5.xml | 91 +- tools/testfiles/tall-2B.ddl | 4 +- tools/testfiles/tall.h5.xml | 251 +- tools/testfiles/tallfilters.ddl | 4 +- tools/testfiles/tarray1.h5.xml | 9 +- tools/testfiles/tarray2.h5.xml | 56 +- tools/testfiles/tarray3.h5.xml | 116 +- tools/testfiles/tarray6.h5.xml | 12 +- tools/testfiles/tarray7.h5.xml | 36 +- tools/testfiles/tattr-1.ddl | 10 +- tools/testfiles/tattr-2.ddl | 10 +- tools/testfiles/tattr-3.ddl | 4 +- tools/testfiles/tattr-4_be.ddl | 90 +- tools/testfiles/tattr.h5.xml | 48 +- tools/testfiles/tattr2.ls | 447 +- tools/testfiles/tattrregR.ddl | 2 +- tools/testfiles/tattrreg_be.ls | 1 + tools/testfiles/tattrreg_le.ls | 1 + tools/testfiles/tbitfields.h5.xml | 61 +- tools/testfiles/tboot1.ddl | 6 +- tools/testfiles/tboot2.ddl | 6 +- tools/testfiles/tchar1.ddl | 10 +- tools/testfiles/tchunked.ddl | 4 +- tools/testfiles/tcompact.ddl | 2 +- tools/testfiles/tcompound.h5.xml | 152 +- tools/testfiles/tcompound2.h5.xml | 36 +- tools/testfiles/tcompound_complex.h5.xml | 46 +- tools/testfiles/tcontiguos.ddl | 2 +- tools/testfiles/tdatareg.h5.xml | 118 +- tools/testfiles/tdataregR.ddl | 2 +- tools/testfiles/tdeflate.ddl | 4 +- tools/testfiles/tdset.h5.xml | 898 ++- tools/testfiles/tdset2.h5.xml | 544 +- tools/testfiles/tempty-dtd-2.h5.xml | 45 +- tools/testfiles/tempty-dtd-uri.h5.xml | 45 +- tools/testfiles/tempty-dtd.h5.xml | 45 +- tools/testfiles/tempty-nons-2.h5.xml | 45 +- tools/testfiles/tempty-nons-uri.h5.xml | 45 +- tools/testfiles/tempty-nons.h5.xml | 45 +- tools/testfiles/tempty-ns-2.h5.xml | 45 +- tools/testfiles/tempty-ns.h5.xml | 45 +- tools/testfiles/tempty.h5.xml | 45 +- tools/testfiles/tenum.h5.xml | 28 +- tools/testfiles/texternal.ddl | 2 +- tools/testfiles/textlinkfar.ddl | 1 - tools/testfiles/textlinksrc.ddl | 1 - tools/testfiles/tfill.ddl | 18 +- tools/testfiles/tfletcher32.ddl | 4 +- tools/testfiles/tfpformat.ddl | 14 +- tools/testfiles/tfpformat.h5.xml | 22 +- tools/testfiles/thlink.h5.xml | 14 +- tools/testfiles/tloop.h5.xml | 4 +- tools/testfiles/tloop2.h5.xml | 2 +- tools/testfiles/tmany.h5.xml | 396 +- tools/testfiles/tname-amp.h5.xml | 125 +- tools/testfiles/tname-apos.h5.xml | 125 +- tools/testfiles/tname-gt.h5.xml | 125 +- tools/testfiles/tname-lt.h5.xml | 125 +- tools/testfiles/tname-quot.h5.xml | 125 +- tools/testfiles/tname-sp.h5.xml | 125 +- tools/testfiles/tnamed_dtype_attr.ddl | 2 - tools/testfiles/tnamed_dtype_attr.h5.xml | 4 +- tools/testfiles/tnbit.ddl | 4 +- tools/testfiles/tnestedcomp.h5.xml | 19 +- tools/testfiles/tno-subset.ddl | 9 + tools/testfiles/tno-subset.h5 | Bin 0 -> 1400 bytes tools/testfiles/tnodata.h5.xml | 10 +- tools/testfiles/tnofilename-with-packed-bits.ddl | 96 + tools/testfiles/tnofilename.ddl | 94 - tools/testfiles/tobjref.h5.xml | 22 +- tools/testfiles/topaque.h5.xml | 4 +- tools/testfiles/torderattr1.ddl | 2 - tools/testfiles/torderattr1.h5.xml | 8 +- tools/testfiles/torderattr2.ddl | 2 - tools/testfiles/torderattr2.h5.xml | 8 +- tools/testfiles/torderattr3.ddl | 2 - tools/testfiles/torderattr3.h5.xml | 8 +- tools/testfiles/torderattr4.ddl | 2 - tools/testfiles/torderattr4.h5.xml | 8 +- tools/testfiles/tpbitsIncomplete.ddl | 2 + tools/testfiles/tpbitsLengthExceeded.ddl | 2 + tools/testfiles/tpbitsLengthPositive.ddl | 2 + tools/testfiles/tpbitsMaxExceeded.ddl | 2 + tools/testfiles/tpbitsOffsetExceeded.ddl | 2 + tools/testfiles/tpbitsOffsetNegative.ddl | 2 + tools/testfiles/tref-escapes-at.h5.xml | 137 +- tools/testfiles/tref-escapes.h5.xml | 67 +- tools/testfiles/tref.h5.xml | 22 +- tools/testfiles/treference.ddl | 276 +- tools/testfiles/tsaf.h5.xml | 6735 ++++++++++++++++-- tools/testfiles/tscaleoffset.ddl | 4 +- tools/testfiles/tshuffle.ddl | 4 +- tools/testfiles/tsplit_file.ddl | 10 +- tools/testfiles/tstr-1.ddl | 40 +- tools/testfiles/tstr-2.ddl | 70 +- tools/testfiles/tstr.h5.xml | 218 +- tools/testfiles/tstr2.h5.xml | 24 +- tools/testfiles/tstring-at.h5.xml | 4 +- tools/testfiles/tstring.ddl | 20 +- tools/testfiles/tstring.h5.xml | 4 +- tools/testfiles/tstring2.ddl | 4 +- tools/testfiles/tstringe.ddl | 20 +- tools/testfiles/tszip.ddl | 4 +- tools/testfiles/tuserfilter.ddl | 17 +- tools/testfiles/tvldtypes1.h5.xml | 22 +- tools/testfiles/tvldtypes2.h5.xml | 8 +- tools/testfiles/tvldtypes3.h5.xml | 9 +- tools/testfiles/tvldtypes4.h5.xml | 14 +- tools/testfiles/tvldtypes5.h5.xml | 15 +- tools/testfiles/tvlstr.ddl | 21 +- tools/testfiles/tvlstr.h5.xml | 10 +- 193 files changed, 26762 insertions(+), 14799 deletions(-) create mode 100644 tools/h5dump/h5dump_ddl.c create mode 100644 tools/h5dump/h5dump_ddl.h create mode 100644 tools/h5dump/h5dump_defines.h create mode 100644 tools/h5dump/h5dump_extern.h create mode 100644 tools/h5dump/h5dump_xml.c create mode 100644 tools/h5dump/h5dump_xml.h create mode 100644 tools/lib/h5tools_dump.c create mode 100644 tools/lib/h5tools_dump.h create mode 100644 tools/testfiles/tno-subset.ddl create mode 100644 tools/testfiles/tno-subset.h5 create mode 100644 tools/testfiles/tnofilename-with-packed-bits.ddl delete mode 100644 tools/testfiles/tnofilename.ddl diff --git a/MANIFEST b/MANIFEST index cc97cfe..ea8ace5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -995,6 +995,12 @@ ./tools/h5dump/Makefile.in ./tools/h5dump/h5dump.c ./tools/h5dump/h5dump.h +./tools/h5dump/h5dump_defines.h +./tools/h5dump/h5dump_extern.h +./tools/h5dump/h5dump_ddl.c +./tools/h5dump/h5dump_ddl.h +./tools/h5dump/h5dump_xml.c +./tools/h5dump/h5dump_xml.h ./tools/h5dump/h5dumpgentest.c ./tools/h5dump/testh5dump.sh.in ./tools/h5dump/testh5dumpxml.sh.in @@ -1076,11 +1082,13 @@ ./tools/h5repack/h5repacktst.c ./tools/h5repack/testh5repack_detect_szip.c +# h5ls sources ./tools/h5ls/Makefile.am ./tools/h5ls/Makefile.in ./tools/h5ls/h5ls.c ./tools/h5ls/testh5ls.sh.in +# h5copy sources ./tools/h5copy/testh5copy.sh ./tools/h5copy/Makefile.in ./tools/h5copy/h5copy.c @@ -1100,6 +1108,8 @@ ./tools/lib/h5trav.h ./tools/lib/h5tools.c ./tools/lib/h5tools.h +./tools/lib/h5tools_dump.c +./tools/lib/h5tools_dump.h ./tools/lib/h5tools_filters.c ./tools/lib/h5tools_str.c ./tools/lib/h5tools_str.h @@ -1126,9 +1136,12 @@ ./tools/misc/testfiles/h5mkgrp_help.txt ./tools/misc/testfiles/h5mkgrp_version.txt.in +# h5stat sources ./tools/h5stat/Makefile.am ./tools/h5stat/Makefile.in ./tools/h5stat/h5stat.c + +# h5stat test files ./tools/h5stat/h5stat_gentest.c ./tools/h5stat/testh5stat.sh.in ./tools/h5stat/testfiles/h5stat_filters-UT.ddl @@ -1149,8 +1162,7 @@ ./tools/h5stat/testfiles/h5stat_tsohm.ddl ./tools/h5stat/testfiles/h5stat_tsohm.h5 - -# h5dump +# h5dump test files ./tools/testfiles/family_file00000.h5 ./tools/testfiles/family_file00001.h5 ./tools/testfiles/family_file00002.h5 @@ -1285,7 +1297,8 @@ ./tools/testfiles/tnbit.ddl ./tools/testfiles/tnestcomp-1.ddl ./tools/testfiles/tnestedcomp.h5 -./tools/testfiles/tnofilename.ddl +./tools/testfiles/tno-subset.h5 +./tools/testfiles/tno-subset.ddl ./tools/testfiles/tnullspace.h5 ./tools/testfiles/tnullspace.ddl ./tools/testfiles/tobjref.h5 @@ -1366,6 +1379,7 @@ ./tools/testfiles/tbigdims.h5 ./tools/testfiles/thyperslab.h5 # h5dump packed bits validation +./tools/testfiles/tnofilename-with-packed-bits.ddl ./tools/testfiles/tpbitsLengthPositive.ddl ./tools/testfiles/tpbitsMaxExceeded.ddl ./tools/testfiles/tpbitsSigned.ddl diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 5ad20a0..a2dd62e 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -132,9 +132,9 @@ IF (WIN32) SET (H5_HAVE_WIN32_API 1) IF (NOT UNIX AND NOT CYGWIN AND NOT MINGW) SET (WINDOWS 1) - IF (MSVC_IDE) + IF (MSVC) SET (H5_HAVE_VISUAL_STUDIO 1) - ENDIF (MSVC_IDE) + ENDIF (MSVC) ENDIF (NOT UNIX AND NOT CYGWIN AND NOT MINGW) ENDIF (WIN32) diff --git a/configure b/configure index c48f9a6..c19359c 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 21911 2012-02-06 01:54:51Z hdftest . +# From configure.in Id: configure.in 21961 2012-02-20 01:22:11Z hdftest . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for HDF5 1.8.9-snap11. # diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c index 1225613..810be78 100644 --- a/hl/tools/gif2h5/gif2hdf.c +++ b/hl/tools/gif2h5/gif2hdf.c @@ -17,6 +17,7 @@ #include #include "gif.h" +#include "h5tools.h" #include "h5tools_utils.h" @@ -49,6 +50,9 @@ main(int argv , char *argc[]) GifMemoryStruct.GifApplicationExtension = NULL; GifMemoryStruct.GifCommentExtension = NULL; + /* Initialize h5tools lib */ + h5tools_init(); + if ( argc[1] && (strcmp("-V",argc[1])==0) ) { print_version("gif2h5"); diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c index 907fb80..7995bb4 100644 --- a/hl/tools/gif2h5/gif2mem.c +++ b/hl/tools/gif2h5/gif2mem.c @@ -37,7 +37,7 @@ #include "gif.h" -#define VERSION "1.00" +#define GIF2VERSION "1.00" GIFTOMEM Gif2Mem(BYTE *MemGif) diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c index cc8e864..090d657 100644 --- a/hl/tools/gif2h5/hdf2gif.c +++ b/hl/tools/gif2h5/hdf2gif.c @@ -17,6 +17,7 @@ #include #include "gif.h" #include "H5IMpublic.h" +#include "h5tools.h" #include "h5tools_utils.h" @@ -70,6 +71,9 @@ int main(int argc , char **argv) char *image_name = NULL; int idx; + /* Initialize h5tools lib */ + h5tools_init(); + if ( argv[1] && (strcmp("-V",argv[1])==0) ) { print_version("gif2h5"); diff --git a/perform/pio_engine.c b/perform/pio_engine.c index 511492b..0e3190c 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -320,22 +320,22 @@ do_pio(parameters param) /* Need barrier to make sure everyone starts at the same time */ MPI_Barrier(pio_comm_g); - set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, START); + set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, PIO_CREATE | PIO_WRITE); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, START); + set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); hrc = do_write(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); hrc == SUCCESS; - set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_write failed"); /* Close file for write */ hrc = do_fclose(iot, &fd); - set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); if (!param.h5_write_only) { @@ -349,20 +349,20 @@ do_pio(parameters param) MPI_Barrier(pio_comm_g); /* Open file for read */ - set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, START); + set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, PIO_READ); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, START); + set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); hrc = do_read(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); - set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_read failed"); /* Close file for read */ hrc = do_fclose(iot, &fd); - set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); } @@ -968,7 +968,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end else */ /* Start "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, START); + set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); while (nbytes_xfer < bytes_count){ /* Write */ @@ -1399,7 +1399,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end while */ /* Stop "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, STOP); + set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); /* Calculate write time */ @@ -1899,7 +1899,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end else */ /* Start "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, START); + set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); while (nbytes_xfer < bytes_count){ /* Read */ @@ -2354,7 +2354,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end while */ /* Stop "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, STOP); + set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); /* Calculate read time */ @@ -3115,9 +3115,9 @@ int MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_READ, START); + set_time(timer_g, HDF5_MPI_READ, TSTART); err=PMPI_File_read_at(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_READ, STOP); + set_time(timer_g, HDF5_MPI_READ, TSTOP); return err; } @@ -3126,9 +3126,9 @@ int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_READ, START); + set_time(timer_g, HDF5_MPI_READ, TSTART); err=PMPI_File_read_at_all(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_READ, STOP); + set_time(timer_g, HDF5_MPI_READ, TSTOP); return err; } @@ -3136,9 +3136,9 @@ int MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_WRITE, START); + set_time(timer_g, HDF5_MPI_WRITE, TSTART); err=PMPI_File_write_at(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_WRITE, STOP); + set_time(timer_g, HDF5_MPI_WRITE, TSTOP); return err; } @@ -3146,9 +3146,9 @@ int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_WRITE, START); + set_time(timer_g, HDF5_MPI_WRITE, TSTART); err=PMPI_File_write_at_all(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_WRITE, STOP); + set_time(timer_g, HDF5_MPI_WRITE, TSTOP); return err; } diff --git a/perform/pio_perf.c b/perform/pio_perf.c index 411fb12..337e982 100644 --- a/perform/pio_perf.c +++ b/perform/pio_perf.c @@ -339,6 +339,11 @@ main(int argc, char **argv) int exit_value = EXIT_SUCCESS; struct options *opts = NULL; +#ifndef STANDALONE + /* Initialize h5tools lib */ + h5tools_init(); +#endif + output = stdout; /* initialize MPI and get the maximum num of processors we started with */ diff --git a/perform/pio_perf.h b/perform/pio_perf.h index 6f510ca..094b31d 100644 --- a/perform/pio_perf.h +++ b/perform/pio_perf.h @@ -19,6 +19,7 @@ #ifndef STANDALONE #include "H5private.h" #include "h5test.h" +#include "h5tools.h" #include "h5tools_utils.h" #else #include "pio_standalone.h" diff --git a/perform/pio_timer.c b/perform/pio_timer.c index 9c8abb7..aba219e 100644 --- a/perform/pio_timer.c +++ b/perform/pio_timer.c @@ -43,15 +43,15 @@ pio_time *timer_g; /* timer: global for stub functions */ * Function: sub_time * Purpose: Struct two time values, and return the difference, in microseconds * - * Note that the function assumes that a > b + * Note that the function assumes that a > b * Programmer: Leon Arber, 1/27/06 */ static double sub_time(struct timeval* a, struct timeval* b) { return (((double)a->tv_sec + ((double)a->tv_usec) / MICROSECOND) - - ((double)b->tv_sec + - ((double)b->tv_usec) / MICROSECOND)); + ((double)b->tv_sec + + ((double)b->tv_usec) / MICROSECOND)); } @@ -89,7 +89,7 @@ pio_time_new(clock_type type) void pio_time_destroy(pio_time *pt) { - free(pt); + HDfree(pt); /* reset the global timer pointer too. */ timer_g = NULL; } @@ -134,37 +134,37 @@ set_time(pio_time *pt, timer_type t, int start_stop) { if (pt) { if (pt->type == MPI_TIMER) { - if (start_stop == START) { + if (start_stop == TSTART) { pt->mpi_timer[t] = MPI_Wtime(); - /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS - * we compute the time it took to only open the file */ - if(t == HDF5_FINE_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_WRITE_FIXED_DIMS]; - else if(t == HDF5_FINE_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_READ_FIXED_DIMS]; + /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS + * we compute the time it took to only open the file */ + if(t == HDF5_FINE_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_WRITE_FIXED_DIMS]; + else if(t == HDF5_FINE_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_READ_FIXED_DIMS]; } else { pt->total_time[t] += MPI_Wtime() - pt->mpi_timer[t]; - pt->mpi_timer[t] = MPI_Wtime(); - - /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS - * we compute the time it took to close the file after the last read/write finished */ - if(t == HDF5_GROSS_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_WRITE_FIXED_DIMS]; - else if(t == HDF5_GROSS_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_READ_FIXED_DIMS]; + pt->mpi_timer[t] = MPI_Wtime(); + + /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS + * we compute the time it took to close the file after the last read/write finished */ + if(t == HDF5_GROSS_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_WRITE_FIXED_DIMS]; + else if(t == HDF5_GROSS_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_READ_FIXED_DIMS]; } } else { - if (start_stop == START) { + if (start_stop == TSTART) { HDgettimeofday(&pt->sys_timer[t], NULL); - /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS - * we compute the time it took to only open the file */ - if(t == HDF5_FINE_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_WRITE_FIXED_DIMS])); - else if(t == HDF5_FINE_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_READ_FIXED_DIMS])); + /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS + * we compute the time it took to only open the file */ + if(t == HDF5_FINE_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_WRITE_FIXED_DIMS])); + else if(t == HDF5_FINE_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_READ_FIXED_DIMS])); } else { @@ -178,12 +178,12 @@ set_time(pio_time *pt, timer_type t, int start_stop) ((double)pt->sys_timer[t].tv_sec + ((double)pt->sys_timer[t].tv_usec) / MICROSECOND);*/ - /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS - * we compute the time it took to close the file after the last read/write finished */ - if(t == HDF5_GROSS_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_WRITE_FIXED_DIMS])); - else if(t == HDF5_GROSS_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_READ_FIXED_DIMS])); + /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS + * we compute the time it took to close the file after the last read/write finished */ + if(t == HDF5_GROSS_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_WRITE_FIXED_DIMS])); + else if(t == HDF5_GROSS_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_READ_FIXED_DIMS])); } } @@ -231,7 +231,7 @@ set_time(pio_time *pt, timer_type t, int start_stop) } fprintf(output, " Proc %d: %s %s: %.2f\n", myrank, msg, - (start_stop == START ? "Start" : "Stop"), + (start_stop == TSTART ? "Start" : "Stop"), pt->total_time[t]); } } diff --git a/perform/pio_timer.h b/perform/pio_timer.h index 943521a..a5ee6d7 100644 --- a/perform/pio_timer.h +++ b/perform/pio_timer.h @@ -53,8 +53,8 @@ typedef enum clock_type_ { /* Miscellaneous identifiers */ enum { - START, /* Start a specified timer */ - STOP /* Stop a specified timer */ + TSTART, /* Start a specified timer */ + TSTOP /* Stop a specified timer */ }; /* The performance time structure */ diff --git a/perform/sio_engine.c b/perform/sio_engine.c index e892bcc..df2e21e 100644 --- a/perform/sio_engine.c +++ b/perform/sio_engine.c @@ -22,7 +22,7 @@ #include #include #ifdef H5_HAVE_UNISTD_H -# include +# include #endif #include @@ -233,18 +233,18 @@ do_sio(parameters param) HDfprintf(output, "data filename=%s\n", fname); - set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, START); + set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, SIO_CREATE | SIO_WRITE); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, START); + set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); hrc = do_write(&res, &fd, ¶m, buffer); - set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_write failed"); /* Close file for write */ hrc = do_fclose(iot, &fd); - set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); if (!param.h5_write_only) { @@ -253,19 +253,19 @@ do_sio(parameters param) */ /* Open file for read */ - set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, START); + set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, SIO_READ); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, START); + set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); hrc = do_read(&res, &fd, ¶m, buffer); - set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_read failed"); /* Close file for read */ hrc = do_fclose(iot, &fd); - set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); } @@ -551,7 +551,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) } /* Start "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, START); + set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); /* Perform write */ hrc = dset_write(rank-1, fd, parms, buffer); @@ -563,7 +563,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) /* Stop "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, STOP); + set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); /* Calculate write time */ @@ -628,7 +628,7 @@ static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void int cur_dim = order[local_dim]-1; int ret_code = SUCCESS; int k; - hsize_t dims[MAX_DIMS], maxdims[MAX_DIMS]; + hsize_t dims[MAX_DIMS], maxdims[MAX_DIMS]; long i,j; herr_t hrc; @@ -855,7 +855,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) } /* end switch */ /* Start "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, START); + set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); hrc = dset_read(rank-1, fd, parms, buffer, buffer2); if (hrc < 0) { @@ -864,7 +864,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) } /* Stop "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, STOP); + set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); /* Calculate read time */ diff --git a/perform/sio_perf.c b/perform/sio_perf.c index d852a45..16e1750 100644 --- a/perform/sio_perf.c +++ b/perform/sio_perf.c @@ -343,6 +343,11 @@ main(int argc, char **argv) int exit_value = EXIT_SUCCESS; struct options *opts = NULL; +#ifndef STANDALONE + /* Initialize h5tools lib */ + h5tools_init(); +#endif + output = stdout; opts = parse_command_line(argc, argv); diff --git a/perform/sio_perf.h b/perform/sio_perf.h index 2417b6f..3e4456a 100644 --- a/perform/sio_perf.h +++ b/perform/sio_perf.h @@ -19,6 +19,7 @@ #ifndef STANDALONE #include "H5private.h" #include "h5test.h" +#include "h5tools.h" #include "h5tools_utils.h" #else #include "sio_standalone.h" @@ -49,24 +50,24 @@ typedef enum vfdtype_ { } vfdtype; typedef struct parameters_ { - iotype io_type; /* The type of IO test to perform */ + iotype io_type; /* The type of IO test to perform */ vfdtype vfd; - long num_files; /* Number of files to create */ - long num_dsets; /* Number of datasets to create */ - off_t num_bytes; /* Number of bytes in each dset */ + long num_files; /* Number of files to create */ + long num_dsets; /* Number of datasets to create */ + off_t num_bytes; /* Number of bytes in each dset */ int num_iters; /* Number of times to loop doing the IO */ int rank; /* Rank of dataset */ - off_t dset_size[MAX_DIMS]; /* Dataset size */ - size_t buf_size[MAX_DIMS]; /* Buffer size */ - size_t chk_size[MAX_DIMS]; /* Chunk size */ - int order[MAX_DIMS]; /* Buffer size */ - hsize_t h5_align; /* HDF5 object alignment */ - hsize_t h5_thresh; /* HDF5 object alignment threshold */ - int h5_use_chunks; /* Make HDF5 dataset chunked */ - int h5_extendable; /* Make HDF5 dataset chunked */ - int h5_write_only; /* Perform the write tests only */ + off_t dset_size[MAX_DIMS]; /* Dataset size */ + size_t buf_size[MAX_DIMS]; /* Buffer size */ + size_t chk_size[MAX_DIMS]; /* Chunk size */ + int order[MAX_DIMS]; /* Buffer size */ + hsize_t h5_align; /* HDF5 object alignment */ + hsize_t h5_thresh; /* HDF5 object alignment threshold */ + int h5_use_chunks; /* Make HDF5 dataset chunked */ + int h5_extendable; /* Make HDF5 dataset chunked */ + int h5_write_only; /* Perform the write tests only */ unsigned h5_use_mpi_posix; /* VFD for HDF5 I/O */ - int verify; /* Verify data correctness */ + int verify; /* Verify data correctness */ } parameters; typedef struct results_ { diff --git a/perform/sio_timer.c b/perform/sio_timer.c index f188a10..f233de3 100644 --- a/perform/sio_timer.c +++ b/perform/sio_timer.c @@ -39,15 +39,15 @@ sio_time *timer_g; /* timer: global for stub functions */ * Function: sub_time * Purpose: Struct two time values, and return the difference, in microseconds * - * Note that the function assumes that a > b + * Note that the function assumes that a > b * Programmer: Leon Arber, 1/27/06 */ static double sub_time(struct timeval* a, struct timeval* b) { return (((double)a->tv_sec + ((double)a->tv_usec) / MICROSECOND) - - ((double)b->tv_sec + - ((double)b->tv_usec) / MICROSECOND)); + ((double)b->tv_sec + + ((double)b->tv_usec) / MICROSECOND)); } @@ -82,7 +82,7 @@ sio_time_new(void) void sio_time_destroy(sio_time *pt) { - free(pt); + HDfree(pt); /* reset the global timer pointer too. */ timer_g = NULL; } @@ -100,15 +100,15 @@ sio_time * set_time(sio_time *pt, timer_type t, int start_stop) { if (pt) { - if (start_stop == START) { + if (start_stop == TSTART) { HDgettimeofday(&pt->sys_timer[t], NULL); - /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS - * we compute the time it took to only open the file */ - if(t == HDF5_FINE_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_WRITE_FIXED_DIMS])); - else if(t == HDF5_FINE_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_READ_FIXED_DIMS])); + /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS + * we compute the time it took to only open the file */ + if(t == HDF5_FINE_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_WRITE_FIXED_DIMS])); + else if(t == HDF5_FINE_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_READ_FIXED_DIMS])); } else { @@ -122,12 +122,12 @@ set_time(sio_time *pt, timer_type t, int start_stop) ((double)pt->sys_timer[t].tv_sec + ((double)pt->sys_timer[t].tv_usec) / MICROSECOND);*/ - /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS - * we compute the time it took to close the file after the last read/write finished */ - if(t == HDF5_GROSS_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_WRITE_FIXED_DIMS])); - else if(t == HDF5_GROSS_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_READ_FIXED_DIMS])); + /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS + * we compute the time it took to close the file after the last read/write finished */ + if(t == HDF5_GROSS_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_WRITE_FIXED_DIMS])); + else if(t == HDF5_GROSS_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_READ_FIXED_DIMS])); } @@ -171,7 +171,7 @@ set_time(sio_time *pt, timer_type t, int start_stop) } fprintf(output, " %s %s: %.2f\n", msg, - (start_stop == START ? "Start" : "Stop"), + (start_stop == TSTART ? "Start" : "Stop"), pt->total_time[t]); } } diff --git a/perform/sio_timer.h b/perform/sio_timer.h index 1fa880d..04432af 100644 --- a/perform/sio_timer.h +++ b/perform/sio_timer.h @@ -27,7 +27,7 @@ #endif #ifdef H5_HAVE_WINSOCK_H -# include +# include #endif /* H5_HAVE_WINSOCK_H */ /* The different types of timers we can have */ @@ -52,8 +52,8 @@ typedef enum timer_type_ { /* Miscellaneous identifiers */ enum { - START, /* Start a specified timer */ - STOP /* Stop a specified timer */ + TSTART, /* Start a specified timer */ + TSTOP /* Stop a specified timer */ }; /* The performance time structure */ diff --git a/perform/zip_perf.c b/perform/zip_perf.c index 897fc7e..b13e0ec 100644 --- a/perform/zip_perf.c +++ b/perform/zip_perf.c @@ -23,6 +23,7 @@ /* our header files */ #include "h5test.h" +#include "h5tools.h" #include "h5tools_utils.h" #ifdef H5_HAVE_FILTER_DEFLATE @@ -574,6 +575,9 @@ main(int argc, char **argv) prog = argv[0]; + /* Initialize h5tools lib */ + h5tools_init(); + while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) > 0) { switch ((char)opt) { case '0': case '1': case '2': diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index ccb99ee..8537cf5 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -120,6 +120,11 @@ Bug Fixes since HDF5-1.8.8 Tools ----- + - h5dump: Refactored code to remove duplicated functions. Split XML + functions from DDL functions. Corrected indentation and formatting + errors. Also fixed subsetting counting overflow (HDFFV-5874). Verified + all tools call tools_init() in main. + HDFFV-7560 (ADB 2012/02/17) - h5diff: fixed to prevent from displaying error stack message when comparing the two dangling symlinks with follow-symlinks option. HDFFV-7836 (JKM 2012/01/13) diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt index b0b9aa8..7006283 100644 --- a/tools/h5copy/CMakeLists.txt +++ b/tools/h5copy/CMakeLists.txt @@ -27,7 +27,7 @@ IF (BUILD_TESTING) IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5copygentest ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/h5copygentest.c) TARGET_NAMING (h5copygentest ${LIB_TYPE}) - TARGET_LINK_LIBRARIES (h5copygentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + TARGET_LINK_LIBRARIES (h5copygentest ${HDF5_LIB_TARGET}) SET_TARGET_PROPERTIES (h5copygentest PROPERTIES FOLDER generator/tools) #ADD_TEST (NAME h5copygentest COMMAND $) diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c index fb8bb81..574ba94 100644 --- a/tools/h5copy/h5copy.c +++ b/tools/h5copy/h5copy.c @@ -55,7 +55,7 @@ static void leave(int ret) { h5tools_close(); - exit(ret); + HDexit(ret); } @@ -75,7 +75,7 @@ leave(int ret) static void usage (void) { - fprintf(stdout, "\ + HDfprintf(stdout, "\ usage: h5copy [OPTIONS] [OBJECTS...]\n\ OBJECTS\n\ -i, --input input file name\n\ @@ -219,6 +219,7 @@ main (int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); + /* initialize h5tools lib */ h5tools_init(); @@ -464,7 +465,7 @@ main (int argc, const char *argv[]) /* free link info path */ if (linkinfo.trg_path) - HDfree(linkinfo.trg_path); + HDfree((char*)linkinfo.trg_path); /* close propertis */ if(H5Pclose(ocpl_id)<0) @@ -496,7 +497,7 @@ error: /* free link info path */ if (linkinfo.trg_path) - HDfree(linkinfo.trg_path); + HDfree((char*)linkinfo.trg_path); H5E_BEGIN_TRY { H5Pclose(ocpl_id); diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c index 85bcb29..e658e92 100644 --- a/tools/h5copy/h5copygentest.c +++ b/tools/h5copy/h5copygentest.c @@ -19,10 +19,6 @@ #include #include "hdf5.h" #include "H5private.h" -#include "h5tools.h" - -/* Name of tool */ -#define PROGRAMNAME "h5copygentest" /* HDF file names */ #define HDF_FILE1 "h5copytst.h5" @@ -365,7 +361,7 @@ static void gent_empty_group(hid_t loc_id) * Function: gent_nested_datasets * * Purpose: Generate a group in a location and populate it with the "standard" - * datasets + * datasets * *------------------------------------------------------------------------- */ @@ -387,7 +383,7 @@ static void gent_nested_datasets(hid_t loc_id) * Function: gent_nested_group * * Purpose: Generate a group in a location and populate it with another group - * containing the "standard" datasets + * containing the "standard" datasets * *------------------------------------------------------------------------- */ @@ -891,9 +887,6 @@ out: int main(void) { - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - Test_Obj_Copy(); Test_Ref_Copy(); Test_Extlink_Copy(); diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt index 1fa1cf3..3f73bd7 100644 --- a/tools/h5diff/CMakeLists.txt +++ b/tools/h5diff/CMakeLists.txt @@ -43,7 +43,7 @@ IF (BUILD_TESTING) IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5diffgentest ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diffgentest.c) TARGET_NAMING (h5diffgentest ${LIB_TYPE}) - TARGET_LINK_LIBRARIES (h5diffgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + TARGET_LINK_LIBRARIES (h5diffgentest ${HDF5_LIB_TARGET}) SET_TARGET_PROPERTIES (h5diffgentest PROPERTIES FOLDER generator/tools) #ADD_TEST (NAME h5diffgentest COMMAND $) diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index f7532f2..b8e46f3 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -17,6 +17,7 @@ #include #include "h5diff.h" #include "h5diff_common.h" +#include "h5tools.h" #include "h5tools_utils.h" static int check_n_input( const char* ); @@ -53,7 +54,7 @@ static struct long_options l_opts[] = { * *------------------------------------------------------------------------- */ -static check_options(diff_opt_t* options) +static void check_options(diff_opt_t* options) { /*-------------------------------------------------------------- * check for mutually exclusive options @@ -179,7 +180,7 @@ void parse_command_line(int argc, } /* init */ - exclude_node->obj_path = opt_arg; + exclude_node->obj_path = (char*)opt_arg; exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN; exclude_prev = exclude_head; diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c index a014a9e..607d58e 100644 --- a/tools/h5diff/h5diff_main.c +++ b/tools/h5diff/h5diff_main.c @@ -18,6 +18,7 @@ #include #include "h5diff.h" #include "h5diff_common.h" +#include "h5tools.h" #include "h5tools_utils.h" @@ -81,11 +82,14 @@ int main(int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); + + /* Initialize h5tools lib */ + h5tools_init(); + /*------------------------------------------------------------------------- * process the command-line *------------------------------------------------------------------------- */ - parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options); /*------------------------------------------------------------------------- diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 7ea9365..d58e1b4 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -17,11 +17,18 @@ #include #include "hdf5.h" #include "H5private.h" -#include "h5tools.h" - -/* Name of tool */ -#define PROGRAMNAME "h5diffgentest" +/* + * The output functions need a temporary buffer to hold a piece of the + * dataset while it's being printed. This constant sets the limit on the + * size of that temporary buffer in bytes. For efficiency's sake, choose the + * largest value suitable for your machine (for testing use a small value). + */ +/* Maximum size used in a call to malloc for a dataset + * NOTE: this value should stay in sync with the value defined in the tools + * library file: h5tools_utils.h + */ +hsize_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); /*------------------------------------------------------------------------- * Program: h5diffgentest @@ -2828,7 +2835,7 @@ static int test_group_recurse2(void) * datatype and default dataset creation properties. */ dset1 = H5Dcreate2(fileid1, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Write the data to the dataset using default transfer properties. @@ -2844,7 +2851,7 @@ static int test_group_recurse2(void) * datatype and default dataset creation properties. */ dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Write the data to the dataset using default transfer properties. @@ -2859,7 +2866,7 @@ static int test_group_recurse2(void) * datatype and default dataset creation properties. */ dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Write the data to the dataset using default transfer properties. @@ -2914,7 +2921,7 @@ static int test_group_recurse2(void) * datatype and default dataset creation properties. */ dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Write the data to the dataset using default transfer properties. @@ -2959,7 +2966,7 @@ static int test_group_recurse2(void) * datatype and default dataset creation properties. */ dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Write the data to the dataset using default transfer properties. @@ -3003,7 +3010,7 @@ static int test_group_recurse2(void) * dset1 */ dset1 = H5Dcreate2(fileid2, GRP_R_DSETNAME1, datatype, dataspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* * Write the data to the dataset using default transfer properties. @@ -6191,9 +6198,9 @@ void write_dset_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); - assert(status >= 0); + HDassert(status >= 0); status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); @@ -6229,7 +6236,7 @@ void write_dset_in(hid_t loc_id, /* allocate and initialize array data to write */ size = ( H5TOOLS_MALLOCSIZE / sizeof(double) + 1 ) * sizeof(double); - dbuf = malloc( size ); + dbuf = HDmalloc( size ); for( j = 0; j < H5TOOLS_MALLOCSIZE / sizeof(double) + 1; j++) dbuf[j] = j; @@ -6253,7 +6260,7 @@ void write_dset_in(hid_t loc_id, H5Dclose(did); H5Tclose(tid); H5Sclose(sid); - free( dbuf ); + HDfree( dbuf ); } /*------------------------------------------------------------------------- @@ -6696,10 +6703,10 @@ void gen_datareg(hid_t fid, int i; /* allocate the buffer for write the references */ - rbuf = calloc((size_t)2, sizeof(hdset_reg_ref_t)); + rbuf = HDcalloc((size_t)2, sizeof(hdset_reg_ref_t)); /* allocate the buffer for write the data dataset */ - buf = malloc(10 * 10 * sizeof(int)); + buf = HDmalloc(10 * 10 * sizeof(int)); for(i = 0; i < 10 * 10; i++) buf[i] = i; @@ -6708,7 +6715,7 @@ void gen_datareg(hid_t fid, sid1 = H5Screate_simple(2, dims1, NULL); did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - assert(status >= 0); + HDassert(status >= 0); /* create the reference dataset */ sid2 = H5Screate_simple(1, dims2, NULL); @@ -6725,12 +6732,12 @@ void gen_datareg(hid_t fid, } status = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL); - assert(status >= 0); + HDassert(status >= 0); H5Sget_select_npoints(sid1); /* store first dataset region */ status = H5Rcreate(&rbuf[0], fid, "dsetref", H5R_DATASET_REGION, sid1); - assert(status >= 0); + HDassert(status >= 0); /* select sequence of five points for second reference */ coord[0][0]=6; coord[0][1]=9; @@ -6752,20 +6759,20 @@ void gen_datareg(hid_t fid, /* write */ status = H5Dwrite(did2,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf); - assert(status >= 0); + HDassert(status >= 0); /* close, free memory buffers */ status = H5Dclose(did1); - assert(status >= 0); + HDassert(status >= 0); status = H5Sclose(sid1); - assert(status >= 0); + HDassert(status >= 0); status = H5Dclose(did2); - assert(status >= 0); + HDassert(status >= 0); status = H5Sclose(sid2); - assert(status >= 0); + HDassert(status >= 0); - free(rbuf); - free(buf); + HDfree(rbuf); + HDfree(buf); } @@ -6845,7 +6852,7 @@ int test_hyperslab(const char *fname, } } - free(buf); + HDfree(buf); buf=NULL; /* close */ diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c index 67b0c92..1fc563b 100644 --- a/tools/h5diff/ph5diff_main.c +++ b/tools/h5diff/ph5diff_main.c @@ -19,6 +19,7 @@ #include #include #include "h5diff_common.h" +#include "h5tools.h" #include "h5tools_utils.h" /* Name of tool */ @@ -68,6 +69,9 @@ int main(int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); + /* Initialize h5tools lib */ + h5tools_init(); + outBuffOffset = 0; g_Parallel = 1; diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index 676bace..a4ac75f 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -10,7 +10,11 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- # Add the h5dump executables # -------------------------------------------------------------------- -ADD_EXECUTABLE (h5dump ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump.c) +ADD_EXECUTABLE (h5dump + ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump.c + ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump_ddl.c + ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump_xml.c +) TARGET_NAMING (h5dump ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5dump ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET_TARGET_PROPERTIES (h5dump PROPERTIES FOLDER tools) @@ -126,7 +130,7 @@ IF (BUILD_TESTING) tnamed_dtype_attr.ddl tnestcomp-1.ddl tnbit.ddl - tnofilename.ddl + tno-subset.ddl tnullspace.ddl zerodim.ddl tordergr1.ddl @@ -293,6 +297,7 @@ IF (BUILD_TESTING) tmulti-s.h5 tnamed_dtype_attr.h5 tnestedcomp.h5 + tno-subset.h5 tnullspace.h5 zerodim.h5 torderattr.h5 @@ -408,6 +413,7 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- #-- Copy all the HDF5 files from the test directory into the source directory SET (HDF5_REFERENCE_PBITS + tnofilename-with-packed-bits.ddl tpbitsArray.ddl tpbitsCompound.ddl tpbitsIncomplete.ddl @@ -827,8 +833,8 @@ IF (BUILD_TESTING) tnestcomp-1.out.err tnbit.out tnbit.out.err - tnofilename.out - tnofilename.out.err + tno-subset.out + tno-subset.out.err tnullspace.out tnullspace.out.err zerodim.out @@ -909,168 +915,174 @@ IF (BUILD_TESTING) ADD_HELP_TEST(help 0 -h) # test for signed/unsigned datasets - ADD_H5_TEST (packedbits 0 packedbits.h5) + ADD_H5_TEST (packedbits 0 --enable-error-stack packedbits.h5) # test for displaying groups - ADD_H5_TEST (tgroup-1 0 tgroup.h5) + ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5) # test for displaying the selected groups ADD_H5_TEST (tgroup-2 1 --group=/g2 --group / -g /y tgroup.h5) # test for displaying simple space datasets - ADD_H5_TEST (tdset-1 0 tdset.h5) + ADD_H5_TEST (tdset-1 0 --enable-error-stack tdset.h5) # test for displaying selected datasets ADD_H5_TEST (tdset-2 1 -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5) # test for displaying attributes - ADD_H5_TEST (tattr-1 0 tattr.h5) + ADD_H5_TEST (tattr-1 0 --enable-error-stack tattr.h5) # test for displaying the selected attributes of string type and scalar space - ADD_H5_TEST (tattr-2 0 -a /attr1 --attribute /attr4 --attribute=/attr5 tattr.h5) + ADD_H5_TEST (tattr-2 0 --enable-error-stack -a /attr1 --attribute /attr4 --attribute=/attr5 tattr.h5) # test for header and error messages ADD_H5_TEST (tattr-3 1 --header -a /attr2 --attribute=/attr tattr.h5) # test for displaying attributes in shared datatype (also in group and dataset) - ADD_H5_TEST (tnamed_dtype_attr 0 tnamed_dtype_attr.h5) + ADD_H5_TEST (tnamed_dtype_attr 0 --enable-error-stack tnamed_dtype_attr.h5) # test for displaying at least 9 attributes on root from a be machine - ADD_H5_TEST (tattr-4_be 0 tattr4_be.h5) + ADD_H5_TEST (tattr-4_be 0 --enable-error-stack tattr4_be.h5) # test for displaying soft links and user-defined links - ADD_H5_TEST (tslink-1 0 tslink.h5) - ADD_H5_TEST (tudlink-1 0 tudlink.h5) + ADD_H5_TEST (tslink-1 0 --enable-error-stack tslink.h5) + ADD_H5_TEST (tudlink-1 0 --enable-error-stack tudlink.h5) # test for displaying the selected link - ADD_H5_TEST (tslink-2 0 -l slink2 tslink.h5) - ADD_H5_TEST (tudlink-2 0 -l udlink2 tudlink.h5) + ADD_H5_TEST (tslink-2 0 --enable-error-stack -l slink2 tslink.h5) + ADD_H5_TEST (tudlink-2 0 --enable-error-stack -l udlink2 tudlink.h5) # tests for hard links - ADD_H5_TEST (thlink-1 0 thlink.h5) - ADD_H5_TEST (thlink-2 0 -d /g1/dset2 --dataset /dset1 --dataset=/g1/g1.1/dset3 thlink.h5) - ADD_H5_TEST (thlink-3 0 -d /g1/g1.1/dset3 --dataset /g1/dset2 --dataset=/dset1 thlink.h5) - ADD_H5_TEST (thlink-4 0 -g /g1 thlink.h5) - ADD_H5_TEST (thlink-5 0 -d /dset1 -g /g2 -d /g1/dset2 thlink.h5) + ADD_H5_TEST (thlink-1 0 --enable-error-stack thlink.h5) + ADD_H5_TEST (thlink-2 0 --enable-error-stack -d /g1/dset2 --dataset /dset1 --dataset=/g1/g1.1/dset3 thlink.h5) + ADD_H5_TEST (thlink-3 0 --enable-error-stack -d /g1/g1.1/dset3 --dataset /g1/dset2 --dataset=/dset1 thlink.h5) + ADD_H5_TEST (thlink-4 0 --enable-error-stack -g /g1 thlink.h5) + ADD_H5_TEST (thlink-5 0 --enable-error-stack -d /dset1 -g /g2 -d /g1/dset2 thlink.h5) # tests for compound data types - ADD_H5_TEST (tcomp-1 0 tcompound.h5) + ADD_H5_TEST (tcomp-1 0 --enable-error-stack tcompound.h5) # test for named data types - ADD_H5_TEST (tcomp-2 0 -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5) + ADD_H5_TEST (tcomp-2 0 --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5) # test for unamed type - #ADD_H5_TEST (tcomp-3 0 -t /#6632 -g /group2 tcompound.h5) + # JIRA HDFFV-7936 ADD_H5_TEST (tcomp-3 0 "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5") + ADD_H5_TEST (tcomp-3 0 "-t;/#6632;-g;/group2;tcompound.h5") # test complicated compound datatype - ADD_H5_TEST (tcomp-4 0 tcompound_complex.h5) + ADD_H5_TEST (tcomp-4 0 --enable-error-stack tcompound_complex.h5) #test for the nested compound type - ADD_H5_TEST (tnestcomp-1 0 tnestedcomp.h5) + ADD_H5_TEST (tnestcomp-1 0 --enable-error-stack tnestedcomp.h5) # test for options + # JIRA HDFFV-7936 ADD_H5_TEST (tall-1 0 --enable-error-stack tall.h5) ADD_H5_TEST (tall-1 0 tall.h5) - ADD_H5_TEST (tall-2 0 --header -g /g1/g1.1 -a attr2 tall.h5) - ADD_H5_TEST (tall-3 0 -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5) + ADD_H5_TEST (tall-2 0 --enable-error-stack --header -g /g1/g1.1 -a attr2 tall.h5) + ADD_H5_TEST (tall-3 0 --enable-error-stack -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5) # test for loop detection - ADD_H5_TEST (tloop-1 0 tloop.h5) + ADD_H5_TEST (tloop-1 0 --enable-error-stack tloop.h5) # test for string - ADD_H5_TEST (tstr-1 0 tstr.h5) - ADD_H5_TEST (tstr-2 0 tstr2.h5) + ADD_H5_TEST (tstr-1 0 --enable-error-stack tstr.h5) + ADD_H5_TEST (tstr-2 0 --enable-error-stack tstr2.h5) # test for file created by Lib SAF team - ADD_H5_TEST (tsaf 0 tsaf.h5) + ADD_H5_TEST (tsaf 0 --enable-error-stack tsaf.h5) # test for file with variable length data - ADD_H5_TEST (tvldtypes1 0 tvldtypes1.h5) - ADD_H5_TEST (tvldtypes2 0 tvldtypes2.h5) - ADD_H5_TEST (tvldtypes3 0 tvldtypes3.h5) - ADD_H5_TEST (tvldtypes4 0 tvldtypes4.h5) - ADD_H5_TEST (tvldtypes5 0 tvldtypes5.h5) + ADD_H5_TEST (tvldtypes1 0 --enable-error-stack tvldtypes1.h5) + ADD_H5_TEST (tvldtypes2 0 --enable-error-stack tvldtypes2.h5) + ADD_H5_TEST (tvldtypes3 0 --enable-error-stack tvldtypes3.h5) + ADD_H5_TEST (tvldtypes4 0 --enable-error-stack tvldtypes4.h5) + ADD_H5_TEST (tvldtypes5 0 --enable-error-stack tvldtypes5.h5) #test for file with variable length string data - ADD_H5_TEST (tvlstr 0 tvlstr.h5) + ADD_H5_TEST (tvlstr 0 --enable-error-stack tvlstr.h5) # test for files with array data - ADD_H5_TEST (tarray1 0 tarray1.h5) + ADD_H5_TEST (tarray1 0 --enable-error-stack tarray1.h5) # # added for bug# 2092 - tarray1_big.h5 + # JIRA HDFFV-7936 ADD_H5_TEST (tarray1_big 0 --enable-error-stack -R tarray1_big.h5) ADD_H5_TEST (tarray1_big 0 -R tarray1_big.h5) - ADD_H5_TEST (tarray2 0 tarray2.h5) - ADD_H5_TEST (tarray3 0 tarray3.h5) - ADD_H5_TEST (tarray4 0 tarray4.h5) - ADD_H5_TEST (tarray5 0 tarray5.h5) - ADD_H5_TEST (tarray6 0 tarray6.h5) - ADD_H5_TEST (tarray7 0 tarray7.h5) - ADD_H5_TEST (tarray8 0 tarray8.h5) + ADD_H5_TEST (tarray2 0 --enable-error-stack tarray2.h5) + ADD_H5_TEST (tarray3 0 --enable-error-stack tarray3.h5) + ADD_H5_TEST (tarray4 0 --enable-error-stack tarray4.h5) + ADD_H5_TEST (tarray5 0 --enable-error-stack tarray5.h5) + ADD_H5_TEST (tarray6 0 --enable-error-stack tarray6.h5) + ADD_H5_TEST (tarray7 0 --enable-error-stack tarray7.h5) + ADD_H5_TEST (tarray8 0 --enable-error-stack tarray8.h5) # test for files with empty data - ADD_H5_TEST (tempty 0 tempty.h5) + ADD_H5_TEST (tempty 0 --enable-error-stack tempty.h5) # test for files with groups that have comments - ADD_H5_TEST (tgrp_comments 0 tgrp_comments.h5) + ADD_H5_TEST (tgrp_comments 0 --enable-error-stack tgrp_comments.h5) # test the --filedriver flag - ADD_H5_TEST (tsplit_file 0 --filedriver=split tsplit_file) - ADD_H5_TEST (tfamily 0 --filedriver=family tfamily%05d.h5) - ADD_H5_TEST (tmulti 0 --filedriver=multi tmulti) + ADD_H5_TEST (tsplit_file 0 --enable-error-stack --filedriver=split tsplit_file) + ADD_H5_TEST (tfamily 0 --enable-error-stack --filedriver=family tfamily%05d.h5) + ADD_H5_TEST (tmulti 0 --enable-error-stack --filedriver=multi tmulti) # test for files with group names which reach > 1024 bytes in size - ADD_H5_TEST (tlarge_objname 0 -w157 tlarge_objname.h5) + ADD_H5_TEST (tlarge_objname 0 --enable-error-stack -w157 tlarge_objname.h5) # test '-A' to suppress data but print attr's + # JIRA HDFFV-7936 ADD_H5_TEST (tall-2A 0 --enable-error-stack -A tall.h5) ADD_H5_TEST (tall-2A 0 -A tall.h5) # test '-r' to print attributes in ASCII instead of decimal + # JIRA HDFFV-7936 ADD_H5_TEST (tall-2B 0 --enable-error-stack -A -r tall.h5) ADD_H5_TEST (tall-2B 0 -A -r tall.h5) # test Subsetting - ADD_H5_TEST (tall-4s 0 --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5) - ADD_H5_TEST (tall-5s 0 -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall.h5) - ADD_H5_TEST (tdset-3s 0 -d "/dset1[1,1;;;]" tdset.h5) + ADD_H5_TEST (tall-4s 0 --enable-error-stack --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5) + ADD_H5_TEST (tall-5s 0 --enable-error-stack -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall.h5) + ADD_H5_TEST (tdset-3s 0 --enable-error-stack -d "/dset1[1,1;;;]" tdset.h5) + ADD_H5_TEST (tno-subset 0 --enable-error-stack --no-compact-subset -d "AHFINDERDIRECT::ah_centroid_t[0] it=0 tl=0" tno-subset.h5) # test printing characters in ASCII instead of decimal - ADD_H5_TEST (tchar1 0 -r tchar.h5) + ADD_H5_TEST (tchar1 0 --enable-error-stack -r tchar.h5) # rev. 2004 # tests for super block - ADD_H5_TEST (tboot1 0 -H -B -d dset tfcontents1.h5) - ADD_H5_TEST (tboot2 0 -B tfcontents2.h5) + ADD_H5_TEST (tboot1 0 --enable-error-stack -H -B -d dset tfcontents1.h5) + ADD_H5_TEST (tboot2 0 --enable-error-stack -B tfcontents2.h5) # test -p with a non existing dataset ADD_H5_TEST (tperror 1 -p -d bogus tfcontents1.h5) # test for file contents - ADD_H5_TEST (tcontents 0 -n tfcontents1.h5) + ADD_H5_TEST (tcontents 0 --enable-error-stack -n tfcontents1.h5) # tests for storage layout # compact - ADD_H5_TEST (tcompact 0 -H -p -d compact tfilters.h5) + ADD_H5_TEST (tcompact 0 --enable-error-stack -H -p -d compact tfilters.h5) # contiguous - ADD_H5_TEST (tcontiguos 0 -H -p -d contiguous tfilters.h5) + ADD_H5_TEST (tcontiguos 0 --enable-error-stack -H -p -d contiguous tfilters.h5) # chunked - ADD_H5_TEST (tchunked 0 -H -p -d chunked tfilters.h5) + ADD_H5_TEST (tchunked 0 --enable-error-stack -H -p -d chunked tfilters.h5) # external - ADD_H5_TEST (texternal 0 -H -p -d external tfilters.h5) + ADD_H5_TEST (texternal 0 --enable-error-stack -H -p -d external tfilters.h5) # fill values - ADD_H5_TEST (tfill 0 -p tfvalues.h5) + ADD_H5_TEST (tfill 0 --enable-error-stack -p tfvalues.h5) # several datatype, with references , print path - ADD_H5_TEST (treference 0 tattr2.h5) + ADD_H5_TEST (treference 0 --enable-error-stack tattr2.h5) # escape/not escape non printable characters - ADD_H5_TEST (tstringe 0 -e tstr3.h5) - ADD_H5_TEST (tstring 0 tstr3.h5) + ADD_H5_TEST (tstringe 0 --enable-error-stack -e tstr3.h5) + ADD_H5_TEST (tstring 0 --enable-error-stack tstr3.h5) # char data as ASCII with non escape - ADD_H5_TEST (tstring2 0 -r -d str4 tstr3.h5) + ADD_H5_TEST (tstring2 0 --enable-error-stack -r -d str4 tstr3.h5) # array indices print/not print - ADD_H5_TEST (tindicesyes 0 taindices.h5) - ADD_H5_TEST (tindicesno 0 -y taindices.h5) + ADD_H5_TEST (tindicesyes 0 --enable-error-stack taindices.h5) + ADD_H5_TEST (tindicesno 0 --enable-error-stack -y taindices.h5) ########## array indices with subsetting # 1D case - ADD_H5_TEST (tindicessub1 0 -d 1d -s 1 -S 10 -c 2 -k 3 taindices.h5) + ADD_H5_TEST (tindicessub1 0 --enable-error-stack -d 1d -s 1 -S 10 -c 2 -k 3 taindices.h5) # 2D case - ADD_H5_TEST (tindicessub2 0 -d 2d -s 1,2 -S 3,3 -c 3,2 -k 2,2 taindices.h5) + ADD_H5_TEST (tindicessub2 0 --enable-error-stack -d 2d -s 1,2 -S 3,3 -c 3,2 -k 2,2 taindices.h5) # 3D case - ADD_H5_TEST (tindicessub3 0 -d 3d -s 0,1,2 -S 1,3,3 -c 2,2,2 -k 1,2,2 taindices.h5) + ADD_H5_TEST (tindicessub3 0 --enable-error-stack -d 3d -s 0,1,2 -S 1,3,3 -c 2,2,2 -k 1,2,2 taindices.h5) # 4D case - ADD_H5_TEST (tindicessub4 0 -d 4d -s 0,0,1,2 -c 2,2,3,2 -S 1,1,3,3 -k 1,1,2,2 taindices.h5) + ADD_H5_TEST (tindicessub4 0 --enable-error-stack -d 4d -s 0,0,1,2 -c 2,2,3,2 -S 1,1,3,3 -k 1,1,2,2 taindices.h5) # Exceed the dimensions for subsetting ADD_H5_TEST (texceedsubstart 1 -d 1d -s 1,3 taindices.h5) @@ -1129,34 +1141,34 @@ IF (BUILD_TESTING) ADD_SKIP_H5_TEST (tallfilters 0 ${TESTTYPE} -H -p -d all tfilters.h5) # user defined - ADD_H5_TEST (tuserfilter 0 -H -p -d myfilter tfilters.h5) + ADD_H5_TEST (tuserfilter 0 --enable-error-stack -H -p -d myfilter tfilters.h5) # test for displaying objects with very long names - ADD_H5_TEST (tlonglinks 0 tlonglinks.h5) + ADD_H5_TEST (tlonglinks 0 --enable-error-stack tlonglinks.h5) # dimensions over 4GB, print boundary - ADD_H5_TEST (tbigdims 0 -d dset4gb -s 4294967284 -c 22 tbigdims.h5) + ADD_H5_TEST (tbigdims 0 --enable-error-stack -d dset4gb -s 4294967284 -c 22 tbigdims.h5) # hyperslab read - ADD_H5_TEST (thyperslab 0 thyperslab.h5) + ADD_H5_TEST (thyperslab 0 --enable-error-stack thyperslab.h5) # test for displaying dataset and attribute of null space - ADD_H5_TEST (tnullspace 0 tnullspace.h5) + ADD_H5_TEST (tnullspace 0 --enable-error-stack tnullspace.h5) # test for displaying dataset and attribute of space with 0 dimension size - ADD_H5_TEST (zerodim 0 zerodim.h5) + ADD_H5_TEST (zerodim 0 --enable-error-stack zerodim.h5) # test for long double (some systems do not have long double) - #ADD_H5_TEST (tldouble 0 tldouble.h5) + #ADD_H5_TEST (tldouble 0 --enable-error-stack tldouble.h5) # test for vms - ADD_H5_TEST (tvms 0 tvms.h5) + ADD_H5_TEST (tvms 0 --enable-error-stack tvms.h5) # test for binary output - ADD_H5_TEST (tbin1LE 0 -d integer -o out1LE.bin -b LE tbinary.h5) + ADD_H5_TEST (tbin1LE 0 --enable-error-stack -d integer -o out1LE.bin -b LE tbinary.h5) # NATIVE default. the NATIVE test can be validated with h5import/h5diff - ADD_H5_TEST (tbin1 0 -d integer -o out1.bin -b tbinary.h5) + ADD_H5_TEST (tbin1 0 --enable-error-stack -d integer -o out1.bin -b tbinary.h5) IF (NOT HDF5_ENABLE_USING_MEMCHECKER) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5DUMP-tbin1 PROPERTIES DEPENDS ${last_test}) @@ -1174,7 +1186,7 @@ IF (BUILD_TESTING) SET_TESTS_PROPERTIES (H5DUMP-h5diff-out1 PROPERTIES DEPENDS H5DUMP-h5import-out1) SET (last_test "H5DUMP-h5diff-out1") - ADD_H5_TEST (tbin2 0 -b BE -d float -o out2.bin tbinary.h5) + ADD_H5_TEST (tbin2 0 --enable-error-stack -b BE -d float -o out2.bin tbinary.h5) IF (NOT HDF5_ENABLE_USING_MEMCHECKER) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5DUMP-tbin2 PROPERTIES DEPENDS ${last_test}) @@ -1183,7 +1195,7 @@ IF (BUILD_TESTING) ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) # the NATIVE test can be validated with h5import/h5diff - ADD_H5_TEST (tbin3 0 -d integer -o out3.bin -b NATIVE tbinary.h5) + ADD_H5_TEST (tbin3 0 --enable-error-stack -d integer -o out3.bin -b NATIVE tbinary.h5) IF (NOT HDF5_ENABLE_USING_MEMCHECKER) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5DUMP-tbin3 PROPERTIES DEPENDS ${last_test}) @@ -1201,7 +1213,7 @@ IF (BUILD_TESTING) SET_TESTS_PROPERTIES (H5DUMP-h5diff-out3 PROPERTIES DEPENDS H5DUMP-h5import-out3) SET (last_test "H5DUMP-h5diff-out3") - ADD_H5_TEST (tbin4 0 -d double -b FILE -o out4.bin tbinary.h5) + ADD_H5_TEST (tbin4 0 --enable-error-stack -d double -b FILE -o out4.bin tbinary.h5) IF (NOT HDF5_ENABLE_USING_MEMCHECKER) IF (NOT "${last_test}" STREQUAL "") SET_TESTS_PROPERTIES (H5DUMP-tbin4 PROPERTIES DEPENDS ${last_test}) @@ -1230,41 +1242,46 @@ IF (BUILD_TESTING) SET (last_test "H5DUMP-clear-objects") # test for dataset region references - ADD_H5_TEST (tdatareg 0 tdatareg.h5) + ADD_H5_TEST (tdatareg 0 --enable-error-stack tdatareg.h5) + # JIRA HDFFV-7936 ADD_H5_TEST (tdataregR 0 --enable-error-stack -R tdatareg.h5) ADD_H5_TEST (tdataregR 0 -R tdatareg.h5) - ADD_H5_TEST (tattrreg 0 tattrreg.h5) + ADD_H5_TEST (tattrreg 0 --enable-error-stack tattrreg.h5) + # JIRA HDFFV-7936 ADD_H5_TEST (tattrregR 0 --enable-error-stack -R tattrreg.h5) ADD_H5_TEST (tattrregR 0 -R tattrreg.h5) - ADD_H5_EXPORT_TEST (tbinregR tdatareg.h5 0 -d /Dataset1 -s 0 -R -y -o) + ADD_H5_EXPORT_TEST (tbinregR tdatareg.h5 0 --enable-error-stack -d /Dataset1 -s 0 -R -y -o) # tests for group creation order # "1" tracked, "2" name, root tracked - ADD_H5_TEST (tordergr1 0 --group=1 --sort_by=creation_order --sort_order=ascending tordergr.h5) - ADD_H5_TEST (tordergr2 0 --group=1 --sort_by=creation_order --sort_order=descending tordergr.h5) - ADD_H5_TEST (tordergr3 0 -g 2 -q name -z ascending tordergr.h5) - ADD_H5_TEST (tordergr4 0 -g 2 -q name -z descending tordergr.h5) - ADD_H5_TEST (tordergr5 0 -q creation_order tordergr.h5) + ADD_H5_TEST (tordergr1 0 --enable-error-stack --group=1 --sort_by=creation_order --sort_order=ascending tordergr.h5) + ADD_H5_TEST (tordergr2 0 --enable-error-stack --group=1 --sort_by=creation_order --sort_order=descending tordergr.h5) + ADD_H5_TEST (tordergr3 0 --enable-error-stack -g 2 -q name -z ascending tordergr.h5) + ADD_H5_TEST (tordergr4 0 --enable-error-stack -g 2 -q name -z descending tordergr.h5) + ADD_H5_TEST (tordergr5 0 --enable-error-stack -q creation_order tordergr.h5) # tests for attribute order - ADD_H5_TEST (torderattr1 0 -H --sort_by=name --sort_order=ascending torderattr.h5) - ADD_H5_TEST (torderattr2 0 -H --sort_by=name --sort_order=descending torderattr.h5) - ADD_H5_TEST (torderattr3 0 -H --sort_by=creation_order --sort_order=ascending torderattr.h5) - ADD_H5_TEST (torderattr4 0 -H --sort_by=creation_order --sort_order=descending torderattr.h5) + ADD_H5_TEST (torderattr1 0 --enable-error-stack -H --sort_by=name --sort_order=ascending torderattr.h5) + ADD_H5_TEST (torderattr2 0 --enable-error-stack -H --sort_by=name --sort_order=descending torderattr.h5) + ADD_H5_TEST (torderattr3 0 --enable-error-stack -H --sort_by=creation_order --sort_order=ascending torderattr.h5) + ADD_H5_TEST (torderattr4 0 --enable-error-stack -H --sort_by=creation_order --sort_order=descending torderattr.h5) # tests for floating point user defined printf format - ADD_H5_TEST (tfpformat 0 -m %.7f tfpformat.h5) + ADD_H5_TEST (tfpformat 0 --enable-error-stack -m %.7f tfpformat.h5) # tests for traversal of external links + # JIRA HDFFV-7936 ADD_H5_TEST (textlinksrc 0 --enable-error-stack textlinksrc.h5) ADD_H5_TEST (textlinksrc 0 textlinksrc.h5) + # JIRA HDFFV-7936 ADD_H5_TEST (textlinkfar 0 --enable-error-stack textlinkfar.h5) ADD_H5_TEST (textlinkfar 0 textlinkfar.h5) # test for dangling external links + # JIRA HDFFV-7936 ADD_H5_TEST (textlink 0 --enable-error-stack textlink.h5) ADD_H5_TEST (textlink 0 textlink.h5) # test for error stack display (BZ2048) ADD_H5_MASK_TEST (filter_fail 1 --enable-error-stack filter_fail.h5) # test for -o -y for dataset with attributes - ADD_H5_TEST (tall-6 0 -y -o data -d /g1/g1.1/dset1.1.1 tall.h5) + ADD_H5_TEST (tall-6 0 --enable-error-stack -y -o data -d /g1/g1.1/dset1.1.1 tall.h5) ####### test for dataset packed bits ###### IF (HDF5_ENABLE_USING_MEMCHECKER) @@ -1273,6 +1290,8 @@ IF (BUILD_TESTING) NAME H5DUMP_PACKED_BITS-clearall-objects COMMAND ${CMAKE_COMMAND} -E remove + tnofilename-with-packed-bits.out + tnofilename-with-packed-bits.out.err tpbitsArray.out tpbitsArray.out.err tpbitsCompound.out @@ -1386,7 +1405,7 @@ IF (BUILD_TESTING) # test failure handling # Missing file name - ADD_H5_TEST (tnofilename 1) + ADD_H5_TEST (tnofilename-with-packed-bits 1) # Limits: # Maximum number of packed bits is 8 (for now). # Maximum integer size is 8*sizeof(long long). @@ -1396,70 +1415,70 @@ IF (BUILD_TESTING) # Normal operation on both signed and unsigned int datasets. # Sanity check # Their rawdata output should be the same. - ADD_H5_TEST (tpbitsSignedWhole 0 -d /DS08BITS -M 0,8 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedWhole 0 -d /DU08BITS -M 0,8 packedbits.h5) - ADD_H5_TEST (tpbitsSignedIntWhole 0 -d /DS16BITS -M 0,16 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedIntWhole 0 -d /DU16BITS -M 0,16 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongWhole 0 -d /DS32BITS -M 0,32 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongWhole 0 -d /DU32BITS -M 0,32 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongLongWhole 0 -d /DS64BITS -M 0,64 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongLongWhole 0 -d /DU64BITS -M 0,64 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongLongWhole63 0 -d /DS64BITS -M 0,63 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongLongWhole63 0 -d /DU64BITS -M 0,63 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongLongWhole1 0 -d /DS64BITS -M 1,63 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongLongWhole1 0 -d /DU64BITS -M 1,63 packedbits.h5) + ADD_H5_TEST (tpbitsSignedWhole 0 --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedWhole 0 --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5) + ADD_H5_TEST (tpbitsSignedIntWhole 0 --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedIntWhole 0 --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5) + ADD_H5_TEST (tpbitsSignedLongWhole 0 --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedLongWhole 0 --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5) + ADD_H5_TEST (tpbitsSignedLongLongWhole 0 --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedLongLongWhole 0 --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5) + ADD_H5_TEST (tpbitsSignedLongLongWhole63 0 --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedLongLongWhole63 0 --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5) + ADD_H5_TEST (tpbitsSignedLongLongWhole1 0 --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedLongLongWhole1 0 --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5) # Half sections - ADD_H5_TEST (tpbitsSigned4 0 -d /DS08BITS -M 0,4,4,4 packedbits.h5) - ADD_H5_TEST (tpbitsUnsigned4 0 -d /DU08BITS -M 0,4,4,4 packedbits.h5) - ADD_H5_TEST (tpbitsSignedInt8 0 -d /DS16BITS -M 0,8,8,8 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedInt8 0 -d /DU16BITS -M 0,8,8,8 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLong16 0 -d /DS32BITS -M 0,16,16,16 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLong16 0 -d /DU32BITS -M 0,16,16,16 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongLong32 0 -d /DS64BITS -M 0,32,32,32 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongLong32 0 -d /DU64BITS -M 0,32,32,32 packedbits.h5) + ADD_H5_TEST (tpbitsSigned4 0 --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5) + ADD_H5_TEST (tpbitsUnsigned4 0 --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5) + ADD_H5_TEST (tpbitsSignedInt8 0 --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedInt8 0 --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5) + ADD_H5_TEST (tpbitsSignedLong16 0 --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedLong16 0 --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5) + ADD_H5_TEST (tpbitsSignedLongLong32 0 --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedLongLong32 0 --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5) # Quarter sections - ADD_H5_TEST (tpbitsSigned2 0 -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5) - ADD_H5_TEST (tpbitsUnsigned2 0 -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5) - ADD_H5_TEST (tpbitsSignedInt4 0 -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedInt4 0 -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLong8 0 -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLong8 0 -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongLong16 0 -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongLong16 0 -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5) + ADD_H5_TEST (tpbitsSigned2 0 --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5) + ADD_H5_TEST (tpbitsUnsigned2 0 --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5) + ADD_H5_TEST (tpbitsSignedInt4 0 --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedInt4 0 --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5) + ADD_H5_TEST (tpbitsSignedLong8 0 --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedLong8 0 --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5) + ADD_H5_TEST (tpbitsSignedLongLong16 0 --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedLongLong16 0 --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5) # Begin and End - ADD_H5_TEST (tpbitsSigned 0 -d /DS08BITS -M 0,2,2,6 packedbits.h5) - ADD_H5_TEST (tpbitsUnsigned 0 -d /DU08BITS -M 0,2,2,6 packedbits.h5) - ADD_H5_TEST (tpbitsSignedInt 0 -d /DS16BITS -M 0,2,10,6 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedInt 0 -d /DU16BITS -M 0,2,10,6 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLong 0 -d /DS32BITS -M 0,2,26,6 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLong 0 -d /DU32BITS -M 0,2,26,6 packedbits.h5) - ADD_H5_TEST (tpbitsSignedLongLong 0 -d /DS64BITS -M 0,2,58,6 packedbits.h5) - ADD_H5_TEST (tpbitsUnsignedLongLong 0 -d /DU64BITS -M 0,2,58,6 packedbits.h5) + ADD_H5_TEST (tpbitsSigned 0 --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5) + ADD_H5_TEST (tpbitsUnsigned 0 --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5) + ADD_H5_TEST (tpbitsSignedInt 0 --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedInt 0 --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5) + ADD_H5_TEST (tpbitsSignedLong 0 --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedLong 0 --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5) + ADD_H5_TEST (tpbitsSignedLongLong 0 --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5) + ADD_H5_TEST (tpbitsUnsignedLongLong 0 --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5) # Overlapped packed bits. - ADD_H5_TEST (tpbitsOverlapped 0 -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5) + ADD_H5_TEST (tpbitsOverlapped 0 --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5) # Maximum number of packed bits. - ADD_H5_TEST (tpbitsMax 0 -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5) + ADD_H5_TEST (tpbitsMax 0 --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5) # Compound type. - ADD_H5_TEST (tpbitsCompound 0 -d /dset1 -M 0,1,1,1 tcompound.h5) + ADD_H5_TEST (tpbitsCompound 0 --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5) # Array type. - ADD_H5_TEST (tpbitsArray 0 -d /Dataset1 -M 0,1,1,1 tarray1.h5) + ADD_H5_TEST (tpbitsArray 0 --enable-error-stack -d /Dataset1 -M 0,1,1,1 tarray1.h5) # Test Error handling. # Too many packed bits requested. Max is 8 for now. ADD_H5_TEST (tpbitsMaxExceeded 1 -d /DS08BITS -M 0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5) # Offset too large. Max is 8*sizeof(long long. ADD_H5_TEST (tpbitsOffsetExceeded 1 -d /DS08BITS -M 64,1 packedbits.h5) - ADD_H5_TEST (tpbitsCharOffsetExceeded 0 -d /DS08BITS -M 8,1 packedbits.h5) - ADD_H5_TEST (tpbitsIntOffsetExceeded 0 -d /DS16BITS -M 16,1 packedbits.h5) - ADD_H5_TEST (tpbitsLongOffsetExceeded 0 -d /DS32BITS -M 32,1 packedbits.h5) + ADD_H5_TEST (tpbitsCharOffsetExceeded 0 --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5) + ADD_H5_TEST (tpbitsIntOffsetExceeded 0 --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5) + ADD_H5_TEST (tpbitsLongOffsetExceeded 0 --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5) # Bad offset, must not be negative. ADD_H5_TEST (tpbitsOffsetNegative 1 -d /DS08BITS -M -1,1 packedbits.h5) # Bad length, must not be positive. ADD_H5_TEST (tpbitsLengthPositive 1 -d /DS08BITS -M 4,0 packedbits.h5) # Offset+Length is too large. Max is 8*sizeof(long long). ADD_H5_TEST (tpbitsLengthExceeded 1 -d /DS08BITS -M 37,28 packedbits.h5) - ADD_H5_TEST (tpbitsCharLengthExceeded 0 -d /DS08BITS -M 2,7 packedbits.h5) - ADD_H5_TEST (tpbitsIntLengthExceeded 0 -d /DS16BITS -M 10,7 packedbits.h5) - ADD_H5_TEST (tpbitsLongLengthExceeded 0 -d /DS32BITS -M 26,7 packedbits.h5) + ADD_H5_TEST (tpbitsCharLengthExceeded 0 --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5) + ADD_H5_TEST (tpbitsIntLengthExceeded 0 --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5) + ADD_H5_TEST (tpbitsLongLengthExceeded 0 --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5) # Incomplete pair of packed bits request. ADD_H5_TEST (tpbitsIncomplete 1 -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5) diff --git a/tools/h5dump/Makefile.am b/tools/h5dump/Makefile.am index 81e38d1..97d81c2 100644 --- a/tools/h5dump/Makefile.am +++ b/tools/h5dump/Makefile.am @@ -40,6 +40,9 @@ h5dump_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # All the programs depend on the hdf5 and h5tools libraries LDADD=$(LIBH5TOOLS) $(LIBHDF5) +# Source files for the program +h5dump_SOURCES=h5dump.c h5dump_ddl.c h5dump_xml.c + # Temporary files. *.h5 are generated by h5dumpgentest. They should # copied to the testfiles/ directory if update is required. CHECK_CLEANFILES+=*.h5 *.bin diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 7d462bf..9d46557 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -77,8 +77,9 @@ binread_DEPENDENCIES = $(LIBH5TOOLS) $(LIBHDF5) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent -h5dump_SOURCES = h5dump.c -h5dump_OBJECTS = h5dump.$(OBJEXT) +am_h5dump_OBJECTS = h5dump.$(OBJEXT) h5dump_ddl.$(OBJEXT) \ + h5dump_xml.$(OBJEXT) +h5dump_OBJECTS = $(am_h5dump_OBJECTS) h5dump_LDADD = $(LDADD) h5dump_DEPENDENCIES = $(LIBH5TOOLS) $(LIBHDF5) h5dump_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -114,8 +115,8 @@ am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; -SOURCES = binread.c h5dump.c h5dumpgentest.c -DIST_SOURCES = binread.c h5dump.c h5dumpgentest.c +SOURCES = binread.c $(h5dump_SOURCES) h5dumpgentest.c +DIST_SOURCES = binread.c $(h5dump_SOURCES) h5dumpgentest.c ETAGS = etags CTAGS = ctags am__tty_colors = \ @@ -420,6 +421,9 @@ h5dump_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # All the programs depend on the hdf5 and h5tools libraries LDADD = $(LIBH5TOOLS) $(LIBHDF5) + +# Source files for the program +h5dump_SOURCES = h5dump.c h5dump_ddl.c h5dump_xml.c DISTCLEANFILES = testh5dump.sh # Automake needs to be taught how to build lib, progs, and tests targets. @@ -545,6 +549,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/binread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5dump.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5dump_ddl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5dump_xml.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5dumpgentest.Po@am__quote@ .c.o: diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 147f6ab..73bfd13 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -16,383 +16,46 @@ #include #include "h5dump.h" -#include "H5private.h" -#include "h5tools.h" -#include "h5tools_utils.h" -#include "h5tools_ref.h" -#include "h5trav.h" +#include "h5dump_ddl.h" +#include "h5dump_xml.h" /* Name of tool */ #define PROGRAMNAME "h5dump" -/* Macros for displaying objects */ -#define begin_obj(obj,name,begin) \ - do { \ - if (name) \ - HDfprintf(stdout, "%s \"%s\" %s\n", (obj), (name), (begin)); \ - else \ - HDfprintf(stdout, "%s %s\n", (obj), (begin)); \ - } while(0); - -#define end_obj(obj,end) \ - do { \ - if(HDstrlen(end)) { \ - HDfprintf(stdout, "%s", end); \ - if(HDstrlen(obj)) \ - HDfprintf(stdout, " "); \ - } \ - if(HDstrlen(obj)) \ - HDfprintf(stdout, "%s", obj); \ - HDfprintf(stdout, "\n"); \ - } while(0); - -/* 3 private values: can't be set, but can be read. - Note: these are defined in H5Zprivate, they are - duplicated here. - */ -#define H5_SZIP_LSB_OPTION_MASK 8 -#define H5_SZIP_MSB_OPTION_MASK 16 -#define H5_SZIP_RAW_OPTION_MASK 128 - -/* List of table structures. There is one table structure for each file */ -typedef struct h5dump_table_list_t { - size_t nalloc; - size_t nused; - struct { - unsigned long fileno; /* File number that these tables refer to */ - hid_t oid; /* ID of an object in this file, held open so fileno is consistent */ - table_t *group_table; /* Table of groups */ - table_t *dset_table; /* Table of datasets */ - table_t *type_table; /* Table of datatypes */ - } *tables; -} h5dump_table_list_t; - -static int unamedtype = 0; /* shared datatype with no name */ -static h5dump_table_list_t table_list = {0, 0, NULL}; -static table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL; -static hbool_t hit_elink = FALSE; /* whether we have traversed an external link */ -static size_t prefix_len = 1024; -static char *prefix = NULL; static const char *driver = NULL; /* The driver to open the file with. */ -static const h5dump_header_t *dump_header_format; -static const char *fp_format = NULL; const char *outfname=NULL; - - -/* things to display or which are set via command line parameters */ -static int display_all = TRUE; -static int display_oid = FALSE; -static int display_data = TRUE; -static int display_attr_data = TRUE; -static int display_char = FALSE; /*print 1-byte numbers as ASCII */ -static int usingdasho = FALSE; -static int display_bb = FALSE; /*superblock */ -static int display_dcpl = FALSE; /*dcpl */ -static int display_fi = FALSE; /*file index */ -static int display_ai = TRUE; /*array index */ -static int display_escape = FALSE; /*escape non printable characters */ -static int display_region = FALSE; /*print region reference data */ -static int enable_error_stack= FALSE; /* re-enable error stack */ -static int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/ - -/* sort parameters */ -static H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */ -static H5_iter_order_t sort_order = H5_ITER_INC; /*sort_order [ascending | descending] */ - -#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */ -#define PACKED_BITS_SIZE_MAX 8*sizeof(long long) /* Maximum bits size of integer types of packed-bits */ -/* mask list for packed bits */ -static unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */ - -/* packed bits display parameters */ -static int packed_offset[PACKED_BITS_MAX]; -static int packed_length[PACKED_BITS_MAX]; - -/** -** Added for XML ** -**/ +static int doxml = 0; +static int useschema = 1; +static const char *xml_dtd_uri = NULL; /* module-scoped variables for XML option */ #define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd" #define DEFAULT_DTD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.dtd" -static int doxml = 0; -static int useschema = 1; -static const char *xml_dtd_uri = NULL; -static const char *xmlnsprefix="hdf5:"; -static int indent; /*how far in to indent the line */ - -/** end XML **/ - -/* internal functions */ -static hid_t h5_fileaccess(void); -static void dump_oid(hid_t oid); -static void dump_packed_bits(unsigned int packed_index, hid_t type); -static void print_enum(hid_t type); -static int xml_name_to_XID(const char *, char *, int , int ); -static void init_prefix(char **prfx, size_t prfx_len); -static void add_prefix(char **prfx, size_t *prfx_len, const char *name); -/* callback function used by H5Literate() */ -static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data); -static int dump_extlink(hid_t group, const char *linkname, const char *objname); - - - -static h5tool_format_t dataformat = { - 0, /*raw */ - - "", /*fmt_raw */ - "%d", /*fmt_int */ - "%u", /*fmt_uint */ -#ifdef H5_VMS - "%hd", /*fmt_schar */ -#else - "%hhd", /*fmt_schar */ -#endif - "%u", /*fmt_uchar */ - "%d", /*fmt_short */ - "%u", /*fmt_ushort */ - "%ld", /*fmt_long */ - "%lu", /*fmt_ulong */ - NULL, /*fmt_llong */ - NULL, /*fmt_ullong */ - "%g", /*fmt_double */ - "%g", /*fmt_float */ - - 0, /*ascii */ - 0, /*str_locale */ - 0, /*str_repeat */ - - "[ ", /*arr_pre */ - ",", /*arr_sep */ - " ]", /*arr_suf */ - 1, /*arr_linebreak */ - - "", /*cmpd_name */ - ",\n", /*cmpd_sep */ - "{\n", /*cmpd_pre */ - "}", /*cmpd_suf */ - "\n", /*cmpd_end */ - - ", ", /*vlen_sep */ - "(", /*vlen_pre */ - ")", /*vlen_suf */ - "", /*vlen_end */ - - "%s", /*elmt_fmt */ - ",", /*elmt_suf1 */ - " ", /*elmt_suf2 */ - - "", /*idx_n_fmt */ - "", /*idx_sep */ - "", /*idx_fmt */ - - 80, /*line_ncols *//*standard default columns */ - 0, /*line_per_line */ - "", /*line_pre */ - "%s", /*line_1st */ - "%s", /*line_cont */ - "", /*line_suf */ - "", /*line_sep */ - 1, /*line_multi_new */ - " ", /*line_indent */ - - 1, /*skip_first */ - - 1, /*obj_hidefileno */ - " "H5_PRINTF_HADDR_FMT, /*obj_format */ - - 1, /*dset_hidefileno */ - "DATASET %s ", /*dset_format */ - "%s", /*dset_blockformat_pre */ - "%s", /*dset_ptformat_pre */ - "%s", /*dset_ptformat */ - 1, /*array indices */ - 1 /*escape non printable characters */ -}; - -/** -** Added for XML ** -**/ -/* - * Alternative formating for data dumped to XML - * In general, the numbers are the same, but separators - * except spaces are not used. - * - * Some of these are not used, as some kinds of data are - * dumped in completely new subroutines. - * - * Some of this formatting may yet need to change. - * - * This table only affects XML output. - */ -static h5tool_format_t xml_dataformat = { - 0, /*raw */ - - "", /*fmt_raw */ - "%d", /*fmt_int */ - "%u", /*fmt_uint */ -#ifdef H5_VMS - "%hd", /*fmt_schar */ -#else - "%hhd", /*fmt_schar */ -#endif - "%u", /*fmt_uchar */ - "%d", /*fmt_short */ - "%u", /*fmt_ushort */ - "%ld", /*fmt_long */ - "%lu", /*fmt_ulong */ - NULL, /*fmt_llong */ - NULL, /*fmt_ullong */ - "%g", /*fmt_double */ - "%g", /*fmt_float */ - - 0, /*ascii */ - 0, /*str_locale */ - 0, /*str_repeat */ - - " ", /*arr_pre */ - "", /*arr_sep */ - "", /*arr_suf */ - 1, /*arr_linebreak */ - - "", /*cmpd_name */ - " ", /*cmpd_sep */ - "", /*cmpd_pre */ - "", /*cmpd_suf */ - "", /*cmpd_end */ - - " ", /*vlen_sep */ - " ", /*vlen_pre */ - "", /*vlen_suf */ - "", /*vlen_end */ - - "%s", /*elmt_fmt */ - "", /*elmt_suf1 */ - " ", /*elmt_suf2 */ - - "", /*idx_n_fmt */ - "", /*idx_sep */ - "", /*idx_fmt */ - - 80, /*line_ncols *//*standard default columns */ - 0, /*line_per_line */ - "", /*line_pre */ - "%s", /*line_1st */ - "%s", /*line_cont */ - "", /*line_suf */ - "", /*line_sep */ - 1, /*line_multi_new */ - " ", /*line_indent */ - - 1, /*skip_first */ - - 1, /*obj_hidefileno */ - " "H5_PRINTF_HADDR_FMT, /*obj_format */ - - 1, /*dset_hidefileno */ - "DATASET %s ", /*dset_format */ - "%s", /*dset_blockformat_pre */ - "%s", /*dset_ptformat_pre */ - "%s", /*dset_ptformat */ - 0, /*array indices */ - 0 /*escape non printable characters */ +/* Standard DDL output */ +static const dump_functions ddl_function_table = { + dump_group, + dump_named_datatype, + dump_dataset, + dump_dataspace, + dump_datatype, + dump_attr_cb, + dump_data }; -/** XML **/ - -static const h5dump_header_t standardformat = { - "standardformat", /*name */ - "HDF5", /*fileebgin */ - "", /*fileend */ - SUPER_BLOCK, /*bootblockbegin */ - "", /*bootblockend */ - H5_TOOLS_GROUP, /*groupbegin */ - "", /*groupend */ - H5_TOOLS_DATASET, /*datasetbegin */ - "", /*datasetend */ - ATTRIBUTE, /*attributebegin */ - "", /*attributeend */ - H5_TOOLS_DATATYPE, /*datatypebegin */ - "", /*datatypeend */ - DATASPACE, /*dataspacebegin */ - "", /*dataspaceend */ - DATA, /*databegin */ - "", /*dataend */ - SOFTLINK, /*softlinkbegin */ - "", /*softlinkend */ - EXTLINK, /*extlinkbegin */ - "", /*extlinkend */ - UDLINK, /*udlinkbegin */ - "", /*udlinkend */ - SUBSET, /*subsettingbegin */ - "", /*subsettingend */ - START, /*startbegin */ - "", /*startend */ - STRIDE, /*stridebegin */ - "", /*strideend */ - COUNT, /*countbegin */ - "", /*countend */ - BLOCK, /*blockbegin */ - "", /*blockend */ - - "{", /*fileblockbegin */ - "}", /*fileblockend */ - "{", /*bootblockblockbegin */ - "}", /*bootblockblockend */ - "{", /*groupblockbegin */ - "}", /*groupblockend */ - "{", /*datasetblockbegin */ - "}", /*datasetblockend */ - "{", /*attributeblockbegin */ - "}", /*attributeblockend */ - "", /*datatypeblockbegin */ - "", /*datatypeblockend */ - "", /*dataspaceblockbegin */ - "", /*dataspaceblockend */ - "{", /*datablockbegin */ - "}", /*datablockend */ - "{", /*softlinkblockbegin */ - "}", /*softlinkblockend */ - "{", /*extlinkblockbegin */ - "}", /*extlinkblockend */ - "{", /*udlinkblockbegin */ - "}", /*udlinkblockend */ - "{", /*strblockbegin */ - "}", /*strblockend */ - "{", /*enumblockbegin */ - "}", /*enumblockend */ - "{", /*structblockbegin */ - "}", /*structblockend */ - "{", /*vlenblockbegin */ - "}", /*vlenblockend */ - "{", /*subsettingblockbegin */ - "}", /*subsettingblockend */ - "(", /*startblockbegin */ - ");", /*startblockend */ - "(", /*strideblockbegin */ - ");", /*strideblockend */ - "(", /*countblockbegin */ - ");", /*countblockend */ - "(", /*blockblockbegin */ - ");", /*blockblockend */ - - "", /*dataspacedescriptionbegin */ - "", /*dataspacedescriptionend */ - "(", /*dataspacedimbegin */ - ")", /*dataspacedimend */ +/* XML output */ +static const dump_functions xml_function_table = { + xml_dump_group, + xml_dump_named_datatype, + xml_dump_dataset, + xml_dump_dataspace, + xml_dump_datatype, + xml_dump_attr, + xml_dump_data }; -/** -** Added for XML ** -**/ -/* internal functions used by XML option */ -static void xml_print_datatype(hid_t, unsigned); -static void xml_print_enum(hid_t); -static int xml_print_refs(hid_t, int); -static int xml_print_strs(hid_t, int); -static char *xml_escape_the_string(const char *, int); -static char *xml_escape_the_name(const char *); +/* internal functions */ +static void init_prefix(char **prfx, size_t prfx_len); /* a structure for handling the order command-line parameters come in */ struct handler_t { @@ -408,209 +71,126 @@ struct handler_t { */ /* The following initialization makes use of C language cancatenating */ /* "xxx" "yyy" into "xxxyyy". */ -static const char *s_opts = "hnpeyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:b*F:s:S:Aq:z:m:REM:"; +static const char *s_opts = "hnpeyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:b*F:s:S:Aq:z:m:RECM:"; static struct long_options l_opts[] = { - { "help", no_arg, 'h' }, - { "hel", no_arg, 'h' }, - { "contents", no_arg, 'n' }, - { "properties", no_arg, 'p' }, - { "boot-block", no_arg, 'B' }, - { "boot-bloc", no_arg, 'B' }, - { "boot-blo", no_arg, 'B' }, - { "boot-bl", no_arg, 'B' }, - { "boot-b", no_arg, 'B' }, - { "boot", no_arg, 'B' }, - { "boo", no_arg, 'B' }, - { "bo", no_arg, 'B' }, - { "header", no_arg, 'H' }, - { "heade", no_arg, 'H' }, - { "head", no_arg, 'H' }, - { "hea", no_arg, 'H' }, - { "object-ids", no_arg, 'i' }, - { "object-id", no_arg, 'i' }, - { "object-i", no_arg, 'i' }, - { "object", no_arg, 'i' }, - { "objec", no_arg, 'i' }, - { "obje", no_arg, 'i' }, - { "obj", no_arg, 'i' }, - { "ob", no_arg, 'i' }, - { "version", no_arg, 'V' }, - { "versio", no_arg, 'V' }, - { "versi", no_arg, 'V' }, - { "vers", no_arg, 'V' }, - { "ver", no_arg, 'V' }, - { "ve", no_arg, 'V' }, - { "attribute", require_arg, 'a' }, - { "attribut", require_arg, 'a' }, - { "attribu", require_arg, 'a' }, - { "attrib", require_arg, 'a' }, - { "attri", require_arg, 'a' }, - { "attr", require_arg, 'a' }, - { "att", require_arg, 'a' }, - { "at", require_arg, 'a' }, - { "block", require_arg, 'k' }, - { "bloc", require_arg, 'k' }, - { "blo", require_arg, 'k' }, - { "bl", require_arg, 'k' }, - { "count", require_arg, 'c' }, - { "coun", require_arg, 'c' }, - { "cou", require_arg, 'c' }, - { "co", require_arg, 'c' }, - { "dataset", require_arg, 'd' }, - { "datase", require_arg, 'd' }, - { "datas", require_arg, 'd' }, - { "datatype", require_arg, 't' }, - { "datatyp", require_arg, 't' }, - { "dataty", require_arg, 't' }, - { "datat", require_arg, 't' }, - { "filedriver", require_arg, 'f' }, - { "filedrive", require_arg, 'f' }, - { "filedriv", require_arg, 'f' }, - { "filedri", require_arg, 'f' }, - { "filedr", require_arg, 'f' }, - { "filed", require_arg, 'f' }, - { "file", require_arg, 'f' }, - { "fil", require_arg, 'f' }, - { "fi", require_arg, 'f' }, - { "group", require_arg, 'g' }, - { "grou", require_arg, 'g' }, - { "gro", require_arg, 'g' }, - { "gr", require_arg, 'g' }, - { "output", require_arg, 'o' }, - { "outpu", require_arg, 'o' }, - { "outp", require_arg, 'o' }, - { "out", require_arg, 'o' }, - { "ou", require_arg, 'o' }, - { "soft-link", require_arg, 'l' }, - { "soft-lin", require_arg, 'l' }, - { "soft-li", require_arg, 'l' }, - { "soft-l", require_arg, 'l' }, - { "soft", require_arg, 'l' }, - { "sof", require_arg, 'l' }, - { "start", require_arg, 's' }, - { "star", require_arg, 's' }, - { "sta", require_arg, 's' }, - { "stride", require_arg, 'S' }, - { "strid", require_arg, 'S' }, - { "string", no_arg, 'r' }, - { "strin", no_arg, 'r' }, - { "use-dtd", no_arg, 'u' }, - { "use-dt", no_arg, 'u' }, - { "use-d", no_arg, 'u' }, - { "use-", no_arg, 'u' }, - { "use", no_arg, 'u' }, - { "us", no_arg, 'u' }, - { "u", no_arg, 'u' }, - { "width", require_arg, 'w' }, - { "widt", require_arg, 'w' }, - { "wid", require_arg, 'w' }, - { "wi", require_arg, 'w' }, - { "xml-dtd", require_arg, 'D' }, - { "xml-dt", require_arg, 'D' }, - { "xml-d", require_arg, 'D' }, - { "xml-ns", require_arg, 'X' }, - { "xml-n", require_arg, 'X' }, - { "xml", no_arg, 'x' }, - { "xm", no_arg, 'x' }, - { "onlyattr", no_arg, 'A' }, - { "escape", no_arg, 'e' }, - { "noindex", no_arg, 'y' }, - { "binary", optional_arg, 'b' }, - { "form", require_arg, 'F' }, - { "sort_by", require_arg, 'q' }, - { "sort_order", require_arg, 'z' }, - { "format", require_arg, 'm' }, - { "region", no_arg, 'R' }, - { "enable-error-stack", no_arg, 'E' }, - { "packed-bits", require_arg, 'M' }, - { NULL, 0, '\0' } -}; - - -/** -** Change for XML ** -** -** The 'dump_xxx' functions have two versions, standard and XML. -** -** They are called indirectly through the 'dump_function_table'. -** e.g., dump_group(...) becomes dump_functions->dump_group(...); -** -** The standard functions are unchanged except for the way -** they are called -**/ - -/* The dump functions of the dump_function_table */ - -/* standard format: no change */ -static void dump_group(hid_t, const char *); -static void dump_named_datatype(hid_t, const char *); -static void dump_dataset(hid_t, const char *, struct subset_t *); -static void dump_dataspace(hid_t space); -static void dump_datatype(hid_t type); -static void dump_data(hid_t, int, struct subset_t *, int); -static void dump_dcpl(hid_t dcpl, hid_t type_id, hid_t obj_id); -static void dump_comment(hid_t obj_id); -static void dump_fcpl(hid_t fid); -static void dump_fcontents(hid_t fid); -/* callback function used by H5Aiterate2() */ -static herr_t dump_attr_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data); - - -/* XML format: same interface, alternative output */ - -static void xml_dump_group(hid_t, const char *); -static void xml_dump_named_datatype(hid_t, const char *); -static void xml_dump_dataset(hid_t, const char *, struct subset_t *); -static void xml_dump_dataspace(hid_t space); -static void xml_dump_datatype(hid_t type); -static herr_t xml_dump_attr(hid_t, const char *, const H5A_info_t *, void *); -static void xml_dump_data(hid_t, int, struct subset_t *, int); - -/** -** Added for XML ** -** -** This is the global dispatch table for the dump functions. -**/ -/* the table of dump functions */ -typedef struct dump_functions_t { - void (*dump_group_function) (hid_t, const char *); - void (*dump_named_datatype_function) (hid_t, const char *); - void (*dump_dataset_function) (hid_t, const char *, struct subset_t *); - void (*dump_dataspace_function) (hid_t); - void (*dump_datatype_function) (hid_t); - herr_t (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *); - void (*dump_data_function) (hid_t, int, struct subset_t *, int); -} dump_functions; - -/* Standard DDL output */ -static const dump_functions ddl_function_table = { - dump_group, - dump_named_datatype, - dump_dataset, - dump_dataspace, - dump_datatype, - dump_attr_cb, - dump_data + { "help", no_arg, 'h' }, + { "hel", no_arg, 'h' }, + { "contents", no_arg, 'n' }, + { "properties", no_arg, 'p' }, + { "boot-block", no_arg, 'B' }, + { "boot-bloc", no_arg, 'B' }, + { "boot-blo", no_arg, 'B' }, + { "boot-bl", no_arg, 'B' }, + { "boot-b", no_arg, 'B' }, + { "boot", no_arg, 'B' }, + { "boo", no_arg, 'B' }, + { "bo", no_arg, 'B' }, + { "header", no_arg, 'H' }, + { "heade", no_arg, 'H' }, + { "head", no_arg, 'H' }, + { "hea", no_arg, 'H' }, + { "object-ids", no_arg, 'i' }, + { "object-id", no_arg, 'i' }, + { "object-i", no_arg, 'i' }, + { "object", no_arg, 'i' }, + { "objec", no_arg, 'i' }, + { "obje", no_arg, 'i' }, + { "obj", no_arg, 'i' }, + { "ob", no_arg, 'i' }, + { "version", no_arg, 'V' }, + { "versio", no_arg, 'V' }, + { "versi", no_arg, 'V' }, + { "vers", no_arg, 'V' }, + { "ver", no_arg, 'V' }, + { "ve", no_arg, 'V' }, + { "attribute", require_arg, 'a' }, + { "attribut", require_arg, 'a' }, + { "attribu", require_arg, 'a' }, + { "attrib", require_arg, 'a' }, + { "attri", require_arg, 'a' }, + { "attr", require_arg, 'a' }, + { "att", require_arg, 'a' }, + { "at", require_arg, 'a' }, + { "block", require_arg, 'k' }, + { "bloc", require_arg, 'k' }, + { "blo", require_arg, 'k' }, + { "bl", require_arg, 'k' }, + { "count", require_arg, 'c' }, + { "coun", require_arg, 'c' }, + { "cou", require_arg, 'c' }, + { "co", require_arg, 'c' }, + { "dataset", require_arg, 'd' }, + { "datase", require_arg, 'd' }, + { "datas", require_arg, 'd' }, + { "datatype", require_arg, 't' }, + { "datatyp", require_arg, 't' }, + { "dataty", require_arg, 't' }, + { "datat", require_arg, 't' }, + { "filedriver", require_arg, 'f' }, + { "filedrive", require_arg, 'f' }, + { "filedriv", require_arg, 'f' }, + { "filedri", require_arg, 'f' }, + { "filedr", require_arg, 'f' }, + { "filed", require_arg, 'f' }, + { "file", require_arg, 'f' }, + { "fil", require_arg, 'f' }, + { "fi", require_arg, 'f' }, + { "group", require_arg, 'g' }, + { "grou", require_arg, 'g' }, + { "gro", require_arg, 'g' }, + { "gr", require_arg, 'g' }, + { "output", require_arg, 'o' }, + { "outpu", require_arg, 'o' }, + { "outp", require_arg, 'o' }, + { "out", require_arg, 'o' }, + { "ou", require_arg, 'o' }, + { "soft-link", require_arg, 'l' }, + { "soft-lin", require_arg, 'l' }, + { "soft-li", require_arg, 'l' }, + { "soft-l", require_arg, 'l' }, + { "soft", require_arg, 'l' }, + { "sof", require_arg, 'l' }, + { "start", require_arg, 's' }, + { "star", require_arg, 's' }, + { "sta", require_arg, 's' }, + { "stride", require_arg, 'S' }, + { "strid", require_arg, 'S' }, + { "string", no_arg, 'r' }, + { "strin", no_arg, 'r' }, + { "use-dtd", no_arg, 'u' }, + { "use-dt", no_arg, 'u' }, + { "use-d", no_arg, 'u' }, + { "use-", no_arg, 'u' }, + { "use", no_arg, 'u' }, + { "us", no_arg, 'u' }, + { "u", no_arg, 'u' }, + { "width", require_arg, 'w' }, + { "widt", require_arg, 'w' }, + { "wid", require_arg, 'w' }, + { "wi", require_arg, 'w' }, + { "xml-dtd", require_arg, 'D' }, + { "xml-dt", require_arg, 'D' }, + { "xml-d", require_arg, 'D' }, + { "xml-ns", require_arg, 'X' }, + { "xml-n", require_arg, 'X' }, + { "xml", no_arg, 'x' }, + { "xm", no_arg, 'x' }, + { "onlyattr", no_arg, 'A' }, + { "escape", no_arg, 'e' }, + { "noindex", no_arg, 'y' }, + { "binary", optional_arg, 'b' }, + { "form", require_arg, 'F' }, + { "sort_by", require_arg, 'q' }, + { "sort_order", require_arg, 'z' }, + { "format", require_arg, 'm' }, + { "region", no_arg, 'R' }, + { "enable-error-stack", no_arg, 'E' }, + { "packed-bits", require_arg, 'M' }, + { "no-compact-subset", no_arg, 'C' }, + { NULL, 0, '\0' } }; -/* XML output */ -static const dump_functions xml_function_table = { - xml_dump_group, - xml_dump_named_datatype, - xml_dump_dataset, - xml_dump_dataspace, - xml_dump_datatype, - xml_dump_attr, - xml_dump_data -}; - -/* - * The global table is set to either ddl_function_table or - * xml_function_table in the initialization. - */ -static const dump_functions *dump_function_table; - - + /*------------------------------------------------------------------------- * Function: leave * @@ -630,10 +210,10 @@ leave(int ret) { h5tools_close(); - exit(ret); + HDexit(ret); } - + /*------------------------------------------------------------------------- * Function: usage * @@ -650,106 +230,108 @@ leave(int ret) static void usage(const char *prog) { - fflush(stdout); - fprintf(stdout, "usage: %s [OPTIONS] file\n", prog); - fprintf(stdout, " OPTIONS\n"); - fprintf(stdout, " -h, --help Print a usage message and exit\n"); - fprintf(stdout, " -n, --contents Print a list of the file contents and exit\n"); - fprintf(stdout, " -B, --superblock Print the content of the super block\n"); - fprintf(stdout, " -H, --header Print the header only; no data is displayed\n"); - fprintf(stdout, " -A, --onlyattr Print the header and value of attributes\n"); - fprintf(stdout, " -i, --object-ids Print the object ids\n"); - fprintf(stdout, " -r, --string Print 1-byte integer datasets as ASCII\n"); - fprintf(stdout, " -e, --escape Escape non printing characters\n"); - fprintf(stdout, " -V, --version Print version number and exit\n"); - fprintf(stdout, " -a P, --attribute=P Print the specified attribute\n"); - fprintf(stdout, " -d P, --dataset=P Print the specified dataset\n"); - fprintf(stdout, " -y, --noindex Do not print array indices with the data\n"); - fprintf(stdout, " -p, --properties Print dataset filters, storage layout and fill value\n"); - fprintf(stdout, " -f D, --filedriver=D Specify which driver to open the file with\n"); - fprintf(stdout, " -g P, --group=P Print the specified group and all members\n"); - fprintf(stdout, " -l P, --soft-link=P Print the value(s) of the specified soft link\n"); - fprintf(stdout, " -o F, --output=F Output raw data into file F\n"); - fprintf(stdout, " -b B, --binary=B Binary file output, of form B\n"); - fprintf(stdout, " -t P, --datatype=P Print the specified named datatype\n"); - fprintf(stdout, " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n"); - fprintf(stdout, " sets the number of columns to the maximum (65535).\n"); - fprintf(stdout, " Default width is 80 columns.\n"); - fprintf(stdout, " -m T, --format=T Set the floating point output format\n"); - fprintf(stdout, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n"); - fprintf(stdout, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n"); - fprintf(stdout, - " -M L, --packedbits=L Print packed bits as unsigned integers, using mask\n" - " format L for an integer dataset specified with\n" - " option -d. L is a list of offset,length values,\n" - " separated by commas. Offset is the beginning bit in\n" - " the data value and length is the number of bits of\n" - " the mask.\n" - ); - fprintf(stdout, " -R, --region Print dataset pointed by region references\n"); - fprintf(stdout, " -x, --xml Output in XML using Schema\n"); - fprintf(stdout, " -u, --use-dtd Output in XML using DTD\n"); - fprintf(stdout, " -D U, --xml-dtd=U Use the DTD or schema at U\n"); - fprintf(stdout, " -X S, --xml-ns=S (XML Schema) Use qualified names n the XML\n"); - fprintf(stdout, " \":\": no namespace, default: \"hdf5:\"\n"); - fprintf(stdout, " E.g., to dump a file called `-f', use h5dump -- -f\n"); - fprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they\n"); - fprintf(stdout, " occur.\n"); - fprintf(stdout, "\n"); - fprintf(stdout, " Subsetting is available by using the following options with a dataset\n"); - fprintf(stdout, " attribute. Subsetting is done by selecting a hyperslab from the data.\n"); - fprintf(stdout, " Thus, the options mirror those for performing a hyperslab selection.\n"); - fprintf(stdout, " One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.\n"); - fprintf(stdout, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n"); - fprintf(stdout, " each dimension. START is optional and will default to 0 in each dimension.\n"); - fprintf(stdout, "\n"); - fprintf(stdout, " -s START, --start=START Offset of start of subsetting selection\n"); - fprintf(stdout, " -S STRIDE, --stride=STRIDE Hyperslab stride\n"); - fprintf(stdout, " -c COUNT, --count=COUNT Number of blocks to include in selection\n"); - fprintf(stdout, " -k BLOCK, --block=BLOCK Size of block in hyperslab\n"); - fprintf(stdout, " START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the\n"); - fprintf(stdout, " number of dimensions in the dataspace being queried\n"); - fprintf(stdout, "\n"); - fprintf(stdout, " D - is the file driver to use in opening the file. Acceptable values\n"); - fprintf(stdout, " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n"); - fprintf(stdout, " the file driver flag, the file will be opened with each driver in\n"); - fprintf(stdout, " turn and in the order specified above until one driver succeeds\n"); - fprintf(stdout, " in opening the file.\n"); - fprintf(stdout, " F - is a filename.\n"); - fprintf(stdout, " P - is the full path from the root group to the object.\n"); - fprintf(stdout, " N - is an integer greater than 1.\n"); - fprintf(stdout, " T - is a string containing the floating point format, e.g '%%.3f'\n"); - fprintf(stdout, " U - is a URI reference (as defined in [IETF RFC 2396],\n"); - fprintf(stdout, " updated by [IETF RFC 2732])\n"); - fprintf(stdout, " B - is the form of binary output: NATIVE for a memory type, FILE for the\n"); - fprintf(stdout, " file type, LE or BE for pre-existing little or big endian types.\n"); - fprintf(stdout, " Must be used with -o (output file) and it is recommended that\n"); - fprintf(stdout, " -d (dataset) is used. B is an optional argument, defaults to NATIVE\n"); - fprintf(stdout, " Q - is the sort index type. It can be \"creation_order\" or \"name\" (default)\n"); - fprintf(stdout, " Z - is the sort order type. It can be \"descending\" or \"ascending\" (default)\n"); - fprintf(stdout, "\n"); - fprintf(stdout, " Examples:\n"); - fprintf(stdout, "\n"); - fprintf(stdout, " 1) Attribute foo of the group /bar_none in file quux.h5\n"); - fprintf(stdout, "\n"); - fprintf(stdout, " h5dump -a /bar_none/foo quux.h5\n"); - fprintf(stdout, "\n"); - fprintf(stdout, " 2) Selecting a subset from dataset /foo in file quux.h5\n"); - fprintf(stdout, "\n"); - fprintf(stdout, " h5dump -d /foo -s \"0,1\" -S \"1,1\" -c \"2,3\" -k \"2,2\" quux.h5\n"); - fprintf(stdout, "\n"); - fprintf(stdout, " 3) Saving dataset 'dset' in file quux.h5 to binary file 'out.bin'\n"); - fprintf(stdout, " using a little-endian type\n"); - fprintf(stdout, "\n"); - fprintf(stdout, " h5dump -d /dset -b LE -o out.bin quux.h5\n"); - fprintf(stdout, "\n"); - fprintf(stdout, " 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset\n"); - fprintf(stdout, "\n"); - fprintf(stdout, " h5dump -d /dset -M 0,1,4,3 quux.h5\n"); - fprintf(stdout, "\n"); + HDfflush(rawoutstream); + HDfprintf(rawoutstream, "usage: %s [OPTIONS] file\n", prog); + HDfprintf(rawoutstream, " OPTIONS\n"); + HDfprintf(rawoutstream, " -h, --help Print a usage message and exit\n"); + HDfprintf(rawoutstream, " -n, --contents Print a list of the file contents and exit\n"); + HDfprintf(rawoutstream, " -B, --superblock Print the content of the super block\n"); + HDfprintf(rawoutstream, " -H, --header Print the header only; no data is displayed\n"); + HDfprintf(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n"); + HDfprintf(rawoutstream, " -i, --object-ids Print the object ids\n"); + HDfprintf(rawoutstream, " -r, --string Print 1-byte integer datasets as ASCII\n"); + HDfprintf(rawoutstream, " -e, --escape Escape non printing characters\n"); + HDfprintf(rawoutstream, " -V, --version Print version number and exit\n"); + HDfprintf(rawoutstream, " -a P, --attribute=P Print the specified attribute\n"); + HDfprintf(rawoutstream, " -d P, --dataset=P Print the specified dataset\n"); + HDfprintf(rawoutstream, " -y, --noindex Do not print array indices with the data\n"); + HDfprintf(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n"); + HDfprintf(rawoutstream, " -f D, --filedriver=D Specify which driver to open the file with\n"); + HDfprintf(rawoutstream, " -g P, --group=P Print the specified group and all members\n"); + HDfprintf(rawoutstream, " -l P, --soft-link=P Print the value(s) of the specified soft link\n"); + HDfprintf(rawoutstream, " -o F, --output=F Output raw data into file F\n"); + HDfprintf(rawoutstream, " -b B, --binary=B Binary file output, of form B\n"); + HDfprintf(rawoutstream, " -t P, --datatype=P Print the specified named datatype\n"); + HDfprintf(rawoutstream, " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n"); + HDfprintf(rawoutstream, " sets the number of columns to the maximum (65535).\n"); + HDfprintf(rawoutstream, " Default width is 80 columns.\n"); + HDfprintf(rawoutstream, " -m T, --format=T Set the floating point output format\n"); + HDfprintf(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n"); + HDfprintf(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n"); + HDfprintf(rawoutstream, + " -M L, --packedbits=L Print packed bits as unsigned integers, using mask\n" + " format L for an integer dataset specified with\n" + " option -d. L is a list of offset,length values,\n" + " separated by commas. Offset is the beginning bit in\n" + " the data value and length is the number of bits of\n" + " the mask.\n" + ); + HDfprintf(rawoutstream, " -R, --region Print dataset pointed by region references\n"); + HDfprintf(rawoutstream, " -x, --xml Output in XML using Schema\n"); + HDfprintf(rawoutstream, " -u, --use-dtd Output in XML using DTD\n"); + HDfprintf(rawoutstream, " -D U, --xml-dtd=U Use the DTD or schema at U\n"); + HDfprintf(rawoutstream, " -X S, --xml-ns=S (XML Schema) Use qualified names n the XML\n"); + HDfprintf(rawoutstream, " \":\": no namespace, default: \"hdf5:\"\n"); + HDfprintf(rawoutstream, " E.g., to dump a file called `-f', use h5dump -- -f\n"); + HDfprintf(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n"); + HDfprintf(rawoutstream, " occur.\n"); + HDfprintf(rawoutstream, " --no-compact-subset Disable compact form of subsetting and allow the use\n"); + HDfprintf(rawoutstream, " of \"[\" in datset names.\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " Subsetting is available by using the following options with a dataset\n"); + HDfprintf(rawoutstream, " attribute. Subsetting is done by selecting a hyperslab from the data.\n"); + HDfprintf(rawoutstream, " Thus, the options mirror those for performing a hyperslab selection.\n"); + HDfprintf(rawoutstream, " One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.\n"); + HDfprintf(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n"); + HDfprintf(rawoutstream, " each dimension. START is optional and will default to 0 in each dimension.\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " -s START, --start=START Offset of start of subsetting selection\n"); + HDfprintf(rawoutstream, " -S STRIDE, --stride=STRIDE Hyperslab stride\n"); + HDfprintf(rawoutstream, " -c COUNT, --count=COUNT Number of blocks to include in selection\n"); + HDfprintf(rawoutstream, " -k BLOCK, --block=BLOCK Size of block in hyperslab\n"); + HDfprintf(rawoutstream, " START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the\n"); + HDfprintf(rawoutstream, " number of dimensions in the dataspace being queried\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " D - is the file driver to use in opening the file. Acceptable values\n"); + HDfprintf(rawoutstream, " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n"); + HDfprintf(rawoutstream, " the file driver flag, the file will be opened with each driver in\n"); + HDfprintf(rawoutstream, " turn and in the order specified above until one driver succeeds\n"); + HDfprintf(rawoutstream, " in opening the file.\n"); + HDfprintf(rawoutstream, " F - is a filename.\n"); + HDfprintf(rawoutstream, " P - is the full path from the root group to the object.\n"); + HDfprintf(rawoutstream, " N - is an integer greater than 1.\n"); + HDfprintf(rawoutstream, " T - is a string containing the floating point format, e.g '%%.3f'\n"); + HDfprintf(rawoutstream, " U - is a URI reference (as defined in [IETF RFC 2396],\n"); + HDfprintf(rawoutstream, " updated by [IETF RFC 2732])\n"); + HDfprintf(rawoutstream, " B - is the form of binary output: NATIVE for a memory type, FILE for the\n"); + HDfprintf(rawoutstream, " file type, LE or BE for pre-existing little or big endian types.\n"); + HDfprintf(rawoutstream, " Must be used with -o (output file) and it is recommended that\n"); + HDfprintf(rawoutstream, " -d (dataset) is used. B is an optional argument, defaults to NATIVE\n"); + HDfprintf(rawoutstream, " Q - is the sort index type. It can be \"creation_order\" or \"name\" (default)\n"); + HDfprintf(rawoutstream, " Z - is the sort order type. It can be \"descending\" or \"ascending\" (default)\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " Examples:\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " 1) Attribute foo of the group /bar_none in file quux.h5\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " h5dump -a /bar_none/foo quux.h5\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " 2) Selecting a subset from dataset /foo in file quux.h5\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " h5dump -d /foo -s \"0,1\" -S \"1,1\" -c \"2,3\" -k \"2,2\" quux.h5\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " 3) Saving dataset 'dset' in file quux.h5 to binary file 'out.bin'\n"); + HDfprintf(rawoutstream, " using a little-endian type\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " h5dump -d /dset -b LE -o out.bin quux.h5\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " h5dump -d /dset -M 0,1,4,3 quux.h5\n"); + HDfprintf(rawoutstream, "\n"); } - + /*------------------------------------------------------------------------- * Function: table_list_add * @@ -764,7 +346,7 @@ usage(const char *prog) * *------------------------------------------------------------------------- */ -static ssize_t +ssize_t table_list_add(hid_t oid, unsigned long file_no) { size_t idx; /* Index of table to use */ @@ -789,7 +371,7 @@ table_list_add(hid_t oid, unsigned long file_no) return -1; } if(init_objs(oid, &info, &table_list.tables[idx].group_table, - &table_list.tables[idx].dset_table, &table_list.tables[idx].type_table) < 0) { + &table_list.tables[idx].dset_table, &table_list.tables[idx].type_table) < 0) { H5Idec_ref(oid); table_list.nused--; return -1; @@ -802,7 +384,7 @@ table_list_add(hid_t oid, unsigned long file_no) return((ssize_t) idx); } /* end table_list_add() */ - + /*------------------------------------------------------------------------- * Function: table_list_visited * @@ -817,7 +399,7 @@ table_list_add(hid_t oid, unsigned long file_no) * *------------------------------------------------------------------------- */ -static ssize_t +ssize_t table_list_visited(unsigned long file_no) { size_t u; /* Local index variable */ @@ -832,7 +414,7 @@ table_list_visited(unsigned long file_no) return(-1); } /* end table_list_visited() */ - + /*------------------------------------------------------------------------- * Function: table_list_free * @@ -872,6443 +454,1173 @@ table_list_free(void) table_list.nalloc = table_list.nused = 0; } /* end table_list_free() */ - /*------------------------------------------------------------------------- - * Function: print_datatype + * Function: set_data_output_file * - * Purpose: print the datatype. + * Purpose: Open fname as the output file for dataset raw data. + * Set rawdatastream as its file stream. * - * Return: void + * Return: 0 -- succeeded + * negative -- failed * - * Programmer: Ruey-Hsia Li + * Programmer: Albert Cheng, 2000/09/30 * - * Modifications: pvn, March 28, 2006 - * print information about type when a native match is not possible + * Modifications: + * pvn June, 1, 2006. Add a switch for binary output * *------------------------------------------------------------------------- */ -static void -print_datatype(hid_t type,unsigned in_group) +static int +set_data_output_file(const char *fname, int is_bin) { - char *mname; - hid_t mtype, str_type; - unsigned nmembers; - unsigned ndims; - unsigned i; - size_t size=0; - hsize_t dims[H5DUMP_MAX_RANK]; - H5T_str_t str_pad; - H5T_cset_t cset; - H5T_order_t order; - hid_t super; - hid_t tmp_type; - htri_t is_vlstr=FALSE; - const char *order_s=NULL; /* byte order string */ - H5T_sign_t sign; /* sign scheme value */ - const char *sign_s=NULL; /* sign scheme string */ - - if (!in_group && H5Tcommitted(type) > 0) { - H5O_info_t oinfo; - obj_t *obj; /* Found object */ - - H5Oget_info(type, &oinfo); - obj = search_obj(type_table, oinfo.addr); - - if(obj) { - if(!obj->recorded) - HDfprintf(stdout,"\"/#%a\"", obj->objno); - else - HDfprintf(stdout, "\"%s\"", obj->objname); - } - else { - error_msg("unknown committed type.\n"); - h5tools_setstatus(EXIT_FAILURE); - } - } - else { - switch(H5Tget_class(type)) { - case H5T_INTEGER: - if(H5Tequal(type, H5T_STD_I8BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I8BE"); - } - else if(H5Tequal(type, H5T_STD_I8LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I8LE"); - } - else if(H5Tequal(type, H5T_STD_I16BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I16BE"); - } - else if(H5Tequal(type, H5T_STD_I16LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I16LE"); - } - else if(H5Tequal(type, H5T_STD_I32BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I32BE"); - } - else if(H5Tequal(type, H5T_STD_I32LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I32LE"); - } - else if(H5Tequal(type, H5T_STD_I64BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I64BE"); - } - else if(H5Tequal(type, H5T_STD_I64LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_I64LE"); - } - else if(H5Tequal(type, H5T_STD_U8BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U8BE"); - } - else if(H5Tequal(type, H5T_STD_U8LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U8LE"); - } - else if(H5Tequal(type, H5T_STD_U16BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U16BE"); - } - else if(H5Tequal(type, H5T_STD_U16LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U16LE"); - } - else if(H5Tequal(type, H5T_STD_U32BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U32BE"); - } - else if(H5Tequal(type, H5T_STD_U32LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U32LE"); - } - else if(H5Tequal(type, H5T_STD_U64BE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U64BE"); - } - else if(H5Tequal(type, H5T_STD_U64LE) == TRUE) { - HDfprintf(stdout, "H5T_STD_U64LE"); - } - else if(H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_SCHAR"); - } - else if(H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_UCHAR"); - } - else if(H5Tequal(type, H5T_NATIVE_SHORT) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_SHORT"); - } - else if(H5Tequal(type, H5T_NATIVE_USHORT) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_USHORT"); - } - else if(H5Tequal(type, H5T_NATIVE_INT) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_INT"); - } - else if(H5Tequal(type, H5T_NATIVE_UINT) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_UINT"); - } - else if(H5Tequal(type, H5T_NATIVE_LONG) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_LONG"); - } - else if(H5Tequal(type, H5T_NATIVE_ULONG) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_ULONG"); - } - else if(H5Tequal(type, H5T_NATIVE_LLONG) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_LLONG"); - } - else if(H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_ULLONG"); - } - else { - - /* byte order */ - if(H5Tget_size(type)>1) { - order = H5Tget_order(type); - if (H5T_ORDER_LE == order) { - order_s = " little-endian"; - } - else if (H5T_ORDER_BE == order) { - order_s = " big-endian"; - } - else if (H5T_ORDER_VAX == order) { - order_s = " mixed-endian"; - } - else { - order_s = " unknown-byte-order"; - } - } - else { - order_s = ""; - } /* end of if(H5Tget_size(type) > 1) */ - - /* sign */ - if ((sign = H5Tget_sign(type)) >= 0) { - if (H5T_SGN_NONE == sign) { - sign_s = " unsigned"; - } - else if (H5T_SGN_2 == sign) { - sign_s = ""; - } - else { - sign_s = " unknown-sign"; - } - } - else { - sign_s = " unknown-sign"; - } /* end of if ((sign = H5Tget_sign(type)) >= 0) */ - - /* print size, order, and sign */ - HDfprintf(stdout, "%lu-bit%s%s integer", (unsigned long)(8*H5Tget_size(type)), order_s, sign_s); - } /* end of if(H5Tequal(...) */ - break; - - case H5T_FLOAT: - if(H5Tequal(type, H5T_IEEE_F32BE) == TRUE) { - HDfprintf(stdout, "H5T_IEEE_F32BE"); - } - else if(H5Tequal(type, H5T_IEEE_F32LE) == TRUE) { - HDfprintf(stdout, "H5T_IEEE_F32LE"); - } - else if(H5Tequal(type, H5T_IEEE_F64BE) == TRUE) { - HDfprintf(stdout, "H5T_IEEE_F64BE"); - } - else if(H5Tequal(type, H5T_IEEE_F64LE) == TRUE) { - HDfprintf(stdout, "H5T_IEEE_F64LE"); - } - else if(H5Tequal(type, H5T_VAX_F32) == TRUE) { - HDfprintf(stdout, "H5T_VAX_F32"); - } - else if(H5Tequal(type, H5T_VAX_F64) == TRUE) { - HDfprintf(stdout, "H5T_VAX_F64"); - } - else if(H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_FLOAT"); - } - else if(H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_DOUBLE"); -#if H5_SIZEOF_LONG_DOUBLE !=0 - } - else if(H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) { - HDfprintf(stdout, "H5T_NATIVE_LDOUBLE"); -#endif - } - else { - /* byte order */ - if(H5Tget_size(type)>1) { - order = H5Tget_order(type); - if (H5T_ORDER_LE == order) { - order_s = " little-endian"; - } - else if (H5T_ORDER_BE == order) { - order_s = " big-endian"; - } - else if (H5T_ORDER_VAX == order) { - order_s = " mixed-endian"; - } - else { - order_s = " unknown-byte-order"; - } - } - else { - order_s = ""; - } /* end of if(H5Tget_size(type) > 1) */ - - /* print size and byte order */ - HDfprintf(stdout, "%lu-bit%s floating-point", (unsigned long)(8*H5Tget_size(type)), order_s); - } /* end of if(H5Tequal(...) */ - break; - - case H5T_TIME: - HDfprintf(stdout, "H5T_TIME: not yet implemented"); - break; - - case H5T_STRING: - /* Make a copy of type in memory in case when TYPE is on disk, the size - * will be bigger than in memory. This makes it easier to compare - * types in memory. */ - tmp_type = H5Tcopy(type); - size = H5Tget_size(tmp_type); - str_pad = H5Tget_strpad(tmp_type); - cset = H5Tget_cset(tmp_type); - is_vlstr = H5Tis_variable_str(tmp_type); - - HDfprintf(stdout, "H5T_STRING %s\n", dump_header_format->strblockbegin); - indent += COL; - - indentation(indent + COL); - if(is_vlstr) - HDfprintf(stdout, "%s H5T_VARIABLE;\n", STRSIZE); - else - HDfprintf(stdout, "%s %d;\n", STRSIZE, (int) size); - - indentation(indent + COL); - HDfprintf(stdout, "%s ", STRPAD); - if (str_pad == H5T_STR_NULLTERM) - HDfprintf(stdout, "H5T_STR_NULLTERM;\n"); - else if (str_pad == H5T_STR_NULLPAD) - HDfprintf(stdout, "H5T_STR_NULLPAD;\n"); - else if (str_pad == H5T_STR_SPACEPAD) - HDfprintf(stdout, "H5T_STR_SPACEPAD;\n"); - else - HDfprintf(stdout, "H5T_STR_ERROR;\n"); - - indentation(indent + COL); - HDfprintf(stdout, "%s ", CSET); - - if (cset == H5T_CSET_ASCII) - HDfprintf(stdout, "H5T_CSET_ASCII;\n"); - else - HDfprintf(stdout, "unknown_cset;\n"); - - str_type = H5Tcopy(H5T_C_S1); - if(is_vlstr) - H5Tset_size(str_type, H5T_VARIABLE); - else - H5Tset_size(str_type, size); - H5Tset_cset(str_type, cset); - H5Tset_strpad(str_type, str_pad); - - indentation(indent + COL); - HDfprintf(stdout, "%s ", CTYPE); - - /* Check C variable-length string first. Are the two types equal? */ - if (H5Tequal(tmp_type, str_type)) { - HDfprintf(stdout, "H5T_C_S1;\n"); - goto done; - } - - /* Change the endianness and see if they're equal. */ - order = H5Tget_order(tmp_type); - if(order==H5T_ORDER_LE) - H5Tset_order(str_type, H5T_ORDER_LE); - else if(order==H5T_ORDER_BE) - H5Tset_order(str_type, H5T_ORDER_BE); - - if (H5Tequal(tmp_type, str_type)) { - HDfprintf(stdout, "H5T_C_S1;\n"); - goto done; - } - - /* If not equal to C variable-length string, check Fortran type. */ - H5Tclose(str_type); - str_type = H5Tcopy(H5T_FORTRAN_S1); - H5Tset_cset(str_type, cset); - H5Tset_size(str_type, size); - H5Tset_strpad(str_type, str_pad); - - /* Are the two types equal? */ - if (H5Tequal(tmp_type, str_type)) { - HDfprintf(stdout, "H5T_FORTRAN_S1;\n"); - goto done; - } - - /* Change the endianness and see if they're equal. */ - order = H5Tget_order(tmp_type); - if(order==H5T_ORDER_LE) - H5Tset_order(str_type, H5T_ORDER_LE); - else if(order==H5T_ORDER_BE) - H5Tset_order(str_type, H5T_ORDER_BE); - - if (H5Tequal(tmp_type, str_type)) { - HDfprintf(stdout, "H5T_FORTRAN_S1;\n"); - goto done; - } - - /* Type doesn't match any of above. */ - HDfprintf(stdout, "unknown_one_character_type;\n "); - h5tools_setstatus(EXIT_FAILURE); - - done: - H5Tclose(str_type); - H5Tclose(tmp_type); - - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s", dump_header_format->strblockend); - break; - - case H5T_BITFIELD: - if (H5Tequal(type, H5T_STD_B8BE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B8BE"); - } - else if (H5Tequal(type, H5T_STD_B8LE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B8LE"); - } - else if (H5Tequal(type, H5T_STD_B16BE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B16BE"); - } - else if (H5Tequal(type, H5T_STD_B16LE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B16LE"); - } - else if (H5Tequal(type, H5T_STD_B32BE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B32BE"); - } - else if (H5Tequal(type, H5T_STD_B32LE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B32LE"); - } - else if (H5Tequal(type, H5T_STD_B64BE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B64BE"); - } - else if (H5Tequal(type, H5T_STD_B64LE)==TRUE) { - HDfprintf(stdout, "H5T_STD_B64LE"); - } - else { - HDfprintf(stdout, "undefined bitfield"); - h5tools_setstatus(EXIT_FAILURE); - } /* end of if(H5Tequal(...) */ - break; - - case H5T_OPAQUE: - HDfprintf(stdout, "\n"); - indentation(indent + COL); - HDfprintf(stdout, "H5T_OPAQUE;\n"); - indentation(indent + COL); - mname = H5Tget_tag(type); - HDfprintf(stdout, "OPAQUE_TAG \"%s\";\n", mname); - free(mname); - indentation(indent); - break; - - case H5T_COMPOUND: - nmembers = H5Tget_nmembers(type); - HDfprintf(stdout, "H5T_COMPOUND %s\n", dump_header_format->structblockbegin); - - for (i = 0; i < nmembers; i++) { - mname = H5Tget_member_name(type, i); - mtype = H5Tget_member_type(type, i); - indentation(indent + COL); - - if (H5Tget_class(mtype) == H5T_COMPOUND) - indent += COL; - - print_datatype(mtype,0); - - if (H5Tget_class(mtype) == H5T_COMPOUND) - indent -= COL; - - HDfprintf(stdout, " \"%s\";\n", mname); - free(mname); - } /* end of for (i = 0; i < nmembers; i++) */ - - indentation(indent); - HDfprintf(stdout, "%s", dump_header_format->structblockend); - break; - - case H5T_REFERENCE: - HDfprintf(stdout, "H5T_REFERENCE"); - /* The BNF document states that the type of reference should be - * displayed after "H5T_REFERENCE". */ - if (H5Tequal(type, H5T_STD_REF_DSETREG)==TRUE) { - HDfprintf(stdout, " { H5T_STD_REF_DSETREG }"); - } - else { - HDfprintf(stdout, " { H5T_STD_REF_OBJECT }"); - } - break; - - case H5T_ENUM: - HDfprintf(stdout, "H5T_ENUM %s\n", dump_header_format->enumblockbegin); - indent += COL; - indentation(indent + COL); - super = H5Tget_super(type); - print_datatype(super,0); - HDfprintf(stdout, ";\n"); - print_enum(type); - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s", dump_header_format->enumblockend); - break; - - case H5T_VLEN: - HDfprintf(stdout, "H5T_VLEN %s ", dump_header_format->vlenblockbegin); - super = H5Tget_super(type); - print_datatype(super,0); - H5Tclose(super); - - /* Print closing */ - HDfprintf(stdout, "%s", dump_header_format->vlenblockend); - break; - - case H5T_ARRAY: - /* Get array base type */ - super = H5Tget_super(type); - - /* Print lead-in */ - HDfprintf(stdout, "H5T_ARRAY { "); - - /* Get array information */ - ndims = H5Tget_array_ndims(type); - H5Tget_array_dims2(type, dims); - - /* Print array dimensions */ - for (i = 0; i < ndims; i++) - HDfprintf(stdout, "[%d]", (int) dims[i]); - - HDfprintf(stdout, " "); - - /* Print base type */ - print_datatype(super,0); - - /* Close array base type */ - H5Tclose(super); - - /* Print closing */ - HDfprintf(stdout, " }"); + FILE *f; /* temporary holding place for the stream pointer + * so that rawdatastream is changed only when succeeded */ - break; + if (rawdatastream && rawdatastream != stdout) { + if (fclose(rawdatastream)) + perror("closing rawdatastream"); + else + rawdatastream = NULL; + } - default: - HDfprintf(stdout, "unknown datatype"); - h5tools_setstatus(EXIT_FAILURE); - break; + /* binary output */ + if (is_bin) { + if ((f = fopen(fname, "wb")) != NULL) { + rawdatastream = f; + return 0; } - } /* end else */ -} + } + else { + if ((f = fopen(fname, "w")) != NULL) { + rawdatastream = f; + return 0; + } + } + return -1; +} /*------------------------------------------------------------------------- - * Function: dump_datatype - * - * Purpose: Dump the datatype. Datatype can be HDF5 predefined - * atomic datatype or committed/transient datatype. - * - * Return: void + * Function: set_output_file * - * Programmer: Ruey-Hsia Li + * Purpose: Open fname as the output file for raw output. + * Set rawoutstream as its file stream. * - * Modifications: + * Return: 0 -- succeeded + * negative -- failed * *------------------------------------------------------------------------- */ -static void -dump_datatype(hid_t type) +static int +set_output_file(const char *fname) { - indent += COL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawoutstream is changed only when succeeded */ - indentation(indent); - HDfprintf(stdout, "%s %s ", dump_header_format->datatypebegin, dump_header_format->datatypeblockbegin); + if (rawoutstream && rawoutstream != stdout) { + if (fclose(rawoutstream)) + perror("closing rawoutstream"); + else + rawoutstream = NULL; + } - print_datatype(type,0); + if ((f = fopen(fname, "w")) != NULL) { + rawoutstream = f; + return 0; + } - end_obj(dump_header_format->datatypeend, dump_header_format->datatypeblockend); - indent -= COL; + return -1; } /*------------------------------------------------------------------------- - * Function: dump_dataspace + * Function: set_error_file * - * Purpose: Dump the dataspace. Dataspace can be named dataspace, - * array, or others. - * - * Return: void - * - * Programmer: Ruey-Hsia Li + * Purpose: Open fname as the error output file for dataset raw error. + * Set rawerrorstream as its file stream. * - * Modifications: + * Return: 0 -- succeeded + * negative -- failed * *------------------------------------------------------------------------- */ -static void -dump_dataspace(hid_t space) +static int +set_error_file(const char *fname) { - hsize_t size[H5DUMP_MAX_RANK]; - hsize_t maxsize[H5DUMP_MAX_RANK]; - int i; - - int ndims = H5Sget_simple_extent_dims(space, size, maxsize); - H5S_class_t space_type = H5Sget_simple_extent_type(space); - - indentation(indent + COL); - HDfprintf(stdout, "%s ", dump_header_format->dataspacebegin); - - switch(space_type) { - case H5S_SCALAR: - /* scalar dataspace */ - HDfprintf(stdout, "%s %s", dump_header_format->dataspacedescriptionbegin, S_SCALAR); - break; - - case H5S_SIMPLE: - /* simple dataspace */ - HDfprintf(stdout, "%s %s { %s %Hu", - dump_header_format->dataspacedescriptionbegin, S_SIMPLE, - dump_header_format->dataspacedimbegin, size[0]); - - for(i = 1; i < ndims; i++) - HDfprintf(stdout, ", %Hu", size[i]); - - HDfprintf(stdout, " %s / ", dump_header_format->dataspacedimend); + FILE *f; /* temporary holding place for the stream pointer + * so that rawerrorstream is changed only when succeeded */ - if(maxsize[0] == H5S_UNLIMITED) - HDfprintf(stdout, "%s %s", dump_header_format->dataspacedimbegin, "H5S_UNLIMITED"); + if (rawerrorstream && rawerrorstream != stderr) { + if (fclose(rawerrorstream)) + perror("closing rawerrorstream"); else - HDfprintf(stdout, "%s %Hu", dump_header_format->dataspacedimbegin, maxsize[0]); - - for(i = 1; i < ndims; i++) - if(maxsize[i] == H5S_UNLIMITED) - HDfprintf(stdout, ", %s", "H5S_UNLIMITED"); - else - HDfprintf(stdout, ", %Hu", maxsize[i]); - - HDfprintf(stdout, " %s }", dump_header_format->dataspacedimend); - break; - - case H5S_NULL: - /* null dataspace */ - HDfprintf(stdout, "%s %s", dump_header_format->dataspacedescriptionbegin, S_NULL); - break; + rawerrorstream = NULL; + } - case H5S_NO_CLASS: - default: - HDfprintf(stdout, "%s unknown dataspace %s\n", BEGIN, END); - break; - } /* end switch */ + if ((f = fopen(fname, "w")) != NULL) { + rawerrorstream = f; + return 0; + } - end_obj(dump_header_format->dataspaceend, dump_header_format->dataspaceblockend); + return -1; } - /*------------------------------------------------------------------------- - * Function: dump_attr_cb - * - * Purpose: attribute function callback called by H5Aiterate2, displays the attribute + * Function: set_binary_form * - * Return: Success: SUCCEED + * Purpose: set the binary form of output by translating from a string input + * parameter to a integer return value * - * Failure: FAIL + * Return: integer form of binary output or -1 if none found * - * Programmer: Ruey-Hsia Li + * Programmer: Pedro Vicente Nunes + * June 28, 2006 * - * Modifications: Pedro Vicente, October 4, 2007 - * Added H5A_info_t parameter to conform with H5Aiterate2 + * Modifications: * *------------------------------------------------------------------------- */ -static herr_t -dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t UNUSED *info, void UNUSED *_op_data) -{ - hid_t attr_id; - herr_t ret = SUCCEED; - - indentation(indent); - begin_obj(dump_header_format->attributebegin, attr_name, dump_header_format->attributeblockbegin); - - if((attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT)) < 0) { - indentation(indent + COL); - error_msg("unable to open attribute \"%s\"\n", attr_name); - indentation(indent); - end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - hid_t type, space; - - type = H5Aget_type(attr_id); - space = H5Aget_space(attr_id); - dump_datatype(type); - dump_dataspace(space); - - if(display_oid) - dump_oid(attr_id); - - if(display_data || display_attr_data) - dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai); - - H5Tclose(type); - H5Sclose(space); - H5Aclose(attr_id); +static int +set_binary_form(const char *form) +{ + int bform = -1; - indentation(indent); - end_obj(dump_header_format->attributeend,dump_header_format->attributeblockend); + if (strcmp(form,"NATIVE") == 0 || strcmp(form,"MEMORY") == 0) { + /* native form */ + bform = 0; } + else if (strcmp(form,"FILE") == 0) /* file type form */ + bform = 1; + else if (strcmp(form,"LE") == 0) /* convert to little endian */ + bform = 2; + else if (strcmp(form,"BE") == 0) /* convert to big endian */ + bform = 3; - return ret; + return bform; } /*------------------------------------------------------------------------- - * Function: dump_selected_attr - * - * Purpose: dump the selected attribute + * Function: set_sort_by * - * Return: Success: SUCCEED + * Purpose: set the "by" form of sorting by translating from a string input + * parameter to a H5_index_t return value + * current sort values are [creation_order | name] * - * Failure: FAIL + * Return: H5_index_t form of sort or H5_INDEX_UNKNOWN if none found * - * Programmer: Ruey-Hsia Li + * Programmer: Pedro Vicente Nunes + * October 1, 2007 * * Modifications: * *------------------------------------------------------------------------- */ -static herr_t -dump_selected_attr(hid_t loc_id, const char *name) +static H5_index_t +set_sort_by(const char *form) { - hid_t oid = -1; - hid_t attr_id = -1; - char *obj_name; - const char *attr_name; - int j; - - j = (int)HDstrlen(name) - 1; - obj_name = (char *)HDmalloc((size_t)j + 2); - if(obj_name == NULL) - goto error; - - /* find the last / */ - while(j >= 0) { - if (name[j] == '/') - break; - j--; - } - - /* object name */ - if(j == -1) - HDstrcpy(obj_name, "/"); - else { - HDstrncpy(obj_name, name, (size_t)j + 1); - obj_name[j + 1] = '\0'; - } /* end else */ - - attr_name = name + j + 1; - begin_obj(dump_header_format->attributebegin, name, - dump_header_format->attributeblockbegin); - - /* Open the object with the attribute */ - if((oid = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) { - indentation(COL); - error_msg("unable to open object \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); - goto error; - } /* end if */ - - if((attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT)) >= 0) { - hid_t type, space; - - type = H5Aget_type(attr_id); - space = H5Aget_space(attr_id); - dump_datatype(type); - dump_dataspace(space); - - if(display_oid) - dump_oid(attr_id); - - if(display_data || display_attr_data) - dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai); - - H5Tclose(type); - H5Sclose(space); - H5Aclose(attr_id); - end_obj(dump_header_format->attributeend, - dump_header_format->attributeblockend); - } - else { - indentation(COL); - error_msg("unable to open attribute \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); - goto error; - } - - /* Close object */ - if(H5Oclose(oid) < 0) { - goto error; - } /* end if */ + H5_index_t idx_type = H5_INDEX_UNKNOWN; - HDfree(obj_name); - return SUCCEED; + if (strcmp(form,"name")==0) /* H5_INDEX_NAME */ + idx_type = H5_INDEX_NAME; + else if (strcmp(form,"creation_order")==0) /* H5_INDEX_CRT_ORDER */ + idx_type = H5_INDEX_CRT_ORDER; - error: - h5tools_setstatus(EXIT_FAILURE); - if(obj_name) - HDfree(obj_name); - - H5E_BEGIN_TRY { - H5Oclose(oid); - H5Aclose(attr_id); - } H5E_END_TRY; - return FAIL; + return idx_type; } /*------------------------------------------------------------------------- - * Function: dump_all_cb - * - * Purpose: function callback called by H5Literate, - * displays everything in the specified object + * Function: set_sort_order * - * Return: Success: SUCCEED + * Purpose: set the order of sorting by translating from a string input + * parameter to a H5_iter_order_t return value + * current order values are [ascending | descending ] * - * Failure: FAIL + * Return: H5_iter_order_t form of order or H5_ITER_UNKNOWN if none found * - * Programmer: Ruey-Hsia Li + * Programmer: Pedro Vicente Nunes + * October 1, 2007 * * Modifications: - * RMcG, November 2000 - * Added XML support. Also, optionally checks the op_data argument - * - * PVN, May 2008 - * Dump external links * *------------------------------------------------------------------------- */ -static herr_t -dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED *op_data) +static H5_iter_order_t +set_sort_order(const char *form) { - hid_t obj; - herr_t ret = SUCCEED; - char *obj_path = NULL; /* Full path of object */ - - /* Build the object's path name */ - obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); - if(!obj_path) { - ret = FAIL; - goto done; - } - - HDstrcpy(obj_path, prefix); - HDstrcat(obj_path, "/"); - HDstrcat(obj_path, name); - - if(linfo->type == H5L_TYPE_HARD) { - H5O_info_t oinfo; - - /* Stat the object */ - if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) { - error_msg("unable to get object information for \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - goto done; - } /* end if */ - - switch(oinfo.type) { - case H5O_TYPE_GROUP: - if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) { - error_msg("unable to dump group \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - char *old_prefix; /* Pointer to previous prefix */ - - /* Keep copy of prefix before iterating into group */ - old_prefix = HDstrdup(prefix); - HDassert(old_prefix); - - /* Append group name to prefix */ - add_prefix(&prefix, &prefix_len, name); - - /* Iterate into group */ - dump_function_table->dump_group_function(obj, name); + H5_iter_order_t iter_order = H5_ITER_UNKNOWN; - /* Restore old prefix name */ - HDstrcpy(prefix, old_prefix); - HDfree(old_prefix); + if (strcmp(form,"ascending")==0) /* H5_ITER_INC */ + iter_order = H5_ITER_INC; + else if (strcmp(form,"descending")==0) /* H5_ITER_DEC */ + iter_order = H5_ITER_DEC; - /* Close group */ - H5Gclose(obj); - } - break; + return iter_order; +} - case H5O_TYPE_DATASET: - if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { - if(oinfo.rc > 1 || hit_elink) { - obj_t *found_obj; /* Found object */ - - found_obj = search_obj(dset_table, oinfo.addr); - - if(found_obj == NULL) { - indentation(indent); - begin_obj(dump_header_format->datasetbegin, name, dump_header_format->datasetblockbegin); - indentation(indent + COL); - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - indentation(indent); - end_obj(dump_header_format->datasetend, dump_header_format->datasetblockend); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - H5Dclose(obj); - goto done; - } - else if(found_obj->displayed) { - indentation(indent); - - if(!doxml) { - begin_obj(dump_header_format->datasetbegin, name, dump_header_format->datasetblockbegin); - indentation(indent + COL); - HDfprintf(stdout, "%s \"%s\"\n", HARDLINK, found_obj->objname); - indentation(indent); - end_obj(dump_header_format->datasetend, dump_header_format->datasetblockend); - } - else { - /* the XML version */ - char *t_obj_path = xml_escape_the_name(obj_path); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_name = xml_escape_the_name(name); - char *t_objname = xml_escape_the_name(found_obj->objname); - char dsetxid[100]; - char parentxid[100]; - char pointerxid[100]; - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(obj_path, dsetxid, sizeof(dsetxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); - - HDfprintf(stdout, "<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" " - "H5Path=\"%s\" Parents=\"%s\" " - "H5ParentPaths=\"%s\">\n", - xmlnsprefix, - t_name, /* Dataset Name */ - dsetxid, get_next_xid(), /* OBJ-XID */ - t_obj_path, /* H5Path */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - - indentation(indent + COL); - xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1); - HDfprintf(stdout, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n", - xmlnsprefix, - pointerxid,t_objname); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - - HDfree(t_name); - HDfree(t_obj_path); - HDfree(t_prefix); - HDfree(t_objname); - } - - H5Dclose(obj); - goto done; - } - else { - found_obj->displayed = TRUE; - } - } /* end if */ +/*------------------------------------------------------------------------- + * Function: parse_hsize_list + * + * Purpose: Parse a list of comma or space separated integers and return + * them in a list. The string being passed into this function + * should be at the start of the list you want to parse. You are + * responsible for freeing the array returned from here. + * + * Lists in the so-called "terse" syntax are separated by + * semicolons (;). The lists themselves can be separated by + * either commas (,) or white spaces. + * + * Return: + * + * Programmer: Bill Wendling + * Tuesday, 6. February 2001 + * + *------------------------------------------------------------------------- + */ +static void +parse_hsize_list(const char *h_list, subset_d *d) +{ + hsize_t *p_list; + const char *ptr; + unsigned int size_count = 0; + unsigned int i = 0; + unsigned int last_digit = 0; - dump_function_table->dump_dataset_function(obj, name, NULL); - H5Dclose(obj); - } - else { - error_msg("unable to dump dataset \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - break; + if (!h_list || !*h_list || *h_list == ';') + return; - case H5O_TYPE_NAMED_DATATYPE: - if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) { - error_msg("unable to dump datatype \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - dump_function_table->dump_named_datatype_function(obj, name); - H5Tclose(obj); - } - break; + /* count how many integers do we have */ + for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) + if (isdigit(*ptr)) { + if (!last_digit) + /* the last read character wasn't a digit */ + size_count++; - default: - error_msg("unknown object \"%s\"\n", name); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; + last_digit = 1; + } + else { + last_digit = 0; } - } /* end if */ - else { - char *targbuf; - - switch(linfo->type) { - case H5L_TYPE_SOFT: - indentation(indent); - targbuf = (char *)HDmalloc(linfo->u.val_size); - HDassert(targbuf); - - if(!doxml) { - begin_obj(dump_header_format->softlinkbegin, name, dump_header_format->softlinkblockbegin); - indentation(indent + COL); - } - - if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { - error_msg("unable to get link value\n"); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - /* print the value of a soft link */ - if (!doxml) { - /* Standard DDL: no modification */ - HDfprintf(stdout, "LINKTARGET \"%s\"\n", targbuf); - } - else { - /* XML */ - char linkxid[100]; - char parentxid[100]; - char targetxid[100]; - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_name = xml_escape_the_name(name); - char *t_targbuf = xml_escape_the_name(targbuf); - char *t_obj_path = xml_escape_the_name(obj_path); - char *t_link_path; - int res; - - t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1); - if(targbuf[0] == '/') - HDstrcpy(t_link_path, targbuf); - else { - HDstrcpy(t_link_path, prefix); - HDstrcat(HDstrcat(t_link_path, "/"), targbuf); - } /* end else */ - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); - - /* Try to create an OBJ-XID for the object pointed to */ - res = xml_name_to_XID(t_link_path, targetxid, sizeof(targetxid), 0); - if (res == 0) { - /* target obj found */ - HDfprintf(stdout, "<%sSoftLink LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "TargetPath=\"%s\" TargetObj=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - t_targbuf, /* TargetPath */ - targetxid, /* TargetObj */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - } - else { - /* dangling link -- omit from xml attributes */ - HDfprintf(stdout, "<%sSoftLink LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "TargetPath=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - t_targbuf, /* TargetPath */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - } - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_targbuf); - HDfree(t_obj_path); - HDfree(t_link_path); - } - } - - if (!doxml) { - indentation(indent); - end_obj(dump_header_format->softlinkend, dump_header_format->softlinkblockend); - } - - HDfree(targbuf); - break; - - case H5L_TYPE_EXTERNAL: - targbuf = (char *)HDmalloc(linfo->u.val_size); - HDassert(targbuf); - - indentation(indent); - if(!doxml) - begin_obj(dump_header_format->extlinkbegin, name, dump_header_format->extlinkblockbegin); + if (size_count == 0) + /* there aren't any integers to read */ + return; - if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { - error_msg("unable to get external link value\n"); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } /* end if */ - else { - const char *filename; - const char *targname; - - if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) { - error_msg("unable to unpack external link value\n"); - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } /* end if */ - else { - if(!doxml) { - indentation(indent + COL); - HDfprintf(stdout, "TARGETFILE \"%s\"\n", filename); - indentation(indent + COL); - HDfprintf(stdout, "TARGETPATH \"%s\"\n", targname); - - /* dump the external link */ - dump_extlink(group, name, targname); - - - } /* end if */ - /* XML */ - else { - char linkxid[100]; - char parentxid[100]; - char *t_name = xml_escape_the_name(name); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_obj_path = xml_escape_the_name(obj_path); - char *t_filename = xml_escape_the_name(filename); - char *t_targname = xml_escape_the_name(targname); - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); - - HDfprintf(stdout, "<%sExternalLink LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "TargetFilename=\"%s\" " - "TargetPath=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - filename, /* TargetFilename */ - targname, /* TargetPath*/ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_filename); - HDfree(t_targname); - HDfree(t_obj_path); - } /* end else */ - } /* end else */ - } /* end else */ - if(!doxml) { - indentation(indent); - end_obj(dump_header_format->extlinkend, dump_header_format->extlinkblockend); - } /* end if */ - HDfree(targbuf); - break; + /* allocate an array for the integers in the list */ + p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t)); - default: - indentation(indent); - if(!doxml) { - begin_obj(dump_header_format->udlinkbegin, name, dump_header_format->udlinkblockbegin); - indentation(indent + COL); - HDfprintf(stdout, "LINKCLASS %d\n", linfo->type); - indentation(indent); - end_obj(dump_header_format->udlinkend, dump_header_format->udlinkblockend); - } /* end if */ - /* XML */ - else { - char linkxid[100]; - char parentxid[100]; - char *t_name = xml_escape_the_name(name); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_obj_path = xml_escape_the_name(obj_path); - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); - - HDfprintf(stdout, "<%sUserDefined LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "LinkClass=\"%d\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - linfo->type, /* LinkClass */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_obj_path); - } /* end else */ - break; - } /* end switch */ - } /* end else */ + for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) + if(isdigit(*ptr)) { + /* we should have an integer now */ + p_list[i++] = (hsize_t)atof(ptr); - done: - if(obj_path) - HDfree(obj_path); - return ret; + while (isdigit(*ptr)) + /* scroll to end of integer */ + ptr++; + } + d->data = p_list; + d->len = size_count; + + return; } /*------------------------------------------------------------------------- - * Function: dump_named_datatype + * Function: parse_subset_params * - * Purpose: Dump named datatype + * Purpose: Parse the so-called "terse" syntax for specifying subsetting + * parameters. * - * Return: void + * Return: Success: struct subset_t object + * Failure: NULL * - * Programmer: Ruey-Hsia Li + * Programmer: Bill Wendling + * Tuesday, 6. February 2001 * * Modifications: - * Pedro Vicente, March 27, 2006 - * added display of attributes - * Pedro Vicente, October 4, 2007, added parameters to H5Aiterate2() to allow for - * other iteration orders * *------------------------------------------------------------------------- */ -static void -dump_named_datatype(hid_t tid, const char *name) +static struct subset_t * +parse_subset_params(char *dset) { - H5O_info_t oinfo; - unsigned attr_crt_order_flags; - hid_t tcpl_id; /* datatype creation property list ID */ - - - if ((tcpl_id = H5Tget_create_plist(tid)) < 0) { - error_msg("error in getting creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - /* query the creation properties for attributes */ - if (H5Pget_attr_creation_order(tcpl_id, &attr_crt_order_flags) < 0) { - error_msg("error in getting creation properties\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - if(H5Pclose(tcpl_id) < 0) { - error_msg("error in closing creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); - } + struct subset_t *s = NULL; + register char *brace; + if (!disable_compact_subset && ((brace = strrchr(dset, '[')) != NULL)) { + *brace++ = '\0'; - indentation(indent); - HDfprintf(stdout, "%s \"%s\" %s", dump_header_format->datatypebegin, name, - dump_header_format->datatypeblockbegin); + s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t)); + parse_hsize_list(brace, &s->start); - H5Oget_info(tid, &oinfo); + while (*brace && *brace != ';') + brace++; - /* Must check for uniqueness of all objects if we've traversed an elink, - * otherwise only check if the reference count > 1. - */ - if(oinfo.rc > 1 || hit_elink) { - obj_t *found_obj; /* Found object */ + if (*brace) brace++; - found_obj = search_obj(type_table, oinfo.addr); + parse_hsize_list(brace, &s->stride); - if (found_obj == NULL) { - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - else if (found_obj->displayed) { - HDfprintf(stdout, "%s \"%s\"\n", HARDLINK, found_obj->objname); - goto done; - } - else - found_obj->displayed = TRUE; - } /* end if */ + while (*brace && *brace != ';') + brace++; - print_datatype(tid, 1); - if(H5Tget_class(tid) != H5T_COMPOUND) - HDfprintf(stdout, ";\n"); + if (*brace) brace++; - /* print attributes */ - indent += COL; + parse_hsize_list(brace, &s->count); - /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set - in the datatype's create property list for attributes, then, sort by creation order, otherwise by name */ + while (*brace && *brace != ';') + brace++; - if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(tid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end if */ - else { - if(H5Aiterate2(tid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end else */ + if (*brace) brace++; - indent -= COL; + parse_hsize_list(brace, &s->block); + } - done: - end_obj(dump_header_format->datatypeend, dump_header_format->datatypeblockend); + return s; } /*------------------------------------------------------------------------- - * Function: dump_group - * - * Purpose: Dump everything within the specified group - * - * Return: void + * Function: parse_mask_list * - * Programmer: Ruey-Hsia Li + * Purpose: Parse a list of comma or space separated integers and fill + * the packed_bits list and counter. The string being passed into this function + * should be at the start of the list you want to parse. * - * Modifications: + * Return: Success: SUCCEED * - * Call to dump_all_cb -- add parameter to select everything. + * Failure: FAIL * - * Pedro Vicente, October 1, 2007 - * handle several iteration orders for attributes and groups * *------------------------------------------------------------------------- */ -static void -dump_group(hid_t gid, const char *name) +static int +parse_mask_list(const char *h_list) { - H5O_info_t oinfo; - hid_t dset; - hid_t type; - hid_t gcpl_id; - unsigned crt_order_flags; - unsigned attr_crt_order_flags; - char type_name[1024]; - char *tmp = NULL; - - if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { - error_msg("error in getting group creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); - } + int offset_value; + int length_value; + unsigned long long temp_mask; + const char *ptr = NULL; - /* query the group creation properties for attributes */ - if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) { - error_msg("error in getting group creation properties\n"); - h5tools_setstatus(EXIT_FAILURE); - } + /* sanity check */ + HDassert(h_list); - /* query the group creation properties */ - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { - error_msg("error in getting group creation properties\n"); - h5tools_setstatus(EXIT_FAILURE); - } + HDmemset(packed_mask,0,sizeof(packed_mask)); - if(H5Pclose(gcpl_id) < 0) { - error_msg("error in closing group creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - - tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); - HDstrcpy(tmp, prefix); - indentation(indent); - begin_obj(dump_header_format->groupbegin, name, dump_header_format->groupblockbegin); - indent += COL; - - if(display_oid) - dump_oid(gid); - - dump_comment(gid); - - if(!HDstrcmp(name, "/") && unamedtype) { - unsigned u; /* Local index variable */ - - /* dump unamed type in root group */ - for(u = 0; u < type_table->nobjs; u++) - if(!type_table->objs[u].recorded) { - dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); - type = H5Dget_type(dset); - sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); - dump_function_table->dump_named_datatype_function(type, type_name); - H5Tclose(type); - H5Dclose(dset); - } - } /* end if */ - - H5Oget_info(gid, &oinfo); - - /* Must check for uniqueness of all objects if we've traversed an elink, - * otherwise only check if the reference count > 1. - */ - if(oinfo.rc > 1 || hit_elink) { - obj_t *found_obj; /* Found object */ - - found_obj = search_obj(group_table, oinfo.addr); - - if (found_obj == NULL) { - indentation(indent); - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); + packed_bits_num = 0; + /* scan in pair of offset,length separated by commas. */ + ptr = h_list; + while (*ptr) { + /* scan for an offset which is an unsigned int */ + if (!HDisdigit(*ptr)) { + error_msg("Bad mask list(%s)\n", h_list); + return FAIL; } - else if (found_obj->displayed) { - indentation(indent); - HDfprintf(stdout, "%s \"%s\"\n", HARDLINK, found_obj->objname); + offset_value = HDatoi(ptr); + if (offset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX) { + error_msg("Packed Bit offset value(%d) must be between 0 and %d\n", + offset_value, PACKED_BITS_SIZE_MAX - 1); + return FAIL; } - else { - found_obj->displayed = TRUE; - /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set - in the group for attributes, then, sort by creation order, otherwise by name */ - - if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end if */ - else { - if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end else */ - - /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set - in the group, then, sort by creation order, otherwise by name */ - - if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); - else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); + /* skip to end of integer */ + while (HDisdigit(*++ptr)) + ; + /* Look for the common separator */ + if (*ptr++ != ',') { + error_msg("Bad mask list(%s), missing expected comma separator.\n", h_list); + return FAIL; } - } - else { - /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set - in the group for attributes, then, sort by creation order, otherwise by name */ - - if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end if */ - else { - if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end else */ + /* scan for a length which is a positive int */ + if (!HDisdigit(*ptr)) { + error_msg("Bad mask list(%s)\n", h_list); + return FAIL; + } + length_value = HDatoi(ptr); + if (length_value <= 0) { + error_msg("Packed Bit length value(%d) must be positive.\n", length_value); + return FAIL; + } + if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX){ + error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n", + offset_value+length_value, PACKED_BITS_SIZE_MAX); + return FAIL; + } - /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set - in the group, then, sort by creation order, otherwise by name */ + /* skip to end of int */ + while (HDisdigit(*++ptr)) + ; - if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); + /* store the offset,length pair */ + if (packed_bits_num >= PACKED_BITS_MAX) { + /* too many requests */ + error_msg("Too many masks requested (max. %d). Mask list(%s)\n", PACKED_BITS_MAX, h_list); + return FAIL; + } + packed_offset[packed_bits_num] = offset_value; + packed_length[packed_bits_num] = length_value; + /* create the bit mask by left shift 1's by length, then negate it. */ + /* After packed_mask is calculated, packed_length is not needed but */ + /* keep it for debug purpose. */ + temp_mask = ~0L; + if(length_value<8*sizeof(unsigned long long)) { + temp_mask = temp_mask << length_value; + packed_mask[packed_bits_num] = ~temp_mask; + } else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); - - - } - - indent -= COL; - indentation(indent); - end_obj(dump_header_format->groupend, dump_header_format->groupblockend); - free(tmp); -} - -/*------------------------------------------------------------------------- - * Function: dump_dataset - * - * Purpose: Dump the specified data set - * - * Return: void - * - * Programmer: Ruey-Hsia Li - * - * Modifications: - * Pedro Vicente, 2004, added dataset creation property list display - * Pedro Vicente, October 4, 2007, added parameters to H5Aiterate2() to allow for - * other iteration orders - * - *------------------------------------------------------------------------- - */ -static void -dump_dataset(hid_t did, const char *name, struct subset_t *sset) -{ - hid_t type, space; - unsigned attr_crt_order_flags; - hid_t dcpl_id; /* dataset creation property list ID */ - - if ((dcpl_id = H5Dget_create_plist(did)) < 0) { - error_msg("error in getting creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - /* query the creation properties for attributes */ - if (H5Pget_attr_creation_order(dcpl_id, &attr_crt_order_flags) < 0) { - error_msg("error in getting creation properties\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - indentation(indent); - begin_obj(dump_header_format->datasetbegin, name, dump_header_format->datasetblockbegin); - - type = H5Dget_type(did); - space = H5Dget_space(did); - - dump_comment(did); - dump_datatype(type); - dump_dataspace(space); - - if(display_oid) - dump_oid(did); - - if(display_dcpl) - dump_dcpl(dcpl_id, type, did); + packed_mask[packed_bits_num] = temp_mask; + packed_bits_num++; - if(display_data) { - int data_loop = 1; - int i; - if(display_packed_bits) - data_loop = packed_bits_num; - for(i=0;idatasetend,dump_header_format->datasetblockend); + return SUCCEED; } + /*------------------------------------------------------------------------- - * Function: dump_dims + * Function: free_handler * - * Purpose: Dump the dimensions handed to it in a comma separated list + * Purpose: Convenience function to free the handler_t structures. Needs a + * length variable (LEN) to know how many in the array it needs + * to free * - * Return: void + * Return: Nothing * * Programmer: Bill Wendling - * Tuesday, 27. February 2001 + * Tuesday, 20. February 2001 * * Modifications: * *------------------------------------------------------------------------- */ static void -dump_dims(hsize_t *s, int dims) +free_handler(struct handler_t *hand, int len) { - int i; + register int i; + + if(hand) { + for (i = 0; i < len; i++) { + if(hand[i].obj) { + HDfree(hand[i].obj); + hand[i].obj=NULL; + } - for (i = 0; i < dims; i++) { - printf(HSIZE_T_FORMAT, s[i]); + if (hand[i].subset_info) { + if(hand[i].subset_info->start.data) + HDfree(hand[i].subset_info->start.data); + if(hand[i].subset_info->stride.data) + HDfree(hand[i].subset_info->stride.data); + if(hand[i].subset_info->count.data) + HDfree(hand[i].subset_info->count.data); + if(hand[i].subset_info->block.data) + HDfree(hand[i].subset_info->block.data); + + HDfree(hand[i].subset_info); + hand[i].subset_info=NULL; + } + } - if (i + 1 != dims) HDfprintf(stdout, ", "); + HDfree(hand); } } + /*------------------------------------------------------------------------- - * Function: dump_subsetting_header + * Function: parse_command_line * - * Purpose: Dump the subsetting header like specified in the DDL. + * Purpose: Parse the command line for the h5dumper. * - * Return: void + * Return: Success: A pointer to an array of handler_t structures. + * These contain all the information needed to dump + * the necessary object. + * + * Failure: Exits program with EXIT_FAILURE value. * * Programmer: Bill Wendling - * Tuesday, 27. February 2001 + * Tuesday, 20. February 2001 * * Modifications: + * pvn June, 1, 2006. Add a switch for binary output * *------------------------------------------------------------------------- */ -static void -dump_subsetting_header(struct subset_t *sset, int dims) +static struct handler_t * +parse_command_line(int argc, const char *argv[]) { - indentation(indent); - HDfprintf(stdout, "%s %s\n", dump_header_format->subsettingbegin, dump_header_format->subsettingblockbegin); - - indent += COL; - indentation(indent); - HDfprintf(stdout, "%s %s ", dump_header_format->startbegin, dump_header_format->startblockbegin); - dump_dims(sset->start.data, dims); - HDfprintf(stdout, "%s %s\n", dump_header_format->startend, dump_header_format->startblockend); + struct handler_t *hand = NULL; + struct handler_t *last_dset = NULL; + int i; + int opt; + int last_was_dset = FALSE; - indentation(indent); - HDfprintf(stdout, "%s %s ", dump_header_format->stridebegin, dump_header_format->strideblockbegin); - dump_dims(sset->stride.data, dims); - HDfprintf(stdout, "%s %s\n", dump_header_format->strideend, dump_header_format->strideblockend); + /* no arguments */ + if (argc == 1) { + usage(h5tools_getprogname()); + goto error; + } - indentation(indent); - HDfprintf(stdout, "%s %s ", dump_header_format->countbegin, dump_header_format->countblockbegin); + /* this will be plenty big enough to hold the info */ + if((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t)))==NULL) { + goto error; + } - if(sset->count.data) - dump_dims(sset->count.data, dims); - else - HDfprintf(stdout, "DEFAULT"); + /* parse command line options */ + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { +parse_start: + switch ((char)opt) { + case 'R': + display_region = TRUE; + region_output = TRUE; + break; + case 'B': + display_bb = TRUE; + last_was_dset = FALSE; + break; + case 'n': + display_fi = TRUE; + last_was_dset = FALSE; + break; + case 'p': + display_dcpl = TRUE; + break; + case 'y': + display_ai = FALSE; + break; + case 'e': + display_escape = TRUE; + break; + case 'H': + display_data = FALSE; + display_attr_data = FALSE; + last_was_dset = FALSE; + break; + case 'A': + display_data = FALSE; + display_attr_data = TRUE; + last_was_dset = FALSE; + break; + case 'i': + display_oid = TRUE; + last_was_dset = FALSE; + break; + case 'r': + display_char = TRUE; + break; + case 'V': + print_version(h5tools_getprogname()); + free_handler(hand, argc); + hand = NULL; + h5tools_setstatus(EXIT_SUCCESS); + goto done; + break; + case 'w': + h5tools_nCols = HDatoi(opt_arg); + last_was_dset = FALSE; + break; + case 'a': + display_all = 0; - HDfprintf(stdout, "%s %s\n", dump_header_format->countend, dump_header_format->countblockend); + for (i = 0; i < argc; i++) + if (!hand[i].func) { + hand[i].func = handle_attributes; + hand[i].obj = HDstrdup(opt_arg); + break; + } - indentation(indent); - HDfprintf(stdout, "%s %s ", dump_header_format->blockbegin, dump_header_format->blockblockbegin); + last_was_dset = FALSE; + break; + case 'd': + display_all = 0; - if(sset->block.data) - dump_dims(sset->block.data, dims); - else - HDfprintf(stdout, "DEFAULT"); + for (i = 0; i < argc; i++) + if (!hand[i].func) { + hand[i].func = handle_datasets; + hand[i].obj = HDstrdup(opt_arg); + hand[i].subset_info = parse_subset_params(hand[i].obj); + last_dset = &hand[i]; + break; + } - HDfprintf(stdout, "%s %s\n", dump_header_format->blockend, dump_header_format->blockblockend); -} + last_was_dset = TRUE; + break; + case 'f': + driver = opt_arg; + break; + case 'g': + display_all = 0; -/*------------------------------------------------------------------------- - * Function: dump_data - * - * Purpose: Dump attribute or dataset data - * - * Return: void - * - * Programmer: Ruey-Hsia Li - * - * Modifications: pvn, print the matrix indices - * Albert Cheng, 2004/11/18 - * Add --string printing for attributes too. - * - *------------------------------------------------------------------------- - */ -static void -dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) -{ - H5S_class_t space_type; - int ndims; - int i; - hid_t space; - hid_t type; - hid_t p_type; - hsize_t size[64]; - hsize_t alloc_size; - hsize_t nelmts = 1; - int depth; - int stdindent = COL; /* should be 3 */ - int status = -1; - void *buf = NULL; - h5tool_format_t *outputformat = &dataformat; - - if (fp_format) { - outputformat->fmt_double = fp_format; - outputformat->fmt_float = fp_format; - } - - if (nCols==0) { - outputformat->line_ncols = 65535; - outputformat->line_per_line = 1; - } - else - outputformat->line_ncols = nCols; - outputformat->do_escape=display_escape; - /* print the matrix indices */ - outputformat->pindex=display_index; - - /* do not print indices for regions */ - if(obj_data == DATASET_DATA) { - hid_t f_type = H5Dget_type(obj_id); - - if (H5Tequal(f_type, H5T_STD_REF_DSETREG)) { - /* For the region option, correct the display of indices */ - if (display_region) { - if (display_index) { - outputformat->pindex = 1; - outputformat->idx_fmt = "(%s): "; - outputformat->idx_n_fmt = HSIZE_T_FORMAT; - outputformat->idx_sep = ","; - outputformat->line_pre = "%s"; - } - else { - outputformat->pindex = 0; - outputformat->idx_fmt = ""; - outputformat->idx_n_fmt = ""; - outputformat->idx_sep = ""; - outputformat->line_pre = ""; - } - } - else - outputformat->pindex = 0; - } - H5Tclose(f_type); - } - - if (outputformat->pindex) { - outputformat->idx_fmt = "(%s): "; - outputformat->idx_n_fmt = HSIZE_T_FORMAT; - outputformat->idx_sep = ","; - outputformat->line_pre = "%s"; - } - - indent += COL; - - /* - * the depth will tell us how far we need to indent extra. we use to just - * use indent but with the merging of the tools lib we have to do - * something different for the lib funtions... the normal indentation is 6 - * so when we don't need any extra indentation, depth will be 0. - */ - depth = indent / stdindent + 1; - - if (sset && obj_data == DATASET_DATA) { - hid_t f_space = H5Dget_space(obj_id); - - dump_subsetting_header(sset, H5Sget_simple_extent_ndims(f_space)); - H5Sclose(f_space); - - /* recalculate the depth of the data */ - depth = indent / stdindent + 1; - } - - indentation(indent); - begin_obj(dump_header_format->databegin, (const char *)NULL, dump_header_format->datablockbegin); - - /* Print all the values. */ - if(obj_data == DATASET_DATA) { - h5tool_format_t string_dataformat; - char string_prefix[64]; - hid_t f_type = H5Dget_type(obj_id); - - if((display_char && H5Tget_size(f_type) == 1) && (H5Tget_class(f_type) == H5T_INTEGER)) { - /* - * Print 1-byte integer data as an ASCII character string - * instead of integers if the `-r' or `--string' command-line - * option was given. - * - * We don't want to modify the global dataformat, so make a - * copy of it instead. - */ - string_dataformat = *outputformat; - string_dataformat.idx_fmt = " "; - string_dataformat.line_multi_new = 1; - string_dataformat.line_1st = " %s\""; - string_dataformat.line_pre = " %s"; - string_dataformat.line_cont = " %s"; - string_dataformat.str_repeat = 8; - string_dataformat.ascii = TRUE; - string_dataformat.elmt_suf1 = ""; - string_dataformat.elmt_suf2 = ""; - string_dataformat.line_indent = ""; - strcpy(string_prefix, string_dataformat.line_pre); - strcat(string_prefix, "\""); - string_dataformat.line_pre = string_prefix; - string_dataformat.line_suf = "\""; - outputformat = &string_dataformat; - } - - - status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, sset, depth); - - H5Tclose(f_type); - } - else { - /* need to call h5tools_dump_mem for the attribute data */ - space = H5Aget_space(obj_id); - space_type = H5Sget_simple_extent_type(space); - if(space_type == H5S_NULL || space_type == H5S_NO_CLASS) { - status = SUCCEED; - } - else { - char string_prefix[64]; - h5tool_format_t string_dataformat; - - /* VL data special information */ - unsigned int vl_data = 0; /* contains VL datatypes */ - - type = H5Aget_type(obj_id); - p_type = h5tools_get_native_type(type); - - ndims = H5Sget_simple_extent_dims(space, size, NULL); - - /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) - vl_data = TRUE; - - for (i = 0; i < ndims; i++) - nelmts *= size[i]; - - alloc_size = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); - assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - - if(alloc_size) { - buf = malloc((size_t)alloc_size); - assert(buf); - - if (H5Aread(obj_id, p_type, buf) >= 0) - if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) { - /* - * Print 1-byte integer data as an ASCII character string - * instead of integers if the `-r' or `--string' command-line - * option was given. - * - * We don't want to modify the global dataformat, so make a - * copy of it instead. - */ - string_dataformat = *outputformat; - string_dataformat.idx_fmt = " "; - string_dataformat.line_multi_new = 1; - string_dataformat.line_1st = " %s\""; - string_dataformat.line_pre = " %s"; - string_dataformat.line_cont = " %s"; - string_dataformat.str_repeat = 8; - string_dataformat.ascii = TRUE; - string_dataformat.elmt_suf1 = ""; - string_dataformat.elmt_suf2 = ""; - string_dataformat.line_indent = ""; - strcpy(string_prefix, string_dataformat.line_pre); - strcat(string_prefix, "\""); - string_dataformat.line_pre = string_prefix; - string_dataformat.line_suf = "\""; - outputformat = &string_dataformat; - } - - status = h5tools_dump_mem(stdout, outputformat, obj_id, p_type, space, buf, depth); - - /* Reclaim any VL memory, if necessary */ - if (vl_data) - H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); - - free(buf); - } - else - status = SUCCEED; - - H5Tclose(p_type); - H5Tclose(type); - } - H5Sclose(space); - } - - if (status == FAIL) { - indentation(indent + COL); - error_msg("unable to print data\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - indentation(indent); - end_obj(dump_header_format->dataend, dump_header_format->datablockend); - indent -= COL; - - if (sset && obj_data == DATASET_DATA) { - indentation(indent); - end_obj(dump_header_format->subsettingend, dump_header_format->subsettingblockend); - indent -= COL; - } -} - -/*------------------------------------------------------------------------- - * Function: dump_oid - * - * Purpose: Prints the object ids - * - * Return: void - * - * Programmer: Patrick Lu - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -dump_oid(hid_t oid) -{ - indentation(indent + COL); - HDfprintf(stdout, "%s %s %d %s\n", OBJID, BEGIN, oid, END); -} - -/*------------------------------------------------------------------------- - * Function: dump_packed_bits - * - * Purpose: Prints the packed bits offset and length - * - * Return: void - * - *------------------------------------------------------------------------- - */ -static void -dump_packed_bits(unsigned int packed_index, hid_t type) -{ - int packed_bits_size = 0; - hid_t n_type = h5tools_get_native_type(type); - if(H5Tget_class(n_type)==H5T_INTEGER) { - if(H5Tequal(n_type, H5T_NATIVE_SCHAR) == TRUE) { - packed_bits_size = 8 * sizeof(char); - } - else if(H5Tequal(n_type, H5T_NATIVE_UCHAR) == TRUE) { - packed_bits_size = 8 * sizeof(unsigned char); - } - else if(H5Tequal(n_type, H5T_NATIVE_SHORT) == TRUE) { - packed_bits_size = 8 * sizeof(short); - } - else if(H5Tequal(n_type, H5T_NATIVE_USHORT) == TRUE) { - packed_bits_size = 8 * sizeof(unsigned short); - } - else if(H5Tequal(n_type, H5T_NATIVE_INT) == TRUE) { - packed_bits_size = 8 * sizeof(int); - } - else if(H5Tequal(n_type, H5T_NATIVE_UINT) == TRUE) { - packed_bits_size = 8 * sizeof(unsigned int); - } - else if(H5Tequal(n_type, H5T_NATIVE_LONG) == TRUE) { - packed_bits_size = 8 * sizeof(long); - } - else if(H5Tequal(n_type, H5T_NATIVE_ULONG) == TRUE) { - packed_bits_size = 8 * sizeof(unsigned long); - } - else if(H5Tequal(n_type, H5T_NATIVE_LLONG) == TRUE) { - packed_bits_size = 8 * sizeof(long long); - } - else if(H5Tequal(n_type, H5T_NATIVE_ULLONG) == TRUE) { - packed_bits_size = 8 * sizeof(unsigned long long); - } - else - error_msg("Packed Bit not valid for this datatype"); - } - indentation(indent + COL); - if ((packed_bits_size>0) && (packed_offset[packed_index] + packed_length[packed_index]) > packed_bits_size) { - error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n", - packed_offset[packed_index]+packed_length[packed_index], packed_bits_size); - packed_mask[packed_index] = 0; - }; - HDfprintf(stdout, "%s %s=%d %s=%d\n", PACKED_BITS, PACKED_OFFSET, packed_offset[packed_index], PACKED_LENGTH, packed_length[packed_index]); -} - -/*------------------------------------------------------------------------- - * Function: dump_comment - * - * Purpose: prints the comment for the the object name - * - * Return: void - * - * Programmer: pvn - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -dump_comment(hid_t obj_id) -{ - size_t buf_size = 0; - ssize_t cmt_bufsize = -1; - char* comment = NULL; - - cmt_bufsize = H5Oget_comment(obj_id, comment, buf_size); - - /* call H5Oget_comment again with the correct value. - * If the call to H5Oget_comment returned an error, skip this block */ - if (cmt_bufsize > 0) { - comment = (char *)HDmalloc((size_t)(cmt_bufsize+1)); /* new_size including null terminator */ - if(comment) { - cmt_bufsize = H5Oget_comment(obj_id, comment, cmt_bufsize); - if(cmt_bufsize > 0) { - comment[cmt_bufsize] = '\0'; /* necessary because null char is not returned */ - indentation(indent); - HDfprintf(stdout, "COMMENT \"%s\"\n", comment); - } /* end if */ - HDfree(comment); - } - } - -} /* end dump_comment() */ - - -/*------------------------------------------------------------------------- - * Function: dump_fill_value - * - * Purpose: prints the fill value - * - * Return: void - * - * Programmer: pvn - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id) -{ - h5tools_context_t ctx; /*print context */ - size_t size; - hid_t n_type; - hsize_t nelmts = 1; - void *buf=NULL; - h5tool_format_t *outputformat = &dataformat; - - memset(&ctx, 0, sizeof(ctx)); - ctx.indent_level=2; - - n_type = h5tools_get_native_type(type_id); - - size = H5Tget_size(n_type); - buf = malloc(size); - - H5Pget_fill_value(dcpl, n_type, buf); - - h5tools_dump_simple_data(stdout, outputformat, obj_id, &ctx, START_OF_DATA | END_OF_DATA, nelmts, n_type, buf); - - H5Tclose(n_type); - - if (buf) - free (buf); -} - - -/*------------------------------------------------------------------------- - * Function: dump_dcpl - * - * Purpose: prints several dataset create property list properties - * - * Return: void - * - * Programmer: pvn - * - * Modifications: pvn, March 28, 2008 - * Add a COMPRESSION ratio information for cases when filters are present - * - *------------------------------------------------------------------------- - */ -static void -dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) -{ - int nfilters; /* number of filters */ - unsigned filt_flags; /* filter flags */ - H5Z_filter_t filtn; /* filter identification number */ - unsigned cd_values[20]; /* filter client data values */ - size_t cd_nelmts; /* filter client number of values */ - char f_name[256]; /* filter name */ - unsigned szip_options_mask; - unsigned szip_pixels_per_block; - hsize_t chsize[64]; /* chunk size in elements */ - int rank; /* rank */ - char name[256]; /* external file name */ - off_t offset; /* offset of external file */ - hsize_t size; /* size of external file */ - H5D_fill_value_t fvstatus; - H5D_alloc_time_t at; - H5D_fill_time_t ft; - hsize_t storage_size; - haddr_t ioffset; - int i; - unsigned j; - - storage_size = H5Dget_storage_size(obj_id); - nfilters = H5Pget_nfilters(dcpl_id); - ioffset = H5Dget_offset(obj_id); - HDstrcpy(f_name,"\0"); - - /*------------------------------------------------------------------------- - * STORAGE_LAYOUT - *------------------------------------------------------------------------- - */ - indentation(indent + COL); - HDfprintf(stdout, "%s %s\n", STORAGE_LAYOUT, BEGIN); - - if (H5D_CHUNKED == H5Pget_layout(dcpl_id)) { - /*start indent */ - indent += COL; - indentation(indent + COL); - HDfprintf(stdout, "%s ", CHUNKED); - - rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize); - HDfprintf(stdout,"%s %Hu", dump_header_format->dataspacedimbegin, chsize[0]); - for ( i=1; idataspacedimend); - indentation(indent + COL); - - - /* if there are filters, print a compression ratio */ - if (nfilters) { - hsize_t dims[H5S_MAX_RANK]; - hsize_t nelmts = 1; - double ratio = 0; - int ok = 0; - - hid_t tid = H5Dget_type(obj_id); - hid_t sid = H5Dget_space( obj_id ); - size_t datum_size = H5Tget_size( tid ); - int ndims = H5Sget_simple_extent_dims( sid, dims, NULL); - - /* only print the compression ratio for these filters */ - for (i = 0; i < nfilters; i++) { - cd_nelmts = NELMTS(cd_values); - filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, - cd_values, sizeof(f_name), f_name, NULL); - - switch (filtn) { - case H5Z_FILTER_DEFLATE: - case H5Z_FILTER_SZIP: - case H5Z_FILTER_NBIT: - case H5Z_FILTER_SCALEOFFSET: - ok = 1; - break; - } - } - - if (ndims && ok) { - hsize_t uncomp_size; - - for (i = 0; i < ndims; i++) { - nelmts *= dims[i]; - } - uncomp_size = nelmts * datum_size; - - /* compression ratio = uncompressed size / compressed size */ - - if (storage_size != 0) - ratio = (double) uncomp_size / (double) storage_size; - - HDfprintf(stdout, "SIZE %Hu (%.3f:1 COMPRESSION)\n ", storage_size, ratio); - - } - else - HDfprintf(stdout, "SIZE %Hu\n ", storage_size); - - - H5Sclose(sid); - H5Tclose(tid); - - } - else { - HDfprintf(stdout, "SIZE %Hu\n ", storage_size); - } - - /*end indent */ - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n",END); - } - else if (H5D_COMPACT == H5Pget_layout(dcpl_id)) { - /*start indent */ - indent += COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n", COMPACT); - - indentation(indent + COL); - HDfprintf(stdout, "SIZE %Hu\n", storage_size); - - /*end indent */ - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n",END); - } - else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl_id)) { - int next; - - next = H5Pget_external_count(dcpl_id); - - /*------------------------------------------------------------------------- - * EXTERNAL_FILE - *------------------------------------------------------------------------- - */ - if (next) { - /*start indent */ - indent += COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n", CONTIGUOUS); - - indentation(indent + COL); - HDfprintf(stdout, "%s %s\n", EXTERNAL, BEGIN); - - /*start indent */ - indent += COL; - for ( j=0; j<(unsigned)next; j++) { - H5Pget_external(dcpl_id,j,sizeof(name),name,&offset,&size); - indentation(indent + COL); - HDfprintf(stdout,"FILENAME %s SIZE %Hu OFFSET %ld\n",name,size,offset); - } - /*end indent */ - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n",END); - - /*end indent */ - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n",END); - } - else { - /*start indent */ - indent += COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n", CONTIGUOUS); - - indentation(indent + COL); - HDfprintf(stdout,"SIZE %Hu\n", storage_size); - indentation(indent + COL); - HDfprintf(stdout,"OFFSET %Hu\n", ioffset); - - /*end indent */ - indent -= COL; - indentation(indent + COL); - HDfprintf(stdout, "%s\n",END); - } - } - /*------------------------------------------------------------------------- - * FILTERS - *------------------------------------------------------------------------- - */ - - - indentation(indent + COL); - HDfprintf(stdout, "%s %s\n", FILTERS, BEGIN); - indent += COL; - - if (nfilters) { - for (i=0; inobjs; u++) { - if (!type_table->objs[u].recorded) - HDfprintf(stdout, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno); - } - } - - /* print objects in the files */ - h5trav_print(fid); - - HDfprintf(stdout, " %s\n",END); -} - - -/*------------------------------------------------------------------------- - * Function: set_output_file - * - * Purpose: Open fname as the output file for dataset raw data. - * Set rawdatastream as its file stream. - * - * Return: 0 -- succeeded - * negative -- failed - * - * Programmer: Albert Cheng, 2000/09/30 - * - * Modifications: - * pvn June, 1, 2006. Add a switch for binary output - * - *------------------------------------------------------------------------- - */ -static int -set_output_file(const char *fname, int is_bin) -{ - FILE *f; /* temporary holding place for the stream pointer - * so that rawdatastream is changed only when succeeded */ - - if (rawdatastream && rawdatastream != stdout) { - if (fclose(rawdatastream)) - perror("closing rawdatastream"); - else - rawdatastream = NULL; - } - - /* binary output */ - if (is_bin) { - if ((f = fopen(fname, "wb")) != NULL) { - rawdatastream = f; - return 0; - } - } - else { - if ((f = fopen(fname, "w")) != NULL) { - rawdatastream = f; - return 0; - } - } - - return -1; -} - - - -/*------------------------------------------------------------------------- - * Function: set_binary_form - * - * Purpose: set the binary form of output by translating from a string input - * parameter to a integer return value - * - * Return: integer form of binary output or -1 if none found - * - * Programmer: Pedro Vicente Nunes - * June 28, 2006 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static int -set_binary_form(const char *form) -{ - int bform=-1; - - if (strcmp(form,"NATIVE") == 0 || strcmp(form,"MEMORY") == 0) { - /* native form */ - bform = 0; - } - else if (strcmp(form,"FILE")==0) /* file type form */ - bform = 1; - else if (strcmp(form,"LE")==0) /* convert to little endian */ - bform = 2; - else if (strcmp(form,"BE")==0) /* convert to big endian */ - bform = 3; - - return bform; -} - -/*------------------------------------------------------------------------- - * Function: set_sort_by - * - * Purpose: set the "by" form of sorting by translating from a string input - * parameter to a H5_index_t return value - * current sort values are [creation_order | name] - * - * Return: H5_index_t form of sort or H5_INDEX_UNKNOWN if none found - * - * Programmer: Pedro Vicente Nunes - * October 1, 2007 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static H5_index_t -set_sort_by(const char *form) -{ - H5_index_t idx_type = H5_INDEX_UNKNOWN; - - if (strcmp(form,"name")==0) /* H5_INDEX_NAME */ - idx_type = H5_INDEX_NAME; - else if (strcmp(form,"creation_order")==0) /* H5_INDEX_CRT_ORDER */ - idx_type = H5_INDEX_CRT_ORDER; - - return idx_type; -} - - - -/*------------------------------------------------------------------------- - * Function: set_sort_order - * - * Purpose: set the order of sorting by translating from a string input - * parameter to a H5_iter_order_t return value - * current order values are [ascending | descending ] - * - * Return: H5_iter_order_t form of order or H5_ITER_UNKNOWN if none found - * - * Programmer: Pedro Vicente Nunes - * October 1, 2007 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static H5_iter_order_t -set_sort_order(const char *form) -{ - H5_iter_order_t iter_order = H5_ITER_UNKNOWN; - - if (strcmp(form,"ascending")==0) /* H5_ITER_INC */ - iter_order = H5_ITER_INC; - else if (strcmp(form,"descending")==0) /* H5_ITER_DEC */ - iter_order = H5_ITER_DEC; - - return iter_order; -} - - -/*------------------------------------------------------------------------- - * Function: handle_attributes - * - * Purpose: Handle the attributes from the command. - * - * Return: void - * - * Programmer: Bill Wendling - * Tuesday, 9. January 2001 - * - * Modifications: - * - * PVN, May 2008 - * add an extra parameter PE, to allow printing/not printing of error messages - * - *------------------------------------------------------------------------- - */ -static void -handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe, const char UNUSED *display_name) -{ - dump_selected_attr(fid, attr); -} - -/*------------------------------------------------------------------------- - * Function: parse_hsize_list - * - * Purpose: Parse a list of comma or space separated integers and return - * them in a list. The string being passed into this function - * should be at the start of the list you want to parse. You are - * responsible for freeing the array returned from here. - * - * Lists in the so-called "terse" syntax are separated by - * semicolons (;). The lists themselves can be separated by - * either commas (,) or white spaces. - * - * Return: - * - * Programmer: Bill Wendling - * Tuesday, 6. February 2001 - * - *------------------------------------------------------------------------- - */ -static void -parse_hsize_list(const char *h_list, subset_d *d) -{ - hsize_t *p_list; - const char *ptr; - unsigned int size_count = 0; - unsigned int i = 0; - unsigned int last_digit = 0; - - if (!h_list || !*h_list || *h_list == ';') - return; - - /* count how many integers do we have */ - for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) - if (isdigit(*ptr)) { - if (!last_digit) - /* the last read character wasn't a digit */ - size_count++; - - last_digit = 1; - } - else { - last_digit = 0; - } - - if (size_count == 0) - /* there aren't any integers to read */ - return; - - /* allocate an array for the integers in the list */ - p_list = (hsize_t *)calloc(size_count, sizeof(hsize_t)); - - for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) - if(isdigit(*ptr)) { - /* we should have an integer now */ - p_list[i++] = (hsize_t)atof(ptr); - - while (isdigit(*ptr)) - /* scroll to end of integer */ - ptr++; - } - d->data = p_list; - d->len = size_count; - - return; -} - -/*------------------------------------------------------------------------- - * Function: parse_subset_params - * - * Purpose: Parse the so-called "terse" syntax for specifying subsetting - * parameters. - * - * Return: Success: struct subset_t object - * Failure: NULL - * - * Programmer: Bill Wendling - * Tuesday, 6. February 2001 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static struct subset_t * -parse_subset_params(char *dset) -{ - struct subset_t *s = NULL; - register char *brace; - - if ((brace = strrchr(dset, '[')) != NULL) { - char *slash = strrchr(dset, '/'); - - /* sanity check to make sure the [ isn't part of the dataset name */ - if (brace > slash) { - *brace++ = '\0'; - - s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); - parse_hsize_list(brace, &s->start); - - while (*brace && *brace != ';') - brace++; - - if (*brace) brace++; - - parse_hsize_list(brace, &s->stride); - - while (*brace && *brace != ';') - brace++; - - if (*brace) brace++; - - parse_hsize_list(brace, &s->count); - - while (*brace && *brace != ';') - brace++; - - if (*brace) brace++; - - parse_hsize_list(brace, &s->block); - } - } - - return s; -} - -/*------------------------------------------------------------------------- - * Function: parse_mask_list - * - * Purpose: Parse a list of comma or space separated integers and fill - * the packed_bits list and counter. The string being passed into this function - * should be at the start of the list you want to parse. - * - * Return: Success: SUCCEED - * - * Failure: FAIL - * - * - *------------------------------------------------------------------------- - */ -static int -parse_mask_list(const char *h_list) -{ - int offset_value; - int length_value; - unsigned long long temp_mask; - const char *ptr = NULL; - - /* sanity check */ - HDassert(h_list); - - HDmemset(packed_mask,0,sizeof(packed_mask)); - - packed_bits_num = 0; - /* scan in pair of offset,length separated by commas. */ - ptr = h_list; - while (*ptr) { - /* scan for an offset which is an unsigned int */ - if (!HDisdigit(*ptr)){ - error_msg("Bad mask list(%s)\n", h_list); - return FAIL; - } - offset_value = HDatoi(ptr); - if (offset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX){ - error_msg("Packed Bit offset value(%d) must be between 0 and %d\n", - offset_value, PACKED_BITS_SIZE_MAX - 1); - return FAIL; - } - - /* skip to end of integer */ - while (HDisdigit(*++ptr)) - ; - /* Look for the common separator */ - if (*ptr++ != ',') { - error_msg("Bad mask list(%s), missing expected comma separator.\n", h_list); - return FAIL; - } - - /* scan for a length which is a positive int */ - if (!HDisdigit(*ptr)){ - error_msg("Bad mask list(%s)\n", h_list); - return FAIL; - } - length_value = HDatoi(ptr); - if (length_value <= 0){ - error_msg("Packed Bit length value(%d) must be positive.\n", length_value); - return FAIL; - } - if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX){ - error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n", - offset_value+length_value, PACKED_BITS_SIZE_MAX); - return FAIL; - } - - /* skip to end of int */ - while (HDisdigit(*++ptr)) - ; - - /* store the offset,length pair */ - if (packed_bits_num >= PACKED_BITS_MAX){ - /* too many requests */ - error_msg("Too many masks requested (max. %d). Mask list(%s)\n", PACKED_BITS_MAX, h_list); - return FAIL; - } - packed_offset[packed_bits_num] = offset_value; - packed_length[packed_bits_num] = length_value; - /* create the bit mask by left shift 1's by length, then negate it. */ - /* After packed_mask is calculated, packed_length is not needed but */ - /* keep it for debug purpose. */ - temp_mask = ~0L; - if(length_value<8*sizeof(unsigned long long)) { - temp_mask = temp_mask << length_value; - packed_mask[packed_bits_num] = ~temp_mask; - } - else - packed_mask[packed_bits_num] = temp_mask; - packed_bits_num++; - - /* skip a possible comma separator */ - if (*ptr == ','){ - if (!(*++ptr)){ - /* unexpected end of string */ - error_msg("Bad mask list(%s), unexpected end of string.\n", h_list); - return FAIL; - } - } - } - HDassert(packed_bits_num <= PACKED_BITS_MAX); - if (packed_bits_num == 0){ - /* got no masks! */ - error_msg("Bad mask list(%s)\n", h_list); - return FAIL; - } - return SUCCEED; -} - -/*------------------------------------------------------------------------- - * Function: handle_datasets - * - * Purpose: Handle the datasets from the command. - * - * Return: void - * - * Programmer: Bill Wendling - * Tuesday, 9. January 2001 - * - * Modifications: - * Pedro Vicente, Tuesday, January 15, 2008 - * check for block overlap\ - * - * Pedro Vicente, May 8, 2008 - * added a flag PE that prints/not prints error messages - * added for cases of external links not found, to avoid printing of - * objects not found, since external links are dumped on a trial error basis - * - *------------------------------------------------------------------------- - */ -static void -handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name) -{ - H5O_info_t oinfo; - hid_t dsetid; - struct subset_t *sset = (struct subset_t *)data; - const char *real_name = display_name ? display_name : dset; - - if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) { - if (pe) { - begin_obj(dump_header_format->datasetbegin, real_name, dump_header_format->datasetblockbegin); - indentation(COL); - error_msg("unable to open dataset \"%s\"\n", real_name); - end_obj(dump_header_format->datasetend, dump_header_format->datasetblockend); - h5tools_setstatus(EXIT_FAILURE); - } - return; - } /* end if */ - - if(sset) { - unsigned int i; - hid_t sid = H5Dget_space(dsetid); - int ndims = H5Sget_simple_extent_ndims(sid); - - H5Sclose(sid); - if(ndims < 0) { - error_msg("H5Sget_simple_extent_ndims failed\n"); - h5tools_setstatus(EXIT_FAILURE); - return; - } - - if(!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) { - /* they didn't specify a ``stride'' or ``block''. default to 1 in all - * dimensions */ - if(!sset->start.data) { - /* default to (0, 0, ...) for the start coord */ - sset->start.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); - sset->start.len = ndims; - } - - if(!sset->stride.data) { - sset->stride.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); - sset->stride.len = ndims; - for (i = 0; i < ndims; i++) - sset->stride.data[i] = 1; - } - - if(!sset->count.data) { - sset->count.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); - sset->count.len = ndims; - for (i = 0; i < ndims; i++) - sset->count.data[i] = 1; - } - - if(!sset->block.data) { - sset->block.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); - sset->block.len = ndims; - for (i = 0; i < ndims; i++) - sset->block.data[i] = 1; - } - } - - /*------------------------------------------------------------------------- - * check for dimension overflow - *------------------------------------------------------------------------- - */ - if(sset->start.len > ndims) { - error_msg("number of start dims (%u) exceed dataset dims (%u)\n", sset->start.len, ndims); - h5tools_setstatus(EXIT_FAILURE); - return; - } - if(sset->stride.len > ndims) { - error_msg("number of stride dims (%u) exceed dataset dims (%u)\n", sset->stride.len, ndims); - h5tools_setstatus(EXIT_FAILURE); - return; - } - if(sset->count.len > ndims) { - error_msg("number of count dims (%u) exceed dataset dims (%u)\n", sset->count.len, ndims); - h5tools_setstatus(EXIT_FAILURE); - return; - } - if(sset->block.len > ndims) { - error_msg("number of block dims (%u) exceed dataset dims (%u)\n", sset->block.len, ndims); - h5tools_setstatus(EXIT_FAILURE); - return; - } - - /*------------------------------------------------------------------------- - * check for block overlap - *------------------------------------------------------------------------- - */ - for(i = 0; i < ndims; i++) { - if(sset->count.data[i] > 1) { - if(sset->stride.data[i] < sset->block.data[i]) { - error_msg("wrong subset selection; blocks overlap\n"); - h5tools_setstatus(EXIT_FAILURE); - return; - } /* end if */ - } /* end if */ - } /* end for */ - } /* end if */ - - - H5Oget_info(dsetid, &oinfo); - if(oinfo.rc > 1 || hit_elink) { - obj_t *found_obj; /* Found object */ - - found_obj = search_obj(dset_table, oinfo.addr); - - if(found_obj) { - if (found_obj->displayed) { - indentation(indent); - begin_obj(dump_header_format->datasetbegin, real_name, dump_header_format->datasetblockbegin); - indentation(indent + COL); - HDfprintf(stdout, "%s \"%s\"\n", HARDLINK, found_obj->objname); - indentation(indent); - end_obj(dump_header_format->datasetend, dump_header_format->datasetblockend); - } - else { - found_obj->displayed = TRUE; - dump_dataset(dsetid, real_name, sset); - } - } - else - h5tools_setstatus(EXIT_FAILURE); - } - else - dump_dataset(dsetid, real_name, sset); - - if(H5Dclose(dsetid) < 0) - h5tools_setstatus(EXIT_FAILURE); -} - -/*------------------------------------------------------------------------- - * Function: handle_groups - * - * Purpose: Handle the groups from the command. - * - * Return: void - * - * Programmer: Bill Wendling - * Tuesday, 9. January 2001 - * - * Modifications: Pedro Vicente, September 26, 2007 - * handle creation order - * - * Pedro Vicente, May 8, 2008 - * added a flag PE that prints/not prints error messages - * added for cases of external links not found, to avoid printing of - * objects not found, since external links are dumped on a trial error basis - * - *------------------------------------------------------------------------- - */ -static void -handle_groups(hid_t fid, const char *group, void UNUSED * data, int pe, const char * display_name) -{ - hid_t gid; - const char *real_name = display_name ? display_name : group; - - if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) { - if (pe) { - begin_obj(dump_header_format->groupbegin, real_name, dump_header_format->groupblockbegin); - indentation(COL); - error_msg("unable to open group \"%s\"\n", real_name); - end_obj(dump_header_format->groupend, dump_header_format->groupblockend); - h5tools_setstatus(EXIT_FAILURE); - } - } - else { - size_t new_len = HDstrlen(group) + 1; - - if(prefix_len <= new_len) { - prefix_len = new_len; - prefix = (char *)HDrealloc(prefix, prefix_len); - } /* end if */ - - HDstrcpy(prefix, group); - - dump_group(gid, real_name); - - if(H5Gclose(gid) < 0) - h5tools_setstatus(EXIT_FAILURE); - } /* end else */ -} /* end handle_groups() */ - -/*------------------------------------------------------------------------- - * Function: handle_links - * - * Purpose: Handle soft or UD links from the command. - * - * Return: void - * - * Programmer: Bill Wendling - * Tuesday, 9. January 2001 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, const char UNUSED *display_name) -{ - H5L_info_t linfo; - - if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) { - error_msg("unable to get link info from \"%s\"\n", links); - h5tools_setstatus(EXIT_FAILURE); - } - else if(linfo.type == H5L_TYPE_HARD) { - error_msg("\"%s\" is a hard link\n", links); - h5tools_setstatus(EXIT_FAILURE); - } - else { - char *buf = (char *)HDmalloc(linfo.u.val_size); - - switch(linfo.type) { - case H5L_TYPE_SOFT: /* Soft link */ - begin_obj(dump_header_format->softlinkbegin, links, dump_header_format->softlinkblockbegin); - indentation(COL); - if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) - HDfprintf(stdout, "LINKTARGET \"%s\"\n", buf); - else { - error_msg("h5dump error: unable to get link value for \"%s\"\n", links); - h5tools_setstatus(EXIT_FAILURE); - } - end_obj(dump_header_format->softlinkend, dump_header_format->softlinkblockend); - break; - - case H5L_TYPE_EXTERNAL: - begin_obj(dump_header_format->udlinkbegin, links, dump_header_format->udlinkblockbegin); - indentation(COL); - begin_obj(dump_header_format->extlinkbegin, links, dump_header_format->extlinkblockbegin); - if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) { - const char *elink_file; - const char *elink_path; - - if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path)>=0) { - indentation(COL); - HDfprintf(stdout, "LINKCLASS %d\n", linfo.type); - indentation(COL); - HDfprintf(stdout, "TARGETFILE \"%s\"\n", elink_file); - indentation(COL); - HDfprintf(stdout, "TARGETPATH \"%s\"\n", elink_path); - } - else { - error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links); - h5tools_setstatus(EXIT_FAILURE); - } - } - else { - error_msg("h5dump error: unable to get external link value for \"%s\"\n", links); - h5tools_setstatus(EXIT_FAILURE); - } - end_obj(dump_header_format->extlinkend, dump_header_format->extlinkblockend); - break; - - default: - begin_obj(dump_header_format->udlinkbegin, links, dump_header_format->udlinkblockbegin); - indentation(COL); - begin_obj(dump_header_format->udlinkbegin, links, dump_header_format->udlinkblockbegin); - indentation(COL); - HDfprintf(stdout, "LINKCLASS %d\n", linfo.type); - end_obj(dump_header_format->udlinkend, dump_header_format->udlinkblockend); - break; - } /* end switch */ - HDfree(buf); - } /* end else */ -} - -/*------------------------------------------------------------------------- - * Function: handle_datatypes - * - * Purpose: Handle the datatypes from the command. - * - * Return: void - * - * Programmer: Bill Wendling - * Tuesday, 9. January 2001 - * - * Modifications: - * - * Pedro Vicente, May 8, 2008 - * added a flag PE that prints/not prints error messages - * added for cases of external links not found, to avoid printing of - * objects not found, since external links are dumped on a trial error basis - * - *------------------------------------------------------------------------- - */ -static void -handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe, const char *display_name) -{ - hid_t type_id; - const char *real_name = display_name ? display_name : type; - - if((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) { - /* check if type is unamed datatype */ - unsigned idx = 0; - - while(idx < type_table->nobjs ) { - char name[128]; - - if(!type_table->objs[idx].recorded) { - /* unamed datatype */ - sprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno); - - if(!HDstrcmp(name, real_name)) - break; - } /* end if */ - - idx++; - } /* end while */ - - if(idx == type_table->nobjs) { - if (pe) { - /* unknown type */ - begin_obj(dump_header_format->datatypebegin, real_name, dump_header_format->datatypeblockbegin); - indentation(COL); - error_msg("unable to open datatype \"%s\"\n", real_name); - end_obj(dump_header_format->datatypeend, dump_header_format->datatypeblockend); - h5tools_setstatus(EXIT_FAILURE); - } - } - else { - hid_t dsetid = H5Dopen2(fid, type_table->objs[idx].objname, H5P_DEFAULT); - type_id = H5Dget_type(dsetid); - dump_named_datatype(type_id, real_name); - H5Tclose(type_id); - H5Dclose(dsetid); - } - } - else { - dump_named_datatype(type_id, real_name); - - if(H5Tclose(type_id) < 0) - h5tools_setstatus(EXIT_FAILURE); - } -} - - -/*------------------------------------------------------------------------- - * Function: free_handler - * - * Purpose: Convenience function to free the handler_t structures. Needs a - * length variable (LEN) to know how many in the array it needs - * to free - * - * Return: Nothing - * - * Programmer: Bill Wendling - * Tuesday, 20. February 2001 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -free_handler(struct handler_t *hand, int len) -{ - register int i; - - if(hand) { - for (i = 0; i < len; i++) { - if(hand[i].obj) { - free(hand[i].obj); - hand[i].obj=NULL; - } - - if (hand[i].subset_info) { - if(hand[i].subset_info->start.data) - free(hand[i].subset_info->start.data); - if(hand[i].subset_info->stride.data) - free(hand[i].subset_info->stride.data); - if(hand[i].subset_info->count.data) - free(hand[i].subset_info->count.data); - if(hand[i].subset_info->block.data) - free(hand[i].subset_info->block.data); - - free(hand[i].subset_info); - hand[i].subset_info=NULL; - } - } - - free(hand); - } -} - - -/*------------------------------------------------------------------------- - * Function: parse_command_line - * - * Purpose: Parse the command line for the h5dumper. - * - * Return: Success: A pointer to an array of handler_t structures. - * These contain all the information needed to dump - * the necessary object. - * - * Failure: Exits program with EXIT_FAILURE value. - * - * Programmer: Bill Wendling - * Tuesday, 20. February 2001 - * - * Modifications: - * pvn June, 1, 2006. Add a switch for binary output - * - *------------------------------------------------------------------------- - */ -static struct handler_t * -parse_command_line(int argc, const char *argv[]) -{ - struct handler_t *hand = NULL; - struct handler_t *last_dset = NULL; - int i; - int opt; - int last_was_dset = FALSE; - - /* no arguments */ - if (argc == 1) { - usage(h5tools_getprogname()); - goto error; - } - - /* this will be plenty big enough to hold the info */ - if((hand = (struct handler_t *)calloc((size_t)argc, sizeof(struct handler_t)))==NULL) { - goto error; - } - - /* parse command line options */ - while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { - parse_start: - switch ((char)opt) { - case 'R': - display_region = TRUE; - region_output = TRUE; - break; - case 'B': - display_bb = TRUE; - last_was_dset = FALSE; - break; - case 'n': - display_fi = TRUE; - last_was_dset = FALSE; - break; - case 'p': - display_dcpl = TRUE; - break; - case 'y': - display_ai = FALSE; - break; - case 'e': - display_escape = TRUE; - break; - case 'H': - display_data = FALSE; - display_attr_data = FALSE; - last_was_dset = FALSE; - break; - case 'A': - display_data = FALSE; - display_attr_data = TRUE; - last_was_dset = FALSE; - break; - case 'i': - display_oid = TRUE; - last_was_dset = FALSE; - break; - case 'r': - display_char = TRUE; - break; - case 'V': - print_version(h5tools_getprogname()); - free_handler(hand, argc); - hand = NULL; - h5tools_setstatus(EXIT_SUCCESS); - goto done; - break; - case 'w': - nCols = HDatoi(opt_arg); - last_was_dset = FALSE; - break; - case 'a': - display_all = 0; - - for (i = 0; i < argc; i++) - if (!hand[i].func) { - hand[i].func = handle_attributes; - hand[i].obj = HDstrdup(opt_arg); - break; - } - - last_was_dset = FALSE; - break; - case 'd': - display_all = 0; - - for (i = 0; i < argc; i++) - if (!hand[i].func) { - hand[i].func = handle_datasets; - hand[i].obj = HDstrdup(opt_arg); - hand[i].subset_info = parse_subset_params(hand[i].obj); - last_dset = &hand[i]; - break; - } - - last_was_dset = TRUE; - break; - case 'f': - driver = opt_arg; - break; - case 'g': - display_all = 0; - - for (i = 0; i < argc; i++) - if (!hand[i].func) { - hand[i].func = handle_groups; - hand[i].obj = HDstrdup(opt_arg); - break; - } - - last_was_dset = FALSE; - break; - case 'l': - display_all = 0; - - for (i = 0; i < argc; i++) - if (!hand[i].func) { - hand[i].func = handle_links; - hand[i].obj = HDstrdup(opt_arg); - break; - } - - last_was_dset = FALSE; - break; - case 't': - display_all = 0; - - for (i = 0; i < argc; i++) - if (!hand[i].func) { - hand[i].func = handle_datatypes; - hand[i].obj = HDstrdup(opt_arg); - break; - } - - last_was_dset = FALSE; - break; - - case 'o': - if ( bin_output ) { - if (set_output_file(opt_arg, 1) < 0) { - usage(h5tools_getprogname()); - goto error; - } - } - else { - if (set_output_file(opt_arg, 0) < 0) { - usage(h5tools_getprogname()); - goto error; - } - } - - usingdasho = TRUE; - last_was_dset = FALSE; - outfname = opt_arg; - break; - - case 'b': - if ( opt_arg != NULL) { - if ( ( bin_form = set_binary_form(opt_arg)) < 0) { - /* failed to set binary form */ - usage(h5tools_getprogname()); - goto error; - } - } - bin_output = TRUE; - if (outfname!=NULL) { - if (set_output_file(outfname, 1) < 0) { - /* failed to set output file */ - usage(h5tools_getprogname()); - goto error; - } - - last_was_dset = FALSE; - } - break; - - case 'q': - if ( ( sort_by = set_sort_by(opt_arg)) < 0) { - /* failed to set "sort by" form */ - usage(h5tools_getprogname()); - goto error; - } - break; - - case 'z': - if ( ( sort_order = set_sort_order(opt_arg)) < 0) { - /* failed to set "sort order" form */ - usage(h5tools_getprogname()); - goto error; - } - break; - - case 'M': - if (!last_was_dset) { - error_msg("option `-%c' can only be used after --dataset option\n", opt); - goto error; - } - if (parse_mask_list(opt_arg) != SUCCEED){ - usage(h5tools_getprogname()); - goto error; - } - display_packed_bits = TRUE; - break; - - /** begin XML parameters **/ - case 'x': - /* select XML output */ - doxml = TRUE; - useschema = TRUE; - dump_header_format = NULL; - dump_function_table = &xml_function_table; - break; - case 'u': - doxml = TRUE; - useschema = FALSE; - xmlnsprefix = ""; - dump_header_format = NULL; - dump_function_table = &xml_function_table; - break; - case 'D': - /* specify alternative XML DTD or schema */ - /* To Do: check format of this value? */ - xml_dtd_uri = opt_arg; - break; - - case 'm': - /* specify alternative floating point printing format */ - fp_format = opt_arg; - break; - - case 'X': - /* specify XML namespace (default="hdf5:"), or none */ - /* To Do: check format of this value? */ - if (!useschema) { - usage(h5tools_getprogname()); - goto error; - } - if (strcmp(opt_arg,":") == 0) { - xmlnsprefix = ""; - } - else { - xmlnsprefix = opt_arg; - } - break; - /** end XML parameters **/ - - /** begin subsetting parameters **/ - case 's': - case 'S': - case 'c': - case 'k': { - struct subset_t *s; - - if (!last_was_dset) { - error_msg("option `-%c' can only be used after --dataset option\n", opt); - goto error; - } - - if (last_dset->subset_info) { - /* - * This overrides the "terse" syntax if they actually mixed - * the two. - */ - s = last_dset->subset_info; - } - else { - last_dset->subset_info = s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); - } - - /* - * slightly convoluted, but...we are only interested in options - * for subsetting: "--start", "--stride", "--count", and "--block" - * which can come in any order. If we run out of parameters (EOF) - * or run into one which isn't a subsetting parameter (NOT s, S, - * c, or K), then we exit the do-while look, set the subset_info - * to the structure we've been filling. If we've reached the end - * of the options, we exit the parsing (goto parse_end) otherwise, - * since we've "read" the next option, we need to parse it. So we - * jump to the beginning of the switch statement (goto parse_start). - */ - do { - switch ((char)opt) { - case 's': - if (s->start.data) { - free(s->start.data); - s->start.data = NULL; - } - parse_hsize_list(opt_arg, &s->start); - break; - case 'S': - if (s->stride.data) { - free(s->stride.data); - s->stride.data = NULL; - } - parse_hsize_list(opt_arg, &s->stride); - break; - case 'c': - if (s->count.data) { - free(s->count.data); - s->count.data = NULL; - } - parse_hsize_list(opt_arg, &s->count); - break; - case 'k': - if (s->block.data) { - free(s->block.data); - s->block.data = NULL; - } - parse_hsize_list(opt_arg, &s->block); - break; - default: - goto end_collect; - } - } while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF); - - end_collect: - last_was_dset = FALSE; - - if (opt != EOF) - goto parse_start; - else - goto parse_end; - } - /** end subsetting parameters **/ - - case 'E': - enable_error_stack = TRUE; - break; - case 'h': - usage(h5tools_getprogname()); - free_handler(hand, argc); - hand = NULL; - h5tools_setstatus(EXIT_SUCCESS); - goto done; - case '?': - default: - usage(h5tools_getprogname()); - goto error; - } - } - - parse_end: - /* check for file name to be processed */ - if (argc <= opt_ind) { - error_msg("missing file name\n"); - usage(h5tools_getprogname()); - goto error; - } - done: - return hand; - - error: - if (hand) { - free_handler(hand, argc); - hand = NULL; - } - h5tools_setstatus(EXIT_FAILURE); - - return hand; -} - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: HDF5 dumper - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Ruey-Hsia Li - * - * Modifications: - * Albert Cheng - * 30. September 2000 - * Add the -o option--output file for datasets raw data - * - * REMcG - * November 2000 - * Changes to support XML. - * - * Bill Wendling - * Wednesday, 10. January 2001 - * Modified the way command line parameters are interpreted. They go - * through one function call now (get_option). - * - * Bill Wendling - * Tuesday, 20. February 2001 - * Moved command line parsing to separate function. Made various - * "display_*" flags global. - * - * REMcG - * August 2003 - * Major upgrade to XML support. - * - * Pedro Vicente - * September 2007 - * list objects in requested order (creation order or alphabetically) - * - *------------------------------------------------------------------------- - */ -int -main(int argc, const char *argv[]) -{ - hid_t fid = -1; - hid_t gid = -1; - H5E_auto2_t func; - H5O_info_t oi; - struct handler_t *hand; - int i; - unsigned u; - void *edata; - char *fname = NULL; - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - dump_header_format = &standardformat; - dump_function_table = &ddl_function_table; - - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - /* Initialize h5tools lib */ - h5tools_init(); - if((hand = parse_command_line(argc, argv))==NULL) { - goto done; - } - - if (bin_output && outfname == NULL) { - error_msg("binary output requires a file name, use -o \n"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - - if (enable_error_stack) - H5Eset_auto2(H5E_DEFAULT, func, edata); - - /* Check for conflicting options */ - if (doxml) { - if (!display_all) { - error_msg("option \"%s\" not available for XML\n", - "to display selected objects"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - else if (display_bb) { - error_msg("option \"%s\" not available for XML\n", "--boot-block"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - else if (display_oid == 1) { - error_msg("option \"%s\" not available for XML\n", "--object-ids"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - else if (display_char == TRUE) { - error_msg("option \"%s\" not available for XML\n", "--string"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - else if (usingdasho) { - error_msg("option \"%s\" not available for XML\n", "--output"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - } - else { - if (xml_dtd_uri) { - warn_msg("option \"%s\" only applies with XML: %s\n", "--xml-dtd", xml_dtd_uri); - } - } - - if (argc <= opt_ind) { - error_msg("missing file name\n"); - usage(h5tools_getprogname()); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - fname = HDstrdup(argv[opt_ind]); - - fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0); - - if (fid < 0) { - error_msg("unable to open file \"%s\"\n", fname); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - - /* allocate and initialize internal data structure */ - init_prefix(&prefix, prefix_len); - - /* Prepare to find objects that might be targets of a reference */ - fill_ref_path_table(fid); - - if(doxml) { - /* initialize XML */ - - /* reset prefix! */ - HDstrcpy(prefix, ""); - - /* make sure the URI is initialized to something */ - if (xml_dtd_uri == NULL) { - if (useschema) { - xml_dtd_uri = DEFAULT_XSD; - } - else { - xml_dtd_uri = DEFAULT_DTD; - xmlnsprefix = ""; - } - } - else { - if (useschema && strcmp(xmlnsprefix,"")) { - error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - } - } - - - /* Get object info for root group */ - if(H5Oget_info_by_name(fid, "/", &oi, H5P_DEFAULT) < 0) { - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - - /* Initialize object tables */ - if(table_list_add(fid, oi.fileno) < 0) { - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - group_table = table_list.tables[0].group_table; - dset_table = table_list.tables[0].dset_table; - type_table = table_list.tables[0].type_table; - - /* does there exist unamed committed datatype */ - for (u = 0; u < type_table->nobjs; u++) - if (!type_table->objs[u].recorded) { - unamedtype = 1; - break; - } /* end if */ - - /* start to dump - display file header information */ - if (!doxml) { - begin_obj(dump_header_format->filebegin, fname, dump_header_format->fileblockbegin); - } - else { - HDfprintf(stdout, "\n"); - - /* alternative first element, depending on schema or DTD. */ - if (useschema) { - if (strcmp(xmlnsprefix,"") == 0) { - HDfprintf(stdout, "\n", - xml_dtd_uri); - } - else { - /* TO DO: make -url option work in this case (may need new option) */ - char * ns; - char *indx; - - ns = HDstrdup(xmlnsprefix); - indx = strrchr(ns,(int)':'); - if (indx) *indx = '\0'; - - HDfprintf(stdout, "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File\" " - "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " - "xsi:schemaLocation=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File " - "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",xmlnsprefix,ns); - HDfree(ns); - } - } - else { - HDfprintf(stdout, "\n", xml_dtd_uri); - HDfprintf(stdout, "\n"); - } - } - - if (!doxml) { - if (display_fi) { - dump_fcontents(fid); - end_obj(dump_header_format->fileend,dump_header_format->fileblockend); - goto done; - } - - if (display_bb) - dump_fcpl(fid); - } - - if (display_all) { - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) - { - error_msg("unable to open root group\n"); - h5tools_setstatus(EXIT_FAILURE); - } - else { - - dump_function_table->dump_group_function(gid, "/" ); - - } - - if (H5Gclose(gid) < 0) { - error_msg("unable to close root group\n"); - h5tools_setstatus(EXIT_FAILURE); - } - - - } - else { - /* Note: this option is not supported for XML */ - if(doxml) { - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } /* end if */ - - for(i = 0; i < argc; i++) - if(hand[i].func) - hand[i].func(fid, hand[i].obj, hand[i].subset_info, 1, NULL); - } - - if (!doxml) { - end_obj(dump_header_format->fileend, dump_header_format->fileblockend); - } - else { - HDfprintf(stdout, "\n", xmlnsprefix); - } - - done: - /* Free tables for objects */ - table_list_free(); - - if(hand) - free_handler(hand, argc); - - if(fid >=0) - if (H5Fclose(fid) < 0) - h5tools_setstatus(EXIT_FAILURE); - - if(prefix) - HDfree(prefix); - if(fname) - HDfree(fname); - - /* To Do: clean up XML table */ - - H5Eset_auto2(H5E_DEFAULT, func, edata); - - leave(h5tools_getstatus()); -} - -/*------------------------------------------------------------------------- - * Function: print_enum - * - * Purpose: prints the enum data - * - * Return: void - * - * Programmer: Patrick Lu - * - * Modifications: - * - * NOTE: this function was taken from h5ls. should be moved into the toolslib - * - *-----------------------------------------------------------------------*/ -static void -print_enum(hid_t type) -{ - char **name = NULL; /*member names */ - unsigned char *value = NULL; /*value array */ - unsigned char *copy = NULL; /*a pointer to value array */ - unsigned nmembs; /*number of members */ - int nchars; /*number of output characters */ - hid_t super; /*enum base integer type */ - hid_t native = -1; /*native integer datatype */ - size_t dst_size; /*destination value type size */ - unsigned i; - - nmembs = (unsigned)H5Tget_nmembers(type); - super = H5Tget_super(type); - - /* - * Determine what datatype to use for the native values. To simplify - * things we entertain three possibilities: - * 1. long long -- the largest native signed integer - * 2. unsigned long long -- the largest native unsigned integer - * 3. raw format - */ - if(H5Tget_size(type) <= sizeof(long long)) { - dst_size = sizeof(long long); - - if(H5T_SGN_NONE == H5Tget_sign(type)) - native = H5T_NATIVE_ULLONG; - else - native = H5T_NATIVE_LLONG; - } /* end if */ - else - dst_size = H5Tget_size(type); - - /* Get the names and raw values of all members */ - name = (char **)calloc(nmembs, sizeof(char *)); - value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size)); - - for (i = 0; i < nmembs; i++) { - name[i] = H5Tget_member_name(type, i); - H5Tget_member_value(type, i, value + i * H5Tget_size(type)); - } - - /* Convert values to native datatype */ - if (native > 0) - H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT); - - /* - * Sort members by increasing value - * ***not implemented yet*** - */ - - /* Print members */ - for (i = 0; i < nmembs; i++) { - indentation(indent + COL); - nchars = HDfprintf(stdout, "\"%s\"", name[i]); - HDfprintf(stdout, "%*s ", MAX(0, 16 - nchars), ""); - - if (native < 0) { - size_t j; - - HDfprintf(stdout, "0x"); - - for (j = 0; j < dst_size; j++) - HDfprintf(stdout, "%02x", value[i * dst_size + j]); - } - else if (H5T_SGN_NONE == H5Tget_sign(native)) { - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value+i*dst_size; - HDfprintf(stdout, "%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *) ((void *) copy))); - } - else { - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value+i*dst_size; - HDfprintf(stdout, "%" H5_PRINTF_LL_WIDTH "d", *((long long *) ((void *) copy))); - } - - HDfprintf(stdout, ";\n"); - } - - /* Release resources */ - for (i = 0; i < nmembs; i++) - free(name[i]); - - free(name); - free(value); - H5Tclose(super); - - if (0 == nmembs) - HDfprintf(stdout, "\n%*s ", indent + 4, ""); -} - - -/* - * create a string suitable for and XML NCNAME. Uses the - * object reference to create the string. - * - * 'gen'; 0 - return null if not found - * 1 - generate a fake entry and return fake id. - */ - -int -xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) -{ - haddr_t objno; /* Object ID for object at path */ - - if (outlen < 22) return 1; - - objno = ref_path_table_lookup(str); - if (objno == HADDR_UNDEF) { - if (HDstrlen(str) == 0) { - objno = ref_path_table_lookup("/"); - if (objno == HADDR_UNDEF) { - if (gen) { - objno = ref_path_table_gen_fake(str); - sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); - return 0; - } - else { - return 1; - } - } - } - else { - if (gen) { - objno = ref_path_table_gen_fake(str); - sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); - return 0; - } - else { - return 1; - } - } - } - - sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); - - return(0); -} - -static const char *quote = """; -static const char *amp = "&"; -static const char *lt = "<"; -static const char *gt = ">"; -static const char *apos = "'"; - -/*------------------------------------------------------------------------- - * Function: xml_escape_the_name - * - * Purpose: Escape XML reserved chars in a name, so HDF5 strings - * and paths can be correctly read back in XML element. - * - * Return: The revised string. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static char * -xml_escape_the_name(const char *str) -{ - size_t extra; - size_t len; - size_t i; - const char *cp; - char *ncp; - char *rcp; - - if (!str) - return NULL; - - cp = str; - len = strlen(str); - extra = 0; - - for (i = 0; i < len; i++) { - if (*cp == '\"') { - extra += (strlen(quote) - 1); - } - else if (*cp == '\'') { - extra += (strlen(apos) - 1); - } - else if (*cp == '<') { - extra += (strlen(lt) - 1); - } - else if (*cp == '>') { - extra += (strlen(gt) - 1); - } - else if (*cp == '&') { - extra += (strlen(amp) - 1); - } - - cp++; - } - - if (extra == 0) - return HDstrdup(str); - - cp = str; - rcp = ncp = (char *)HDmalloc(len + extra + 1); - - if (!ncp) - return NULL; /* ?? */ - - for (i = 0; i < len; i++) { - if (*cp == '\'') { - strncpy(ncp, apos, strlen(apos)); - ncp += strlen(apos); - cp++; - } - else if (*cp == '<') { - strncpy(ncp, lt, strlen(lt)); - ncp += strlen(lt); - cp++; - } - else if (*cp == '>') { - strncpy(ncp, gt, strlen(gt)); - ncp += strlen(gt); - cp++; - } - else if (*cp == '\"') { - strncpy(ncp, quote, strlen(quote)); - ncp += strlen(quote); - cp++; - } - else if (*cp == '&') { - strncpy(ncp, amp, strlen(amp)); - ncp += strlen(amp); - cp++; - } - else { - *ncp++ = *cp++; - } - } - - *ncp = '\0'; - return rcp; -} - -/*------------------------------------------------------------------------- - * Function: xml_escape_the_string - * - * Purpose: Escape XML reserved chars in a string, so HDF5 strings - * and paths can be correctly read back in XML CDATA. - * - * Return: The revised string. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static char * -xml_escape_the_string(const char *str, int slen) -{ - size_t extra; - size_t len; - size_t i; - const char *cp; - char *ncp; - char *rcp; - - if (!str) - return NULL; - - cp = str; - - if (slen < 0) - len = strlen(str); - else - len = slen; - - extra = 0; - - for (i = 0; i < len; i++) { - if (*cp == '\\') { - extra++; - } - else if (*cp == '\"') { - extra++; - } - else if (*cp == '\'') { - extra += (strlen(apos) - 1); - } - else if (*cp == '<') { - extra += (strlen(lt) - 1); - } - else if (*cp == '>') { - extra += (strlen(gt) - 1); - } - else if (*cp == '&') { - extra += (strlen(amp) - 1); - } - cp++; - } - - cp = str; - rcp = ncp = (char *)calloc((len + extra + 1), sizeof(char)); - - if (ncp == NULL) - return NULL; /* ?? */ - - for (i = 0; i < len; i++) { - if (*cp == '\\') { - *ncp++ = '\\'; - *ncp++ = *cp++; - } - else if (*cp == '\"') { - *ncp++ = '\\'; - *ncp++ = *cp++; - } - else if (*cp == '\'') { - strncpy(ncp, apos, strlen(apos)); - ncp += strlen(apos); - cp++; - } - else if (*cp == '<') { - strncpy(ncp, lt, strlen(lt)); - ncp += strlen(lt); - cp++; - } - else if (*cp == '>') { - strncpy(ncp, gt, strlen(gt)); - ncp += strlen(gt); - cp++; - } - else if (*cp == '&') { - strncpy(ncp, amp, strlen(amp)); - ncp += strlen(amp); - cp++; - } - else { - *ncp++ = *cp++; - } - } - - *ncp = '\0'; - return rcp; -} - -/** -** XML print functions--these replace some functions in the -** h5tools.c suite. -**/ - -/*------------------------------------------------------------------------- - * Function: xml_print_datatype - * - * Purpose: Print description of a datatype in XML. - * Note: this is called inside a element. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -xml_print_datatype(hid_t type, unsigned in_group) -{ - char *mname; - hid_t mtype; - unsigned nmembers; - unsigned ndims; - unsigned i; - size_t size; - hsize_t dims[H5DUMP_MAX_RANK]; - H5T_str_t str_pad; - H5T_cset_t cset; - hid_t super; - H5T_order_t ord; - H5T_sign_t sgn; - size_t sz; - size_t spos; - size_t epos; - size_t esize; - size_t mpos; - size_t msize; - int nmembs; - htri_t is_vlstr=FALSE; - - if(!in_group && H5Tcommitted(type) > 0) { - H5O_info_t oinfo; - obj_t *found_obj; /* Found object */ - - /* detect a shared datatype, output only once */ - H5Oget_info(type, &oinfo); - found_obj = search_obj(type_table, oinfo.addr); - - if(found_obj) { - /* This should be defined somewhere else */ - /* These 2 cases are handled the same right now, but - probably will have something different eventually */ - char * dtxid = (char *)malloc(100); - - xml_name_to_XID(found_obj->objname, dtxid, 100, 1); - if (!found_obj->recorded) { - /* 'anonymous' NDT. Use it's object num. - as it's name. */ - HDfprintf(stdout, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>\n", - xmlnsprefix, dtxid); - } - else { - /* point to the NDT by name */ - char *t_objname = xml_escape_the_name(found_obj->objname); - - HDfprintf(stdout, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n", - xmlnsprefix, dtxid, t_objname); - free(t_objname); - } - free(dtxid); - } - else { - HDfprintf(stdout, "\n"); - h5tools_setstatus(EXIT_FAILURE); - } - } - else { - - switch (H5Tget_class(type)) { - case H5T_INTEGER: - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - /* */ - ord = H5Tget_order(type); - sgn = H5Tget_sign(type); - indentation(indent); - HDfprintf(stdout, "<%sIntegerType ByteOrder=\"",xmlnsprefix); - switch (ord) { - case H5T_ORDER_LE: - HDfprintf(stdout, "LE"); - break; - case H5T_ORDER_BE: - HDfprintf(stdout, "BE"); - break; - case H5T_ORDER_VAX: - default: - HDfprintf(stdout, "ERROR_UNKNOWN"); - } - HDfprintf(stdout, "\" Sign=\""); - switch (sgn) { - case H5T_SGN_NONE: - HDfprintf(stdout, "false"); - break; - case H5T_SGN_2: - HDfprintf(stdout, "true"); - break; - default: - HDfprintf(stdout, "ERROR_UNKNOWN"); - } - HDfprintf(stdout, "\" Size=\""); - sz = H5Tget_size(type); - HDfprintf(stdout, "%lu", (unsigned long)sz); - HDfprintf(stdout, "\" />\n"); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_FLOAT: - /* */ - ord = H5Tget_order(type); - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sFloatType ByteOrder=\"",xmlnsprefix); - switch (ord) { - case H5T_ORDER_LE: - HDfprintf(stdout, "LE"); - break; - case H5T_ORDER_BE: - HDfprintf(stdout, "BE"); - break; - case H5T_ORDER_VAX: - HDfprintf(stdout, "VAX"); - break; - default: - HDfprintf(stdout, "ERROR_UNKNOWN"); - } - HDfprintf(stdout, "\" Size=\""); - sz = H5Tget_size(type); - HDfprintf(stdout, "%lu", (unsigned long)sz); - H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize); - HDfprintf(stdout, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos); - HDfprintf(stdout, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos); - HDfprintf(stdout, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />\n", (unsigned long)msize, (unsigned long)mpos); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_TIME: - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sTimeType />\n",xmlnsprefix); - HDfprintf(stdout, ""); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_STRING: - /* */ - size = H5Tget_size(type); - str_pad = H5Tget_strpad(type); - cset = H5Tget_cset(type); - is_vlstr = H5Tis_variable_str(type); - - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sStringType Cset=\"",xmlnsprefix); - if (cset == H5T_CSET_ASCII) { - HDfprintf(stdout, "H5T_CSET_ASCII\" "); - } - else { - HDfprintf(stdout, "unknown_cset\" "); - } - if(is_vlstr) - HDfprintf(stdout, "StrSize=\"H5T_VARIABLE\" StrPad=\""); - else - HDfprintf(stdout, "StrSize=\"%d\" StrPad=\"", (int) size); - if (str_pad == H5T_STR_NULLTERM) { - HDfprintf(stdout, "H5T_STR_NULLTERM\"/>\n"); - } - else if (str_pad == H5T_STR_NULLPAD) { - HDfprintf(stdout, "H5T_STR_NULLPAD\"/>\n"); - } - else if (str_pad == H5T_STR_SPACEPAD) { - HDfprintf(stdout, "H5T_STR_SPACEPAD\"/>\n"); - } - else { - HDfprintf(stdout, "H5T_STR_ERROR\"/>\n"); - } - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_BITFIELD: - /* */ - ord = H5Tget_order(type); - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sBitfieldType ByteOrder=\"",xmlnsprefix); - switch (ord) { - case H5T_ORDER_LE: - HDfprintf(stdout, "LE"); - break; - case H5T_ORDER_BE: - HDfprintf(stdout, "BE"); - break; - case H5T_ORDER_VAX: - default: - HDfprintf(stdout, "ERROR_UNKNOWN"); - } - size = H5Tget_size(type); - HDfprintf(stdout, "\" Size=\"%lu\"/>\n", (unsigned long)size); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_OPAQUE: - /* */ - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - mname = H5Tget_tag(type); - HDfprintf(stdout, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname); - free(mname); - size = H5Tget_size(type); - HDfprintf(stdout, "Size=\"%lu\"/>\n", (unsigned long)size); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_COMPOUND: - /* recursively describe the components of a compound datatype */ - - /* type of a dataset */ - nmembers = H5Tget_nmembers(type); - - indentation(indent); - HDfprintf(stdout, "<%sCompoundType>\n",xmlnsprefix); - - /* List each member Field of the type */ - /* */ - /* */ - indent += COL; - for (i = 0; i < nmembers; i++) { - char *t_fname; - - mname = H5Tget_member_name(type, i); - mtype = H5Tget_member_type(type, i); - indentation(indent); - t_fname = xml_escape_the_name(mname); - HDfprintf(stdout, "<%sField FieldName=\"%s\">\n",xmlnsprefix, t_fname); - - free(mname); - free(t_fname); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sDataType>\n",xmlnsprefix); - indent += COL; - xml_print_datatype(mtype,0); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - } - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_REFERENCE: - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - /* Only Object references supported at this time */ - HDfprintf(stdout, "<%sReferenceType>\n",xmlnsprefix); - indentation(indent + COL); - HDfprintf(stdout, "<%sObjectReferenceType />\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_ENUM: - /* list Name, values of enum */ - nmembs = H5Tget_nmembers(type); - indentation(indent); - HDfprintf(stdout, "<%sAtomicType>\n",xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sEnumType Nelems=\"%d\">\n",xmlnsprefix, nmembs); - xml_print_enum(type); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_VLEN: - indentation(indent); - HDfprintf(stdout, "<%sVLType>\n",xmlnsprefix); - super = H5Tget_super(type); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sDataType>\n",xmlnsprefix); - indent += COL; - xml_print_datatype(super,0); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - H5Tclose(super); - - break; - - case H5T_ARRAY: - /* Get array base type */ - super = H5Tget_super(type); - - /* Print lead-in */ - indentation(indent); - HDfprintf(stdout, "<%sArrayType Ndims=\"",xmlnsprefix); - ndims = H5Tget_array_ndims(type); - HDfprintf(stdout, "%u\">\n", ndims); - - /* Get array information */ - H5Tget_array_dims2(type, dims); - - /* list of dimensions */ - indent += COL; - for (i = 0; i < ndims; i++) { - indentation(indent); - HDfprintf(stdout, "<%sArrayDimension DimSize=\"%u\"/>\n", xmlnsprefix, (int) dims[i]); - } - indent -= COL; - - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sDataType>\n",xmlnsprefix); - indent += COL; - xml_print_datatype(super,0); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - /* Close array base type */ - H5Tclose(super); - break; - - default: - HDfprintf(stdout, ""); - h5tools_setstatus(EXIT_FAILURE); - break; - } - } /* end else */ -} - -/*------------------------------------------------------------------------- - * Function: xml_dump_datatype - * - * Purpose: Dump description of a datatype in XML. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -xml_dump_datatype(hid_t type) -{ - - indent += COL; - indentation(indent); - - if(H5Tcommitted(type) > 0) { - H5O_info_t oinfo; - obj_t *found_obj; /* Found object */ - - /* Datatype is a shared or named datatype */ - H5Oget_info(type, &oinfo); - found_obj = search_obj(type_table, oinfo.addr); - - if(found_obj) { - /* Shared datatype, must be entered as an object */ - /* These 2 cases are the same now, but may change */ - char * dtxid = (char *)malloc(100); - - xml_name_to_XID(found_obj->objname, dtxid, 100, 1); - if (!found_obj->recorded) { - /* anonymous stored datatype: - following the dumper's current - practice: - use it's object ref as its name - */ - HDfprintf(stdout, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>\n", - xmlnsprefix, dtxid); - } - else { - /* pointer to a named datatype already in XML */ - char *t_objname = xml_escape_the_name(found_obj->objname); - - HDfprintf(stdout, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />\n", - xmlnsprefix, dtxid, t_objname); - free(t_objname); - } - free(dtxid); - } - else { - HDfprintf(stdout, "\n"); - } - indent -= COL; - } - else { - HDfprintf(stdout, "<%sDataType>\n", xmlnsprefix); - indent += COL; - xml_print_datatype(type, 0); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - indent -= COL; - } -} - -/*------------------------------------------------------------------------- - * Function: xml_dump_dataspace - * - * Purpose: Dump description of a dataspace in XML. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -xml_dump_dataspace(hid_t space) -{ - hsize_t size[H5DUMP_MAX_RANK]; - hsize_t maxsize[H5DUMP_MAX_RANK]; - int i; - - int ndims = H5Sget_simple_extent_dims(space, size, maxsize); - H5S_class_t space_type = H5Sget_simple_extent_type(space); - - indentation(indent + COL); - HDfprintf(stdout, "<%sDataspace>\n", xmlnsprefix); - indentation(indent + COL + COL); - - switch (space_type) { - case H5S_SCALAR: - /* scalar dataspace (just a tag, no XML attrs. defined */ - HDfprintf(stdout, "<%sScalarDataspace />\n",xmlnsprefix); - break; - - case H5S_SIMPLE: - /* simple dataspace */ - /* */ - HDfprintf(stdout, "<%sSimpleDataspace Ndims=\"%d\">\n",xmlnsprefix, ndims); - - /* print the elements */ - for (i = 0; i < ndims; i++) { - indentation(indent + COL + COL + COL); - if (maxsize[i] == H5S_UNLIMITED) { - HDfprintf(stdout, "<%sDimension DimSize=\"%Hu\" MaxDimSize=\"UNLIMITED\"/>\n", - xmlnsprefix,size[i]); - } - else if (maxsize[i] == (hsize_t) 0) { - HDfprintf(stdout, "<%sDimension DimSize=\"%Hu\" MaxDimSize=\"%Hu\"/>\n", - xmlnsprefix,size[i], size[i]); - } - else { - HDfprintf(stdout, "<%sDimension DimSize=\"%Hu\" MaxDimSize=\"%Hu\"/>\n", - xmlnsprefix, size[i], maxsize[i]); - } - } - indentation(indent + COL + COL); - HDfprintf(stdout, "\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 */ - HDfprintf(stdout, "<%sNullDataspace />\n",xmlnsprefix); - break; -#endif /* TMP */ - - case H5S_NO_CLASS: - default: - HDfprintf(stdout, "\n"); - } - - indentation(indent + COL); - HDfprintf(stdout, "\n", xmlnsprefix); -} - -/*------------------------------------------------------------------------- - * Function: xml_dump_data - * - * Purpose: Dump description of data in XML. - * Note that this calls the h5dump_xxx calls in - * the h5tools library. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNUSED pindex) -{ - hid_t space; - hid_t type; - hid_t p_type; - hsize_t size[64]; - hsize_t nelmts = 1; - int ndims; - int i; - int depth; - int status = -1; - int stdindent = COL; /* should be 3 */ - h5tool_format_t *outputformat = &xml_dataformat; - void *buf = NULL; - - if (fp_format) { - outputformat->fmt_double = fp_format; - outputformat->fmt_float = fp_format; - } - - if (nCols==0) { - outputformat->line_ncols = 65535; - outputformat->line_per_line = 1; - } - else - outputformat->line_ncols = nCols; - indent += COL; - - /* - * the depth will tell us how far we need to indent extra. we use to just - * use indent but with the merging of the tools lib we have to do - * something different for the lib funtions... the normal indentation is 6 - * so when we don't need any extra indentation, depth will be 0. - */ - depth = indent / stdindent + 1; - - /* Print all the values. */ - indentation(indent); - HDfprintf(stdout, "<%sData>\n", xmlnsprefix); - indentation(indent + COL); - HDfprintf(stdout, "<%sDataFromFile>\n",xmlnsprefix); - if (obj_data == DATASET_DATA) { - type = H5Dget_type(obj_id); - if (H5Tget_class(type) == H5T_REFERENCE) { - status = xml_print_refs(obj_id, DATASET_DATA); - } - else if (H5Tget_class(type) == H5T_STRING) { - status = xml_print_strs(obj_id, DATASET_DATA); - } - else { - status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, NULL, depth); - } - } - else { - /* Attribute data */ - type = H5Aget_type(obj_id); - - if (H5Tget_class(type) == H5T_REFERENCE) { - /* references are done differently than - the standard output: - XML dumps a path to the object - referenced. - */ - status = xml_print_refs(obj_id, ATTRIBUTE_DATA); - H5Tclose(type); - } - else if (H5Tget_class(type) == H5T_STRING) { - status = xml_print_strs(obj_id, ATTRIBUTE_DATA); - } - else { /* all other data */ - /* VL data special information */ - unsigned int vl_data = 0; /* contains VL datatypes */ - - p_type = h5tools_get_native_type(type); - - /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) - vl_data = TRUE; - - H5Tclose(type); - - space = H5Aget_space(obj_id); - - ndims = H5Sget_simple_extent_dims(space, size, NULL); - - for (i = 0; i < ndims; i++) - nelmts *= size[i]; - - buf = malloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)))); - assert(buf); + for (i = 0; i < argc; i++) + if (!hand[i].func) { + hand[i].func = handle_groups; + hand[i].obj = HDstrdup(opt_arg); + break; + } - if (H5Aread(obj_id, p_type, buf) >= 0) - status = h5tools_dump_mem(stdout, outputformat, obj_id, p_type, space, buf, depth); + last_was_dset = FALSE; + break; + case 'l': + display_all = 0; - /* Reclaim any VL memory, if necessary */ - if (vl_data) - H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); + for (i = 0; i < argc; i++) + if (!hand[i].func) { + hand[i].func = handle_links; + hand[i].obj = HDstrdup(opt_arg); + break; + } - free(buf); - H5Tclose(p_type); - H5Sclose(space); - H5Tclose(type); - } - } + last_was_dset = FALSE; + break; + case 't': + display_all = 0; - if (status == FAIL) { - indentation(indent + COL); - HDfprintf(stdout, "Unable to print data.\n"); - status = 1; - } + for (i = 0; i < argc; i++) + if (!hand[i].func) { + hand[i].func = handle_datatypes; + hand[i].obj = HDstrdup(opt_arg); + break; + } - indentation(indent + COL); - HDfprintf(stdout, "\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - indent -= COL; -} + last_was_dset = FALSE; + break; -/*------------------------------------------------------------------------- - * Function: xml_dump_attr - * - * Purpose: Dump a description of an HDF5 attribute in XML. - * - * Return: herr_t - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, - void UNUSED * op_data) -{ - hid_t attr_id; - hid_t type; - hid_t space; - H5S_class_t space_type; - char *t_aname = xml_escape_the_name(attr_name); - - indentation(indent); - HDfprintf(stdout, "<%sAttribute Name=\"%s\">\n",xmlnsprefix, t_aname); - free(t_aname); - - if ((attr_id = H5Aopen(attr, attr_name, H5P_DEFAULT)) >= 0) { - type = H5Aget_type(attr_id); - space = H5Aget_space(attr_id); - space_type = H5Sget_simple_extent_type(space); - - dump_function_table->dump_dataspace_function(space); - dump_function_table->dump_datatype_function(type); - - if (display_attr_data && space_type!=H5S_NULL) { - switch (H5Tget_class(type)) { - case H5T_INTEGER: - case H5T_FLOAT: - case H5T_STRING: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_ENUM: - case H5T_ARRAY: - dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); - break; - - case H5T_TIME: - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sData>\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData/>\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n"); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - break; - - case H5T_COMPOUND: - indentation(indent); - HDfprintf(stdout, "\n"); - dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); - break; - - case H5T_REFERENCE: - indentation(indent); - HDfprintf(stdout, "<%sData>\n",xmlnsprefix); - indentation(indent); - if (!H5Tequal(type, H5T_STD_REF_OBJ)) { - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n",xmlnsprefix); + case 'o': + if ( bin_output ) { + if (set_data_output_file(opt_arg, 1) < 0) { + usage(h5tools_getprogname()); + goto error; } - else { - HDfprintf(stdout, "<%sDataFromFile>\n",xmlnsprefix); - xml_print_refs(attr_id, ATTRIBUTE_DATA); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); + } + else { + if (set_data_output_file(opt_arg, 0) < 0) { + usage(h5tools_getprogname()); + goto error; } - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_VLEN: - HDfprintf(stdout, "\n"); - dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); - break; - default: - indentation(indent); - HDfprintf(stdout, "<%sData>\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n", H5Tget_class(type)); - indentation(indent); - HDfprintf(stdout, "<%sNoData/>\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; } - } - else { - /* The case of an attribute never yet written ?? - * Or dataspace is H5S_NULL. */ - indentation(indent + COL); - HDfprintf(stdout, "<%sData>\n",xmlnsprefix); - indentation(indent + COL + COL); - HDfprintf(stdout, "<%sNoData/>\n",xmlnsprefix); - indentation(indent + COL); - HDfprintf(stdout, "\n",xmlnsprefix); - } - - H5Tclose(type); - H5Sclose(space); - H5Aclose(attr_id); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix ); - return SUCCEED; - - } - else { - /* ?? failed */ - indentation(indent + COL); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix ); - h5tools_setstatus(EXIT_FAILURE); - return FAIL; - } -} - -/*------------------------------------------------------------------------- - * Function: xml_dump_named_datatype - * - * Purpose: Dump a description of an HDF5 NDT in XML. - * - * Return: herr_t - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -xml_dump_named_datatype(hid_t type, const char *name) -{ - char *tmp; - char * dtxid; - char * parentxid; - char *t_tmp; - char *t_prefix; - char *t_name; - - tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); - HDstrcpy(tmp, prefix); - HDstrcat(tmp, "/"); - HDstrcat(tmp, name); - - indentation(indent); - dtxid = (char *)HDmalloc(100); - parentxid = (char *)HDmalloc(100); - t_tmp = xml_escape_the_name(tmp); - t_prefix = xml_escape_the_name(prefix); - t_name = xml_escape_the_name(name); - - xml_name_to_XID(tmp, dtxid, 100, 1); - xml_name_to_XID(prefix, parentxid, 100, 1); - if(HDstrncmp(name, "#", 1) == 0) { - /* Special: this is an 'anonymous' NDT, deleted but - still in use. - We follow the dumper's undocumented practice, and - use its object id as its name. - Exactly the same as normal, but a separate case - in the event we want to do something else in - the future. - */ - HDfprintf(stdout, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\">\n", - xmlnsprefix, - name, dtxid, - parentxid, HDstrcmp(prefix,"") ? t_prefix : "/"); - } - else { - H5O_info_t oinfo; /* Object info */ - - HDfprintf(stdout, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " - "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">\n", - xmlnsprefix, - t_name, dtxid, - t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/")); - - /* Check uniqueness of named datatype */ - H5Oget_info(type, &oinfo); - if(oinfo.rc > 1) { - obj_t *found_obj; /* Found object */ - - /* Group with more than one link to it... */ - found_obj = search_obj(type_table, oinfo.addr); - - if (found_obj == NULL) { - indentation(indent); - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } - else if(found_obj->displayed) { - /* We have already printed this named datatype, print it as a - * NamedDatatypePtr - */ - char pointerxid[100]; - char *t_objname = xml_escape_the_name(found_obj->objname); - - indentation(indent + COL); - xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1); - HDfprintf(stdout, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n", xmlnsprefix, pointerxid, t_objname); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); - HDfree(t_objname); - goto done; - } - else - found_obj->displayed = TRUE; - } - } - - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sDataType>\n",xmlnsprefix); - - indent += COL; - xml_print_datatype(type,1); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - - done: - HDfree(dtxid); - HDfree(parentxid); - HDfree(t_tmp); - HDfree(t_prefix); - HDfree(t_name); - HDfree(tmp); -} + usingdasho = TRUE; + last_was_dset = FALSE; + outfname = opt_arg; + break; -/*------------------------------------------------------------------------- - * Function: xml_dump_group - * - * Purpose: Dump a description of an HDF5 Group (and its members) in XML. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * Pedro Vicente, October 9, 2007 - * added parameters to H5A(L)iterate to allow for other iteration orders - * - *------------------------------------------------------------------------- - */ -static void -xml_dump_group(hid_t gid, const char *name) -{ - H5O_info_t oinfo; - hid_t gcpl_id; - hid_t dset, type; - unsigned crt_order_flags; - unsigned attr_crt_order_flags; - int isRoot = 0; - char type_name[1024]; - char *t_objname = NULL; - char *par_name = NULL; - char *cp = NULL; - char *tmp = NULL; - char *par = NULL; - - - if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { - error_msg("error in getting group creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); - } + case 'b': + if ( opt_arg != NULL) { + if ( ( bin_form = set_binary_form(opt_arg)) < 0) { + /* failed to set binary form */ + usage(h5tools_getprogname()); + goto error; + } + } + bin_output = TRUE; + if (outfname!=NULL) { + if (set_data_output_file(outfname, 1) < 0) { + /* failed to set output file */ + usage(h5tools_getprogname()); + goto error; + } - /* query the group creation properties for attributes */ - if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) { - error_msg("error in getting group creation properties\n"); - h5tools_setstatus(EXIT_FAILURE); - } + last_was_dset = FALSE; + } + break; - /* query the group creation properties */ - if (H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { - error_msg("error in getting group creation properties\n"); - h5tools_setstatus(EXIT_FAILURE); - } + case 'q': + if ( ( sort_by = set_sort_by(opt_arg)) < 0) { + /* failed to set "sort by" form */ + usage(h5tools_getprogname()); + goto error; + } + break; - if(H5Pclose(gcpl_id) < 0) { - error_msg("error in closing group creation property list ID\n"); - h5tools_setstatus(EXIT_FAILURE); - } + case 'z': + if ( ( sort_order = set_sort_order(opt_arg)) < 0) { + /* failed to set "sort order" form */ + usage(h5tools_getprogname()); + goto error; + } + break; - if(HDstrcmp(name, "/") == 0) { - isRoot = 1; - tmp = HDstrdup("/"); - } - else { - tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); - HDstrcpy(tmp, prefix); - par = HDstrdup(tmp); - cp = HDstrrchr(par, '/'); - if(cp) { - if((cp == par) && HDstrlen(par) > 1) - *(cp + 1) = '\0'; - else - *cp = '\0'; - } - } + case 'M': + if (!last_was_dset) { + error_msg("option `-%c' can only be used after --dataset option\n", opt); + goto error; + } + if (parse_mask_list(opt_arg) != SUCCEED){ + usage(h5tools_getprogname()); + goto error; + } + display_packed_bits = TRUE; + break; - indentation(indent); - indent += COL; + /** begin XML parameters **/ + case 'x': + /* select XML output */ + doxml = TRUE; + useschema = TRUE; + h5tools_dump_header_format = NULL; + dump_function_table = &xml_function_table; + h5tools_nCols = 0; + break; + case 'u': + doxml = TRUE; + useschema = FALSE; + xmlnsprefix = ""; + h5tools_dump_header_format = NULL; + dump_function_table = &xml_function_table; + h5tools_nCols = 0; + break; + case 'D': + /* specify alternative XML DTD or schema */ + /* To Do: check format of this value? */ + xml_dtd_uri = opt_arg; + h5tools_nCols = 0; + break; - H5Oget_info(gid, &oinfo); + case 'm': + /* specify alternative floating point printing format */ + fp_format = opt_arg; + h5tools_nCols = 0; + break; - if(oinfo.rc > 1) { - obj_t *found_obj; /* Found object */ + case 'X': + /* specify XML namespace (default="hdf5:"), or none */ + /* To Do: check format of this value? */ + if (!useschema) { + usage(h5tools_getprogname()); + goto error; + } + if (strcmp(opt_arg,":") == 0) { + xmlnsprefix = ""; + } + else { + xmlnsprefix = opt_arg; + } + h5tools_nCols = 0; + break; + /** end XML parameters **/ - /* Group with more than one link to it... */ - found_obj = search_obj(group_table, oinfo.addr); + /** begin subsetting parameters **/ + case 's': + case 'S': + case 'c': + case 'k': { + struct subset_t *s; - if (found_obj == NULL) { - indentation(indent); - error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); - h5tools_setstatus(EXIT_FAILURE); - } - else { - char *t_name = xml_escape_the_name(name); - char *grpxid = (char *)malloc(100); - char *parentxid = (char *)malloc(100); - - if(found_obj->displayed) { - char *ptrstr = (char *)malloc(100); - - /* already seen: enter a groupptr */ - if(isRoot) { - /* probably can't happen! */ - xml_name_to_XID("/", grpxid, 100, 1); - HDfprintf(stdout, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n", - xmlnsprefix, grpxid, "/"); - } - else { - t_objname = xml_escape_the_name(found_obj->objname); - par_name = xml_escape_the_name(par); - xml_name_to_XID(tmp, grpxid, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); - HDfprintf(stdout, "<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\">\n", - xmlnsprefix,t_name, grpxid, get_next_xid(), - t_objname, parentxid, par_name); - free(t_objname); - free(par_name); - - indentation(indent + COL); - t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */ - par_name = xml_escape_the_name(par); - xml_name_to_XID(found_obj->objname, ptrstr, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); - HDfprintf(stdout, "<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - ptrstr, t_objname, parentxid, par_name); - free(t_objname); - free(par_name); - } - free(ptrstr); + if (!last_was_dset) { + error_msg("option `-%c' can only be used after --dataset option\n", opt); + goto error; } + + if (last_dset->subset_info) { + /* + * This overrides the "terse" syntax if they actually mixed + * the two. + */ + s = last_dset->subset_info; + } else { + last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t)); + } - /* first time this group has been seen -- describe it */ - if(isRoot) { - xml_name_to_XID("/", grpxid, 100, 1); - HDfprintf(stdout, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n", - xmlnsprefix, grpxid, "/"); - } - else { - char *t_tmp = xml_escape_the_name(tmp); - - par_name = xml_escape_the_name(par); - xml_name_to_XID(tmp, grpxid, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); - HDfprintf(stdout, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" >\n", - xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name); - free(t_tmp); - free(par_name); + /* + * slightly convoluted, but...we are only interested in options + * for subsetting: "--start", "--stride", "--count", and "--block" + * which can come in any order. If we run out of parameters (EOF) + * or run into one which isn't a subsetting parameter (NOT s, S, + * c, or K), then we exit the do-while look, set the subset_info + * to the structure we've been filling. If we've reached the end + * of the options, we exit the parsing (goto parse_end) otherwise, + * since we've "read" the next option, we need to parse it. So we + * jump to the beginning of the switch statement (goto parse_start). + */ + do { + switch ((char)opt) { + case 's': + if (s->start.data) { + HDfree(s->start.data); + s->start.data = NULL; + } + parse_hsize_list(opt_arg, &s->start); + break; + case 'S': + if (s->stride.data) { + HDfree(s->stride.data); + s->stride.data = NULL; + } + parse_hsize_list(opt_arg, &s->stride); + break; + case 'c': + if (s->count.data) { + HDfree(s->count.data); + s->count.data = NULL; } - found_obj->displayed = TRUE; - - /* 1. do all the attributes of the group */ - - if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end if */ - else { - if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end else */ - - if(isRoot && unamedtype) { - unsigned u; - - /* Very special case: dump unamed type in root group */ - for(u = 0; u < type_table->nobjs; u++) { - if(!type_table->objs[u].recorded) { - dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); - type = H5Dget_type(dset); - sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); - dump_function_table->dump_named_datatype_function(type, type_name); - H5Tclose(type); - H5Dclose(dset); - } + parse_hsize_list(opt_arg, &s->count); + break; + case 'k': + if (s->block.data) { + HDfree(s->block.data); + s->block.data = NULL; } + parse_hsize_list(opt_arg, &s->block); + break; + default: + goto end_collect; } + } while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF); - /* iterate through all the links */ - - if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); - else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); - - - } - free(t_name); - free(grpxid); - free(parentxid); - } - } - else { - - /* only link -- must be first time! */ - char *t_name = xml_escape_the_name(name); - char *grpxid = (char *)malloc(100); - char *parentxid = (char *)malloc(100); +end_collect: + last_was_dset = FALSE; - if(isRoot) { - xml_name_to_XID("/", grpxid, 100, 1); - HDfprintf(stdout, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n", xmlnsprefix, grpxid, "/"); - } - else { - char *t_tmp = xml_escape_the_name(tmp); - - par_name = xml_escape_the_name(par); - xml_name_to_XID(tmp, grpxid, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); - HDfprintf(stdout, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" >\n", - xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name); - free(t_tmp); - free(par_name); + if (opt != EOF) + goto parse_start; + else + goto parse_end; } - free(t_name); - free(grpxid); - free(parentxid); - - /* 1. do all the attributes of the group */ + /** end subsetting parameters **/ - if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end if */ - else { - if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end else */ - - - if(isRoot && unamedtype) { - unsigned u; - - /* Very special case: dump unamed type in root group */ - for(u = 0; u < type_table->nobjs; u++) { - if(!type_table->objs[u].recorded) { - dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); - type = H5Dget_type(dset); - sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); - dump_function_table->dump_named_datatype_function(type, type_name); - H5Tclose(type); - H5Dclose(dset); - } - } + case 'E': + enable_error_stack = TRUE; + break; + case 'C': + disable_compact_subset = TRUE; + break; + case 'h': + usage(h5tools_getprogname()); + free_handler(hand, argc); + hand = NULL; + h5tools_setstatus(EXIT_SUCCESS); + goto done; + case '?': + default: + usage(h5tools_getprogname()); + goto error; } + } - /* iterate through all the links */ +parse_end: + /* check for file name to be processed */ + if (argc <= opt_ind) { + error_msg("missing file name\n"); + usage(h5tools_getprogname()); + goto error; + } +done: + return hand; - if( (sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); - else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); +error: + if (hand) { + free_handler(hand, argc); + hand = NULL; } + h5tools_setstatus(EXIT_FAILURE); - indent -= COL; - indentation(indent); - if(isRoot) - HDfprintf(stdout, "\n", xmlnsprefix); - else - HDfprintf(stdout, "\n", xmlnsprefix); - if(par) - free(par); - if(tmp) - free(tmp); + return hand; } - + /*------------------------------------------------------------------------- - * Function: xml_print_refs + * Function: main * - * Purpose: Print a path to the objects referenced by HDF5 Referneces. + * Purpose: HDF5 dumper * - * Return: void + * Return: Success: 0 + * Failure: 1 * - * Programmer: REMcG + * Programmer: Ruey-Hsia Li * * Modifications: + * Albert Cheng + * 30. September 2000 + * Add the -o option--output file for datasets raw data * - *------------------------------------------------------------------------- - */ -static int -xml_print_refs(hid_t did, int source) -{ - herr_t e; - hid_t type; - hid_t space; - hssize_t ssiz; - hsize_t i; - size_t tsiz; - hobj_ref_t *refbuf = NULL; - char *buf = NULL; - - if (source == DATASET_DATA) { - type = H5Dget_type(did); - } - else if (source == ATTRIBUTE_DATA) { - type = H5Aget_type(did); - } - else { - /* return an error */ - return FAIL; - } - if (H5Tget_class(type) != H5T_REFERENCE) { - /* return an error */ - goto error; - } - if (!H5Tequal(type, H5T_STD_REF_OBJ)) { - /* region ref not supported yet... */ - /* return an error */ - goto error; - } - if (source == DATASET_DATA) { - space = H5Dget_space(did); - if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) - goto error; - if ((tsiz = H5Tget_size(type)) == 0) - goto error; - - buf = (char *) calloc((size_t)(ssiz * tsiz), sizeof(char)); - if (buf == NULL) - goto error; - e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - /* need to check result here */ - if (e < 0) { - goto error; - } - } - else if (source == ATTRIBUTE_DATA) { - space = H5Aget_space(did); - if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) - goto error; - if ((tsiz = H5Tget_size(type)) == 0) - goto error; - - buf = (char *) calloc((size_t)(ssiz * tsiz), sizeof(char)); - if (buf == NULL) { - goto error; - } - e = H5Aread(did, H5T_STD_REF_OBJ, buf); - /* need to check the result here */ - if (e < 0) { - goto error; - } - } - - refbuf = (hobj_ref_t *) buf; - - for (i = 0; i < ssiz; i++) { - const char *path = lookup_ref_path(*refbuf); - indentation(indent + COL); - - if (!path) { - HDfprintf(stdout, "\"%s\"\n", "NULL"); - } - else { - char *t_path = xml_escape_the_string(path, -1); - - HDfprintf(stdout, "\"%s\"\n", t_path); - free(t_path); - } - - refbuf++; - } - - free(buf); - H5Tclose(type); - H5Sclose(space); - return SUCCEED; - - error: - if(buf) - free(buf); - - H5E_BEGIN_TRY { - H5Tclose(type); - H5Sclose(space); - } H5E_END_TRY; - return FAIL; -} - -/*------------------------------------------------------------------------- - * Function: xml_print_strs + * REMcG + * November 2000 + * Changes to support XML. * - * Purpose: Print strings. + * Bill Wendling + * Wednesday, 10. January 2001 + * Modified the way command line parameters are interpreted. They go + * through one function call now (get_option). * - * Return: void + * Bill Wendling + * Tuesday, 20. February 2001 + * Moved command line parsing to separate function. Made various + * "display_*" flags global. * - * Programmer: REMcG + * REMcG + * August 2003 + * Major upgrade to XML support. * - * Modifications: + * Pedro Vicente + * September 2007 + * list objects in requested order (creation order or alphabetically) * *------------------------------------------------------------------------- */ -static int -xml_print_strs(hid_t did, int source) +int +main(int argc, const char *argv[]) { - herr_t e; - hid_t type; - hid_t space; - hssize_t ssiz; - htri_t is_vlstr = FALSE; - size_t tsiz; - size_t i; - size_t str_size = 0; - char *bp = NULL; - char *onestring = NULL; - void *buf = NULL; - - if (source == DATASET_DATA) { - type = H5Dget_type(did); - } - else if (source == ATTRIBUTE_DATA) { - type = H5Aget_type(did); - } - else { - /* return an error */ - return FAIL; - } - if (H5Tget_class(type) != H5T_STRING) { - /* return an error */ - goto error; + hid_t fid = -1; + hid_t gid = -1; + H5E_auto2_t func; + H5O_info_t oi; + struct handler_t *hand; + int i; + unsigned u; + void *edata; + char *fname = NULL; + + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); + h5tools_dump_header_format = &h5tools_standardformat; + dump_function_table = &ddl_function_table; + dump_indent = 0; + + /* Disable error reporting */ + H5Eget_auto2(H5E_DEFAULT, &func, &edata); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + + /* Initialize h5tools lib */ + h5tools_init(); + if((hand = parse_command_line(argc, argv))==NULL) { + goto done; } - /* Check if we have VL data in the dataset's datatype */ - is_vlstr = H5Tis_variable_str(type); - if (source == DATASET_DATA) { - space = H5Dget_space(did); - if((ssiz = H5Sget_simple_extent_npoints(space)) < 0) - goto error; - if((tsiz = H5Tget_size(type)) == 0) - goto error; + if (bin_output && outfname == NULL) { + error_msg("binary output requires a file name, use -o \n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } - buf = malloc((size_t)(ssiz * tsiz)); - if (buf == NULL) - goto error; + if (enable_error_stack) + H5Eset_auto2(H5E_DEFAULT, func, edata); - e = H5Dread(did, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); - if (e < 0) { - goto error; + /* Check for conflicting options */ + if (doxml) { + if (!display_all) { + error_msg("option \"%s\" not available for XML\n", + "to display selected objects"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if (display_bb) { + error_msg("option \"%s\" not available for XML\n", "--boot-block"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if (display_oid == 1) { + error_msg("option \"%s\" not available for XML\n", "--object-ids"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if (display_char == TRUE) { + error_msg("option \"%s\" not available for XML\n", "--string"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if (usingdasho) { + error_msg("option \"%s\" not available for XML\n", "--output"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + } + else { + if (xml_dtd_uri) { + warn_msg("option \"%s\" only applies with XML: %s\n", "--xml-dtd", xml_dtd_uri); } } - else if (source == ATTRIBUTE_DATA) { - space = H5Aget_space(did); - if((ssiz = H5Sget_simple_extent_npoints(space)) < 0) - goto error; - if((tsiz = H5Tget_size(type)) == 0) - goto error; - buf = malloc((size_t)(ssiz * tsiz)); - if (buf == NULL) - goto error; + if (argc <= opt_ind) { + error_msg("missing file name\n"); + usage(h5tools_getprogname()); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + fname = HDstrdup(argv[opt_ind]); - e = H5Aread(did, type, buf); - if (e < 0) { - goto error; - } + fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0); + + if (fid < 0) { + error_msg("unable to open file \"%s\"\n", fname); + h5tools_setstatus(EXIT_FAILURE); + goto done; } - bp = (char*) buf; - if (!is_vlstr) - onestring = (char *) calloc(tsiz, sizeof(char)); + /* allocate and initialize internal data structure */ + init_prefix(&prefix, prefix_len); - for (i = 0; i < ssiz; i++) { - if (is_vlstr) { - onestring = *(char **) bp; - if (onestring) - str_size = (size_t) HDstrlen(onestring); - } - else { - HDstrncpy(onestring, bp, tsiz); - str_size = tsiz; - } - indentation(indent + COL); + /* Prepare to find objects that might be targets of a reference */ + fill_ref_path_table(fid); - if (!onestring) { - HDfprintf(stdout, "NULL\n"); - } + if(doxml) { + /* initialize XML */ + /* reset prefix! */ + HDstrcpy(prefix, ""); + + /* make sure the URI is initialized to something */ + if (xml_dtd_uri == NULL) { + if (useschema) { + xml_dtd_uri = DEFAULT_XSD; + } + else { + xml_dtd_uri = DEFAULT_DTD; + xmlnsprefix = ""; + } + } else { - char *t_onestring = xml_escape_the_string(onestring, (int) str_size); - if (t_onestring) { - HDfprintf(stdout, "\"%s\"\n", t_onestring); - free(t_onestring); + if (useschema && strcmp(xmlnsprefix,"")) { + error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; } } - - bp += tsiz; } - /* Reclaim any VL memory, if necessary */ - if (!is_vlstr) - if (onestring) - free(onestring); - if (buf) { - if (is_vlstr) - H5Dvlen_reclaim(type, space, H5P_DEFAULT, buf); - free(buf); + /* Get object info for root group */ + if(H5Oget_info_by_name(fid, "/", &oi, H5P_DEFAULT) < 0) { + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + goto done; } - H5Tclose(type); - H5Sclose(space); - return SUCCEED; - error: - if(buf) - free(buf); + /* Initialize object tables */ + if(table_list_add(fid, oi.fileno) < 0) { + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + group_table = table_list.tables[0].group_table; + dset_table = table_list.tables[0].dset_table; + type_table = table_list.tables[0].type_table; - H5E_BEGIN_TRY { - H5Tclose(type); - H5Sclose(space); - } H5E_END_TRY; - return FAIL; -} + /* does there exist unamed committed datatype */ + for (u = 0; u < type_table->nobjs; u++) + if (!type_table->objs[u].recorded) { + unamedtype = 1; + break; + } /* end if */ -/*------------------------------------------------------------------------- - * Function: check_filters - * - * Purpose: private function to check for the filters and - * put tags in the XML. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -check_filters(hid_t dcpl) -{ - int nfilt; - int i; - H5Z_filter_t filter; - char namebuf[120]; - size_t cd_nelmts = 20; - unsigned int cd_values[20]; - unsigned int flags; - - nfilt = H5Pget_nfilters(dcpl); - if (nfilt <= 0) - return; - for (i = 0; i < nfilt; i++) { - filter = H5Pget_filter2(dcpl, (unsigned) i, &flags, (size_t *) &cd_nelmts, cd_values, 120, namebuf, NULL); - if (filter == H5Z_FILTER_DEFLATE) { - indentation(indent + COL); - HDfprintf(stdout, "<%sDeflate Level=\"",xmlnsprefix); - if (cd_nelmts < 1) { - /* not sure what this means? */ - HDfprintf(stdout, "6"); - } - else { - HDfprintf(stdout, "%d",cd_values[0]); - } - HDfprintf(stdout, "\"/>\n"); - } - else if (filter == H5Z_FILTER_FLETCHER32) { - indentation(indent + COL); - HDfprintf(stdout, "<%sFletcher32 />",xmlnsprefix); - } - else if (filter == H5Z_FILTER_SHUFFLE) { - indentation(indent + COL); - HDfprintf(stdout, "<%sShuffle />",xmlnsprefix); - } - else if (filter == H5Z_FILTER_SZIP) { + /* start to dump - display file header information */ + if (!doxml) { + begin_obj(h5tools_dump_header_format->filebegin, fname, h5tools_dump_header_format->fileblockbegin); + } + else { + HDfprintf(rawoutstream, "\n"); - indentation(indent + COL); - HDfprintf(stdout, "<%sSZIP ",xmlnsprefix); - if (cd_nelmts < 2) { - /* no pixels ? */ - HDfprintf(stdout, "Pixels_per_block=\"-1\" "); - } + /* alternative first element, depending on schema or DTD. */ + if (useschema) { + if (strcmp(xmlnsprefix,"") == 0) { + HDfprintf(rawoutstream, "\n", + xml_dtd_uri); + } else { - HDfprintf(stdout, "Pixels_per_block=\"%d\" ",cd_values[1]); - } - /* analyse the options mask */ - if (cd_values[0] & H5_SZIP_CHIP_OPTION_MASK) { - HDfprintf(stdout, "Mode =\"Hardware\" "); - } - else if (cd_values[0] & H5_SZIP_ALLOW_K13_OPTION_MASK) { - HDfprintf(stdout, "Mode =\"K13\" "); - } - HDfprintf(stdout, "Coding=\""); - if (cd_values[0] & H5_SZIP_EC_OPTION_MASK) { - HDfprintf(stdout, "Entropy"); - } - else if (cd_values[0] & H5_SZIP_NN_OPTION_MASK) { - HDfprintf(stdout, "NN"); - } - HDfprintf(stdout, "\" "); +/* TO DO: make -url option work in this case (may need new option) */ + char *ns; + char *indx; - HDfprintf(stdout, "ByteOrder=\""); - if (cd_values[0] & H5_SZIP_LSB_OPTION_MASK) { - HDfprintf(stdout, "LSB"); - } - else if (cd_values[0] & H5_SZIP_MSB_OPTION_MASK) { - HDfprintf(stdout, "MSB"); - } - HDfprintf(stdout, "\" "); + ns = HDstrdup(xmlnsprefix); + indx = strrchr(ns,(int)':'); + if (indx) *indx = '\0'; - if (cd_values[0] & H5_SZIP_RAW_OPTION_MASK) { - HDfprintf(stdout, "Header=\"Raw\""); + HDfprintf(rawoutstream, "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + "xsi:schemaLocation=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File " + "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",xmlnsprefix,ns); + HDfree(ns); } - HDfprintf(stdout, "/>\n"); - } + } else { - /* unknown option */ + HDfprintf(rawoutstream, "\n", xml_dtd_uri); + HDfprintf(rawoutstream, "\n"); } } -} -static void -xml_dump_fill_value(hid_t dcpl, hid_t type) -{ - size_t sz; - size_t i; - hsize_t space; - void * buf; - char * name; - - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sData>\n",xmlnsprefix); - indent += COL; - - space = H5Tget_size(type); - buf = malloc((size_t)space); - - H5Pget_fill_value(dcpl, type, buf); + if (!doxml) { + if (display_fi) { + HDfprintf(rawoutstream, "\n"); + dump_fcontents(fid); + end_obj(h5tools_dump_header_format->fileend,h5tools_dump_header_format->fileblockend); + HDfprintf(rawoutstream, "\n"); + goto done; + } - if (H5Tget_class(type) == H5T_REFERENCE) { - const char * path = lookup_ref_path(*(hobj_ref_t *) buf); + if (display_bb) + dump_fcpl(fid); + } - indentation(indent); - HDfprintf(stdout, "<%sDataFromFile>\n",xmlnsprefix); - if (!path) { - HDfprintf(stdout, "\"%s\"\n", "NULL"); + if(display_all) { + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) { + error_msg("unable to open root group\n"); + h5tools_setstatus(EXIT_FAILURE); } else { - char *t_path = xml_escape_the_string(path, -1); - - HDfprintf(stdout, "\"%s\"\n", t_path); - free(t_path); - } - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - } - else if (H5Tget_class(type) == H5T_STRING) { - /* ????? */ - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n",xmlnsprefix); - } - else { - /* all other data */ - switch (H5Tget_class(type)) { - case H5T_INTEGER: - indentation(indent); - HDfprintf(stdout, "<%sDataFromFile>\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\"%d\"\n",*(int *)buf); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - case H5T_FLOAT: - indentation(indent); - HDfprintf(stdout, "<%sDataFromFile>\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\"%f\"\n",*(float *)buf); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - case H5T_BITFIELD: - case H5T_OPAQUE: - indentation(indent); - HDfprintf(stdout, "<%sDataFromFile>\n",xmlnsprefix); - sz = H5Tget_size(type); - indentation(indent); - HDfprintf(stdout, "\""); - for (i = 0; i < sz; i++) { - HDfprintf(stdout, "%x ",*(unsigned int *)buf); - buf = (char *)buf + sizeof(unsigned int); - } - HDfprintf(stdout, "\"\n"); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - case H5T_ENUM: - indentation(indent); - HDfprintf(stdout, "<%sDataFromFile>\n",xmlnsprefix); - name = H5Tget_member_name(type, *(unsigned *)buf); - indentation(indent); - HDfprintf(stdout, "\"%s\"\n",name); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - case H5T_ARRAY: - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n",xmlnsprefix); - break; - case H5T_TIME: - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n",xmlnsprefix); - break; - case H5T_COMPOUND: - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n",xmlnsprefix); - break; - case H5T_VLEN: - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n",xmlnsprefix); - break; - default: - indentation(indent); - HDfprintf(stdout, "\n", H5Tget_class(type)); - indentation(indent); - HDfprintf(stdout, "<%sNoData/>\n",xmlnsprefix); - break; + if (!doxml) + dump_indent += COL; + dump_function_table->dump_group_function(gid, "/" ); + if (!doxml) + dump_indent -= COL; + HDfprintf(rawoutstream, "\n"); } - } - free(buf); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; -} -/*------------------------------------------------------------------------- - * Function: xml_dump_dataset - * - * Purpose: Dump a description of an HDF5 dataset in XML. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * Pedro Vicente, October 9, 2007 - * added parameters to H5Aiterate2 to allow for other iteration orders - * - *------------------------------------------------------------------------- - */ -static void -xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) -{ - hid_t type; - hid_t space; - hid_t dcpl; - H5D_fill_value_t fvstatus; - int maxdims; - hsize_t *chsize; - int ndims; - int i; - H5D_alloc_time_t at; - H5D_fill_time_t ft; - hsize_t tempi; - char *tmp; - char *t_name; - char *t_tmp; - char *t_prefix; - unsigned attr_crt_order_flags; - char *rstr = (char *)HDmalloc(100); - char *pstr = (char *)HDmalloc(100); - - tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); - HDstrcpy(tmp, prefix); - HDstrcat(tmp, "/"); - HDstrcat(tmp, name); - indentation(indent); - - t_name = xml_escape_the_name(name); - t_tmp = xml_escape_the_name(tmp); - t_prefix = xml_escape_the_name(prefix); - - xml_name_to_XID(tmp, rstr, 100, 1); - xml_name_to_XID(prefix, pstr, 100, 1); - HDfprintf(stdout, "<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">\n", - xmlnsprefix, t_name, rstr, t_tmp, pstr, - strcmp(prefix, "") ? t_prefix : "/"); - - HDfree(t_name); - HDfree(t_tmp); - HDfree(t_prefix); - HDfree(rstr); - HDfree(pstr); - HDfree(tmp); - - dcpl = H5Dget_create_plist(did); - type = H5Dget_type(did); - space = H5Dget_space(did); - - /* query the creation properties for attributes */ - H5Pget_attr_creation_order(dcpl, &attr_crt_order_flags); - - /* Print information about storage layout */ - if(H5D_CHUNKED == H5Pget_layout(dcpl)) { - maxdims = H5Sget_simple_extent_ndims(space); - chsize = (hsize_t *)malloc(maxdims * sizeof(hsize_t)); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sStorageLayout>\n",xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sChunkedLayout ",xmlnsprefix); - ndims = H5Pget_chunk(dcpl, maxdims, chsize); - HDfprintf(stdout, "Ndims=\"%d\">\n", ndims); - - indent += COL; - - for (i = 0; i < ndims; i++) { - indentation(indent); - HDfprintf(stdout, "<%sChunkDimension DimSize=\"%Hu\" />\n", xmlnsprefix, chsize[i]); + if(H5Gclose(gid) < 0) { + error_msg("unable to close root group\n"); + h5tools_setstatus(EXIT_FAILURE); } - indentation(indent); - HDfprintf(stdout, "<%sRequiredFilter>\n",xmlnsprefix); - indent += COL; - check_filters(dcpl); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - - indent -= COL; - - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - free(chsize); } - else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl)) { - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sStorageLayout>\n",xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sContiguousLayout/>\n",xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - indentation(indent); - } - else if (H5D_COMPACT == H5Pget_layout(dcpl)) { - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sStorageLayout>\n",xmlnsprefix); - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sCompactLayout/>\n",xmlnsprefix); - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - indentation(indent); - } - /* and check for external.... ?? */ - - /* fill value */ - - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sFillValueInfo ",xmlnsprefix); - H5Pget_fill_time(dcpl, &ft); - HDfprintf(stdout, "FillTime=\""); - switch ( ft ) { - case H5D_FILL_TIME_ALLOC: - HDfprintf(stdout, "FillOnAlloc"); - break; - case H5D_FILL_TIME_NEVER: - HDfprintf(stdout, "FillNever"); - break; - case H5D_FILL_TIME_IFSET: - HDfprintf(stdout, "FillIfSet"); - break; - default: - HDfprintf(stdout, "?"); - break; - } - HDfprintf(stdout, "\" "); - H5Pget_alloc_time(dcpl, &at); - HDfprintf(stdout, "AllocationTime=\""); - switch ( at ) { - case H5D_ALLOC_TIME_EARLY: - HDfprintf(stdout, "Early"); - break; - case H5D_ALLOC_TIME_INCR: - HDfprintf(stdout, "Incremental"); - break; - case H5D_ALLOC_TIME_LATE: - HDfprintf(stdout, "Late"); - break; - case H5D_ALLOC_TIME_DEFAULT: - default: - HDfprintf(stdout, "?"); - break; - } - HDfprintf(stdout, "\""); - HDfprintf(stdout, ">\n"); - - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sFillValue>\n",xmlnsprefix); - indent += COL; - H5Pfill_value_defined(dcpl, &fvstatus); - if (fvstatus == H5D_FILL_VALUE_UNDEFINED || - (fvstatus==H5D_FILL_VALUE_DEFAULT && ft==H5D_FILL_TIME_IFSET)) { - indentation(indent + COL); - HDfprintf(stdout, "<%sNoFill/>\n",xmlnsprefix); - } - else { - xml_dump_fill_value(dcpl,type); - } - - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - - indent -= COL; - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indent -= COL; - - dump_function_table->dump_dataspace_function(space); - dump_function_table->dump_datatype_function(type); - - indent += COL; - - if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { - if(H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg("error getting attribute information\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end if */ - } /* end if */ else { - if(H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg("error getting attribute information\n"); + /* Note: this option is not supported for XML */ + if(doxml) { + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); + goto done; } /* end if */ - } /* end else */ - - indent -= COL; - tempi = H5Dget_storage_size(did); - - if (display_data && (tempi > 0)) { - switch (H5Tget_class(type)) { - case H5T_INTEGER: - case H5T_FLOAT: - case H5T_STRING: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_ENUM: - case H5T_ARRAY: - dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); - break; - - case H5T_TIME: - indent += COL; - indentation(indent); - HDfprintf(stdout, "<%sData>\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "<%sData>\n",xmlnsprefix); - indent -= COL; - break; - - case H5T_COMPOUND: - indentation(indent); - HDfprintf(stdout, "\n"); - dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); - break; - case H5T_REFERENCE: - indentation(indent); - HDfprintf(stdout, "<%sData>\n",xmlnsprefix); - indentation(indent); - if (!H5Tequal(type, H5T_STD_REF_OBJ)) { - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "<%sNoData />\n",xmlnsprefix); - } - else { - HDfprintf(stdout, "<%sDataFromFile>\n",xmlnsprefix); - xml_print_refs(did, DATASET_DATA); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); + for(i = 0; i < argc; i++) { + if(hand[i].func) { + hand[i].func(fid, hand[i].obj, hand[i].subset_info, 1, NULL); } - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; - - case H5T_VLEN: - HDfprintf(stdout, "\n"); - dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); - break; - default: - indentation(indent); - HDfprintf(stdout, "<%sData>\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n", H5Tget_class(type)); - indentation(indent); - HDfprintf(stdout, "<%sNoData/>\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - break; } + HDfprintf(rawoutstream, "\n"); } - else { - /* no data written */ - indentation(indent + COL); - HDfprintf(stdout, "<%sData>\n",xmlnsprefix); - indentation(indent + COL + COL); - HDfprintf(stdout, "<%sNoData/>\n",xmlnsprefix); - indentation(indent + COL); - HDfprintf(stdout, "\n",xmlnsprefix); - } - - H5Tclose(type); - H5Sclose(space); - H5Pclose(dcpl); - indentation(indent); - HDfprintf(stdout, "\n", xmlnsprefix); -} -/*------------------------------------------------------------------------- - * Function: xml_print_enum - * - * Purpose: Print the values of an HDF5 ENUM in XML. - * Very similar to regular DDL output. - * - * Return: void - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static void -xml_print_enum(hid_t type) -{ - char **name = NULL; /*member names */ - unsigned char *value = NULL; /*value array */ - unsigned nmembs; /*number of members */ - hid_t super; /*enum base integer type */ - hid_t native = -1; /*native integer datatype */ - size_t dst_size; /*destination value type size */ - unsigned i; /*miscellaneous counters */ - size_t j; - - nmembs = (unsigned)H5Tget_nmembers(type); - super = H5Tget_super(type); - - indentation(indent); - HDfprintf(stdout, "<%sDataType>\n",xmlnsprefix); - xml_print_datatype(super,0); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - - /* - * Determine what datatype to use for the native values. To simplify - * things we entertain three possibilities: - * 1. long long -- the largest native signed integer - * 2. unsigned long long -- the largest native unsigned integer - * 3. raw format - */ - if (H5Tget_size(type) <= sizeof(long long)) { - dst_size = sizeof(long long); - - if (H5T_SGN_NONE == H5Tget_sign(type)) { - native = H5T_NATIVE_ULLONG; - } - else { - native = H5T_NATIVE_LLONG; - } + if (!doxml) { + end_obj(h5tools_dump_header_format->fileend, h5tools_dump_header_format->fileblockend); + HDfprintf(rawoutstream, "\n"); } else { - dst_size = H5Tget_size(type); + HDfprintf(rawoutstream, "\n", xmlnsprefix); } - /* Get the names and raw values of all members */ - name = (char **)calloc(nmembs, sizeof(char *)); - value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size)); +done: + /* Free tables for objects */ + table_list_free(); - for (i = 0; i < nmembs; i++) { - name[i] = H5Tget_member_name(type, i); - H5Tget_member_value(type, i, value + i * H5Tget_size(type)); - } + if(hand) + free_handler(hand, argc); - /* Convert values to native datatype */ - if (native > 0) - H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT); - - /* Sort members by increasing value */ - /*not implemented yet */ - - /* Print members */ - indent += COL; - for (i = 0; i < nmembs; i++) { - char *t_name = xml_escape_the_name(name[i]); - - indentation(indent); - HDfprintf(stdout, "<%sEnumElement>\n",xmlnsprefix); - indentation(indent + COL); - HDfprintf(stdout, "%s\n", t_name); - free(t_name); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); - indentation(indent); - HDfprintf(stdout, "<%sEnumValue>\n",xmlnsprefix); - indentation(indent + COL); - if (native < 0) { - HDfprintf(stdout, "0x"); - - for (j = 0; j < dst_size; j++) - HDfprintf(stdout, "%02x", value[i * dst_size + j]); - } - else if (H5T_SGN_NONE == H5Tget_sign(native)) { - HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *) - ((void *) (value + i * dst_size)))); - } - else { - HDfprintf(stdout,"%" H5_PRINTF_LL_WIDTH "d", - *((long long *) ((void *) (value + i * dst_size)))); - } - HDfprintf(stdout, "\n"); - indentation(indent); - HDfprintf(stdout, "\n",xmlnsprefix); + if(fid >=0) + if (H5Fclose(fid) < 0) + h5tools_setstatus(EXIT_FAILURE); + + if(prefix) + HDfree(prefix); + if(fname) + HDfree(fname); - } - indent -= COL; + /* To Do: clean up XML table */ - /* Release resources */ - for (i = 0; i < nmembs; i++) - free(name[i]); + H5Eset_auto2(H5E_DEFAULT, func, edata); - free(name); - free(value); - H5Tclose(super); + leave(h5tools_getstatus()); } - /*------------------------------------------------------------------------- * Function: h5_fileaccess * @@ -7327,14 +1639,14 @@ xml_print_enum(hid_t type) * *------------------------------------------------------------------------- */ -static hid_t +hid_t h5_fileaccess(void) { static const char *multi_letters = "msbrglo"; const char *val = NULL; const char *name; - char s[1024]; - hid_t fapl = -1; + char s[1024]; + hid_t fapl = -1; /* First use the environment variable, then the constant */ val = HDgetenv("HDF5_DRIVER"); @@ -7363,24 +1675,24 @@ h5_fileaccess(void) } else if (!HDstrcmp(name, "split")) { /* Split meta data and raw data each using default driver */ - if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT)<0) + if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) return -1; } else if (!HDstrcmp(name, "multi")) { /* Multi-file driver, general case of the split driver */ - H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; - const char *memb_name[H5FD_MEM_NTYPES]; - char sv[H5FD_MEM_NTYPES][1024]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; - H5FD_mem_t mt; + H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; + hid_t memb_fapl[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + char sv[H5FD_MEM_NTYPES][1024]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; + H5FD_mem_t mt; HDmemset(memb_map, 0, sizeof memb_map); HDmemset(memb_fapl, 0, sizeof memb_fapl); HDmemset(memb_name, 0, sizeof memb_name); HDmemset(memb_addr, 0, sizeof memb_addr); - assert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); + HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); for (mt=H5FD_MEM_DEFAULT; mt +#include + +#include "H5private.h" +#include "h5tools.h" +#include "h5tools_dump.h" +#include "h5tools_utils.h" +#include "h5tools_ref.h" +#include "h5trav.h" +#include "h5dump_extern.h" +#include "h5dump_ddl.h" + +/*------------------------------------------------------------------------- + * Function: dump_datatype + * + * Purpose: Dump the datatype. Datatype can be HDF5 predefined + * atomic datatype or committed/transient datatype. + * + * Return: void + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +dump_datatype(hid_t type) +{ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + h5dump_type_table = type_table; + h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type); + h5dump_type_table = NULL; +} + +/*------------------------------------------------------------------------- + * Function: dump_dataspace + * + * Purpose: Dump the dataspace. Dataspace can be named dataspace, + * array, or others. + * + * Return: void + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +dump_dataspace(hid_t space) +{ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space); +} + + +/*------------------------------------------------------------------------- + * Function: dump_attr_cb + * + * Purpose: attribute function callback called by H5Aiterate2, displays the attribute + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Ruey-Hsia Li + * + * Modifications: Pedro Vicente, October 4, 2007 + * Added H5A_info_t parameter to conform with H5Aiterate2 + * + *------------------------------------------------------------------------- + */ +herr_t +dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t UNUSED *info, void UNUSED *_op_data) +{ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + + hid_t attr_id; + herr_t ret = SUCCEED; + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT); + oid_output = display_oid; + data_output = display_data; + attr_data_output = display_attr_data; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + h5dump_type_table = type_table; + h5tools_dump_attribute(rawoutstream, outputformat, &ctx, oid, attr_name, attr_id, display_ai, display_char); + h5dump_type_table = NULL; + + if(attr_id < 0) { + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + + return ret; +} + +/*------------------------------------------------------------------------- + * Function: dump_all_cb + * + * Purpose: function callback called by H5Literate, + * displays everything in the specified object + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * RMcG, November 2000 + * Added XML support. Also, optionally checks the op_data argument + * + * PVN, May 2008 + * Dump external links + * + *------------------------------------------------------------------------- + */ +herr_t +dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED *op_data) +{ + hid_t obj; + herr_t ret = SUCCEED; + char *obj_path = NULL; /* Full path of object */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + /* Build the object's path name */ + obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + if(!obj_path) { + ret = FAIL; + goto done; + } + + HDstrcpy(obj_path, prefix); + HDstrcat(obj_path, "/"); + HDstrcat(obj_path, name); + + if(linfo->type == H5L_TYPE_HARD) { + H5O_info_t oinfo; + + /* Stat the object */ + if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) { + error_msg("unable to get object information for \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + goto done; + } /* end if */ + + switch(oinfo.type) { + case H5O_TYPE_GROUP: + if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) { + error_msg("unable to dump group \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + char *old_prefix; /* Pointer to previous prefix */ + + /* Keep copy of prefix before iterating into group */ + old_prefix = HDstrdup(prefix); + HDassert(old_prefix); + + /* Append group name to prefix */ + add_prefix(&prefix, &prefix_len, name); + + /* Iterate into group */ + dump_function_table->dump_group_function(obj, name); + + /* Restore old prefix name */ + HDstrcpy(prefix, old_prefix); + HDfree(old_prefix); + + /* Close group */ + H5Gclose(obj); + } + break; + + case H5O_TYPE_DATASET: + if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { + if(oinfo.rc > 1 || hit_elink) { + obj_t *found_obj; /* Found object */ + + found_obj = search_obj(dset_table, oinfo.addr); + + if(found_obj == NULL) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->datasetbegin, name, + h5tools_dump_header_format->datasetblockbegin); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(HDstrlen(h5tools_dump_header_format->datasetblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend); + if(HDstrlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, " "); + } + if(HDstrlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + H5Dclose(obj); + goto done; + } + else if(found_obj->displayed) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->datasetbegin, name, + h5tools_dump_header_format->datasetblockbegin); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(HDstrlen(h5tools_dump_header_format->datasetblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend); + if(HDstrlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, " "); + } + if(HDstrlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + H5Dclose(obj); + goto done; + } + else { + found_obj->displayed = TRUE; + } + } /* end if */ + + dump_function_table->dump_dataset_function(obj, name, NULL); + H5Dclose(obj); + } + else { + error_msg("unable to dump dataset \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + break; + + case H5O_TYPE_NAMED_DATATYPE: + if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) { + error_msg("unable to dump datatype \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + dump_function_table->dump_named_datatype_function(obj, name); + H5Tclose(obj); + } + break; + + default: + error_msg("unknown object \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + } /* end if */ + else { + char *targbuf; + + switch(linfo->type) { + case H5L_TYPE_SOFT: + targbuf = (char *)HDmalloc(linfo->u.val_size); + HDassert(targbuf); + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->softlinkbegin, name, + h5tools_dump_header_format->softlinkblockbegin); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + + if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { + error_msg("unable to get link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + /* print the value of a soft link */ + /* Standard DDL: no modification */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "LINKTARGET \"%s\"", targbuf); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(HDstrlen(h5tools_dump_header_format->softlinkblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkblockend); + if(HDstrlen(h5tools_dump_header_format->softlinkend)) + h5tools_str_append(&buffer, " "); + } + if(HDstrlen(h5tools_dump_header_format->softlinkend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(targbuf); + break; + + case H5L_TYPE_EXTERNAL: + targbuf = (char *)HDmalloc(linfo->u.val_size); + HDassert(targbuf); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->extlinkbegin, name, + h5tools_dump_header_format->extlinkblockbegin); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { + indentation(dump_indent); + error_msg("unable to get external link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } /* end if */ + else { + const char *filename; + const char *targname; + + if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) { + indentation(dump_indent); + error_msg("unable to unpack external link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } /* end if */ + else { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "TARGETFILE \"%s\"", filename); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "TARGETPATH \"%s\"", targname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* dump the external link */ + dump_extlink(group, name, targname); + ctx.indent_level--; + } /* end else */ + } /* end else */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(HDstrlen(h5tools_dump_header_format->extlinkblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkblockend); + if(HDstrlen(h5tools_dump_header_format->extlinkend)) + h5tools_str_append(&buffer, " "); + } + if(HDstrlen(h5tools_dump_header_format->extlinkend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(targbuf); + break; + + default: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->udlinkbegin, name, + h5tools_dump_header_format->udlinkblockbegin); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "LINKCLASS %d", linfo->type); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + if(HDstrlen(h5tools_dump_header_format->udlinkblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkblockend); + if(HDstrlen(h5tools_dump_header_format->udlinkend)) + h5tools_str_append(&buffer, " "); + } + if(HDstrlen(h5tools_dump_header_format->udlinkend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkend); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + break; + } /* end switch */ + } /* end else */ + +done: + + h5tools_str_close(&buffer); + + if(obj_path) + HDfree(obj_path); + return ret; +} + +/*------------------------------------------------------------------------- + * Function: dump_named_datatype + * + * Purpose: Dump named datatype + * + * Return: void + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * Pedro Vicente, March 27, 2006 + * added display of attributes + * Pedro Vicente, October 4, 2007, added parameters to H5Aiterate2() to allow for + * other iteration orders + * + *------------------------------------------------------------------------- + */ +void +dump_named_datatype(hid_t tid, const char *name) +{ + H5O_info_t oinfo; + unsigned attr_crt_order_flags; + hid_t tcpl_id = -1; /* datatype creation property list ID */ + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + if ((tcpl_id = H5Tget_create_plist(tid)) < 0) { + error_msg("error in getting creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* query the creation properties for attributes */ + if (H5Pget_attr_creation_order(tcpl_id, &attr_crt_order_flags) < 0) { + error_msg("error in getting creation properties\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + if(H5Pclose(tcpl_id) < 0) { + error_msg("error in closing creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->datatypebegin, name, + h5tools_dump_header_format->datatypeblockbegin); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + H5Oget_info(tid, &oinfo); + + /* Must check for uniqueness of all objects if we've traversed an elink, + * otherwise only check if the reference count > 1. + */ + if(oinfo.rc > 1 || hit_elink) { + obj_t *found_obj; /* Found object */ + + found_obj = search_obj(type_table, oinfo.addr); + + if (found_obj == NULL) { + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if (found_obj->displayed) { + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + goto done; + } + else + found_obj->displayed = TRUE; + } /* end if */ + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_print_datatype(rawoutstream, &buffer, outputformat, &ctx, tid, FALSE); + + if(H5Tget_class(tid) != H5T_COMPOUND) { + h5tools_str_append(&buffer, ";"); + } + + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* print attributes */ + dump_indent += COL; + + /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set + in the datatype's create property list for attributes, then, sort by creation order, otherwise by name */ + + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if(H5Aiterate2(tid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end if */ + else { + if(H5Aiterate2(tid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end else */ + + dump_indent -= COL; + +done: + /* Render the element */ + h5tools_str_reset(&buffer); + if(HDstrlen(h5tools_dump_header_format->datatypeblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeblockend); + if(HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(&buffer, " "); + } + if(HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_group + * + * Purpose: Dump everything within the specified group + * + * Return: void + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * + * Call to dump_all_cb -- add parameter to select everything. + * + * Pedro Vicente, October 1, 2007 + * handle several iteration orders for attributes and groups + * + *------------------------------------------------------------------------- + */ +void +dump_group(hid_t gid, const char *name) +{ + H5O_info_t oinfo; + hid_t dset; + hid_t type; + hid_t gcpl_id; + unsigned crt_order_flags; + unsigned attr_crt_order_flags; + char type_name[1024]; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { + error_msg("error in getting group creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* query the group creation properties for attributes */ + if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) { + error_msg("error in getting group creation properties\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* query the group creation properties */ + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { + error_msg("error in getting group creation properties\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + if(H5Pclose(gcpl_id) < 0) { + error_msg("error in closing group creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->groupbegin, name, + h5tools_dump_header_format->groupblockbegin); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + dump_indent += COL; + + if(!HDstrcmp(name, "/") && unamedtype) { + unsigned u; /* Local index variable */ + + /* dump unamed type in root group */ + for(u = 0; u < type_table->nobjs; u++) + if(!type_table->objs[u].recorded) { + dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); + type = H5Dget_type(dset); + sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + dump_function_table->dump_named_datatype_function(type, type_name); + H5Tclose(type); + H5Dclose(dset); + } + } /* end if */ + + if(display_oid) { + h5tools_dump_oid(rawoutstream, outputformat, &ctx, gid); + } + + h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid); + + H5Oget_info(gid, &oinfo); + + /* Must check for uniqueness of all objects if we've traversed an elink, + * otherwise only check if the reference count > 1. + */ + if(oinfo.rc > 1 || hit_elink) { + obj_t *found_obj; /* Found object */ + + found_obj = search_obj(group_table, oinfo.addr); + + if (found_obj == NULL) { + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + } + else if (found_obj->displayed) { + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + found_obj->displayed = TRUE; + /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set + in the group for attributes, then, sort by creation order, otherwise by name */ + + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end if */ + else { + if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end else */ + + /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set + in the group, then, sort by creation order, otherwise by name */ + if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) + H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); + else + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); + } + } + else { + /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set + in the group for attributes, then, sort by creation order, otherwise by name */ + + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end if */ + else { + if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end else */ + + /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set + in the group, then, sort by creation order, otherwise by name */ + if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) + H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); + else + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); + } + + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(HDstrlen(h5tools_dump_header_format->groupblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupblockend); + if(HDstrlen(h5tools_dump_header_format->groupend)) + h5tools_str_append(&buffer, " "); + } + if(HDstrlen(h5tools_dump_header_format->groupend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupend); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_dataset + * + * Purpose: Dump the specified data set + * + * Return: void + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * Pedro Vicente, 2004, added dataset creation property list display + * Pedro Vicente, October 4, 2007, added parameters to H5Aiterate2() to allow for + * other iteration orders + * + *------------------------------------------------------------------------- + */ +void +dump_dataset(hid_t did, const char *name, struct subset_t *sset) +{ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + hid_t type, space; + unsigned attr_crt_order_flags; + hid_t dcpl_id; /* dataset creation property list ID */ + h5tools_str_t buffer; /* string into which to render */ + hsize_t curr_pos = 0; /* total data element position */ + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + if ((dcpl_id = H5Dget_create_plist(did)) < 0) { + error_msg("error in getting creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* query the creation properties for attributes */ + if (H5Pget_attr_creation_order(dcpl_id, &attr_crt_order_flags) < 0) { + error_msg("error in getting creation properties\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->datasetbegin, name, + h5tools_dump_header_format->datasetblockbegin); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_dump_comment(rawoutstream, outputformat, &ctx, did); + + dump_indent += COL; + ctx.indent_level++; + + type = H5Dget_type(did); + h5dump_type_table = type_table; + h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type); + h5dump_type_table = NULL; + + space = H5Dget_space(did); + h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space); + H5Sclose(space); + + if(display_oid) { + h5tools_dump_oid(rawoutstream, outputformat, &ctx, did); + } + + if(display_dcpl) { + h5dump_type_table = type_table; + h5tools_dump_dcpl(rawoutstream, outputformat, &ctx, dcpl_id, type, did); + h5dump_type_table = NULL; + } + H5Pclose(dcpl_id); + + if(display_data) { + int data_loop = 1; + int i; + if(display_packed_bits) + data_loop = packed_bits_num; + for(i=0; iline_ncols, 0, 0); + } + switch(H5Tget_class(type)) { + case H5T_TIME: + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "DATA{ not yet implemented.}"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + break; + + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_COMPOUND: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + { + h5tools_dump_data(rawoutstream, outputformat, &ctx, did, TRUE, sset, display_ai, display_char); + } + break; + + default: + break; + } /* end switch */ + } /* for(i=0;idatasetblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend); + if(HDstrlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, " "); + } + if(HDstrlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_data + * + * Purpose: Dump attribute or dataset data + * + * Return: void + * + * Programmer: Ruey-Hsia Li + * + * Modifications: pvn, print the matrix indices + * Albert Cheng, 2004/11/18 + * Add --string printing for attributes too. + * + *------------------------------------------------------------------------- + */ +void +dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) +{ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + int print_dataset = FALSE; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + if(obj_data == DATASET_DATA) + print_dataset = TRUE; + h5tools_dump_data(rawoutstream, outputformat, &ctx, obj_id, print_dataset, sset, display_index, display_char); +} + + +/*------------------------------------------------------------------------- + * Function: dump_fcpl + * + * Purpose: prints file creation property list information + * + * Return: void + * + * Programmer: pvn + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +dump_fcpl(hid_t fid) +{ + hid_t fcpl; /* file creation property list ID */ + hsize_t userblock; /* userblock size retrieved from FCPL */ + size_t off_size; /* size of offsets in the file */ + size_t len_size; /* size of lengths in the file */ + unsigned super; /* superblock version # */ + unsigned freelist; /* free list version # */ + unsigned stab; /* symbol table entry version # */ + unsigned shhdr; /* shared object header version # */ +#ifdef SHOW_FILE_DRIVER + hid_t fapl; /* file access property list ID */ + hid_t fdriver; /* file driver */ + char dname[32]; /* buffer to store driver name */ +#endif + unsigned sym_lk; /* symbol table B-tree leaf 'K' value */ + unsigned sym_ik; /* symbol table B-tree internal 'K' value */ + unsigned istore_ik; /* indexed storage B-tree internal 'K' value */ + + fcpl=H5Fget_create_plist(fid); + H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr); + H5Pget_userblock(fcpl,&userblock); + H5Pget_sizes(fcpl,&off_size,&len_size); + H5Pget_sym_k(fcpl,&sym_ik,&sym_lk); + H5Pget_istore_k(fcpl,&istore_ik); + H5Pclose(fcpl); +#ifdef SHOW_FILE_DRIVER + fapl=h5_fileaccess(); + fdriver=H5Pget_driver(fapl); + H5Pclose(fapl); +#endif + + /*------------------------------------------------------------------------- + * SUPER_BLOCK + *------------------------------------------------------------------------- + */ + HDfprintf(rawoutstream, "\n%s %s\n",SUPER_BLOCK, BEGIN); + indentation(dump_indent + COL); + HDfprintf(rawoutstream, "%s %u\n","SUPERBLOCK_VERSION", super); + indentation(dump_indent + COL); + HDfprintf(rawoutstream, "%s %u\n","FREELIST_VERSION", freelist); + indentation(dump_indent + COL); + HDfprintf(rawoutstream, "%s %u\n","SYMBOLTABLE_VERSION", stab); + indentation(dump_indent + COL); + HDfprintf(rawoutstream, "%s %u\n","OBJECTHEADER_VERSION", shhdr); + indentation(dump_indent + COL); + HDfprintf(rawoutstream,"%s %Hd\n","OFFSET_SIZE", (long long)off_size); + indentation(dump_indent + COL); + HDfprintf(rawoutstream,"%s %Hd\n","LENGTH_SIZE", (long long)len_size); + indentation(dump_indent + COL); + HDfprintf(rawoutstream, "%s %u\n","BTREE_RANK", sym_ik); + indentation(dump_indent + COL); + HDfprintf(rawoutstream, "%s %d\n","BTREE_LEAF", sym_lk); + +#ifdef SHOW_FILE_DRIVER + if (H5FD_CORE==fdriver) + HDstrcpy(dname,"H5FD_CORE"); +#ifdef H5_HAVE_DIRECT + else if (H5FD_DIRECT==fdriver) + HDstrcpy(dname,"H5FD_DIRECT"); +#endif + else if (H5FD_FAMILY==fdriver) + HDstrcpy(dname,"H5FD_FAMILY"); + else if (H5FD_LOG==fdriver) + HDstrcpy(dname,"H5FD_LOG"); + else if (H5FD_MPIO==fdriver) + HDstrcpy(dname,"H5FD_MPIO"); + else if (H5FD_MULTI==fdriver) + HDstrcpy(dname,"H5FD_MULTI"); + else if (H5FD_SEC2==fdriver) + HDstrcpy(dname,"H5FD_SEC2"); + else if (H5FD_STDIO==fdriver) + HDstrcpy(dname,"H5FD_STDIO"); +#ifdef H5_HAVE_STREAM + else if (H5FD_STREAM==fdriver) + HDstrcpy(dname,"H5FD_STREAM"); +#endif + else + HDstrcpy(dname,"Unknown driver"); + + /* Take out this because the driver used can be different from the + * standard output. */ + /*indentation(dump_indent + COL); + HDfprintf(rawoutstream, "%s %s\n","FILE_DRIVER", dname);*/ +#endif + indentation(dump_indent + COL); + HDfprintf(rawoutstream, "%s %u\n","ISTORE_K", istore_ik); + + /*------------------------------------------------------------------------- + * USER_BLOCK + *------------------------------------------------------------------------- + */ + indentation(dump_indent + COL); + HDfprintf(rawoutstream, "USER_BLOCK %s\n",BEGIN); + indentation(dump_indent + COL + COL); + HDfprintf(rawoutstream,"%s %Hu\n","USERBLOCK_SIZE", userblock); + indentation(dump_indent + COL); + HDfprintf(rawoutstream, "%s\n",END); + + HDfprintf(rawoutstream, "%s",END); +} + +/*------------------------------------------------------------------------- + * Function: dump_fcontents + * + * Purpose: prints all objects + * + * Return: void + * + * Programmer: pvn + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +dump_fcontents(hid_t fid) +{ + HDfprintf(rawoutstream, "%s %s\n",FILE_CONTENTS, BEGIN); + + /* special case of unamed types in root group */ + if (unamedtype) { + unsigned u; + + for (u = 0; u < type_table->nobjs; u++) { + if (!type_table->objs[u].recorded) + HDfprintf(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno); + } + } + + /* print objects in the files */ + h5trav_print(fid); + + HDfprintf(rawoutstream, " %s\n",END); +} + +/*------------------------------------------------------------------------- + * Function: handle_attributes + * + * Purpose: Handle the attributes from the command. + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 9. January 2001 + * + * Modifications: + * + * PVN, May 2008 + * add an extra parameter PE, to allow printing/not printing of error messages + * + *------------------------------------------------------------------------- + */ +void +handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe, const char UNUSED *display_name) +{ + hid_t oid = -1; + hid_t attr_id = -1; + char *obj_name; + const char *attr_name; + int j; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &h5tools_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + j = (int)HDstrlen(attr) - 1; + obj_name = (char *)HDmalloc((size_t)j + 2); + if(obj_name == NULL) + goto error; + + /* find the last / */ + while(j >= 0) { + if (attr[j] == '/') + break; + j--; + } + + /* object name */ + if(j == -1) + HDstrcpy(obj_name, "/"); + else { + HDstrncpy(obj_name, attr, (size_t)j + 1); + obj_name[j + 1] = '\0'; + } /* end else */ + + dump_indent += COL; + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + attr_name = attr + j + 1; + + /* Open the object with the attribute */ + if((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) { + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->attributebegin, attr, + h5tools_dump_header_format->attributeblockbegin); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + error_msg("unable to open object \"%s\"\n", obj_name); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + /* Render the element */ + h5tools_str_reset(&buffer); + if(HDstrlen(h5tools_dump_header_format->attributeblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeblockend); + if(HDstrlen(h5tools_dump_header_format->attributeend)) + h5tools_str_append(&buffer, " "); + } + if(HDstrlen(h5tools_dump_header_format->attributeend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); + + goto error; + } /* end if */ + + attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT); + oid_output = display_oid; + data_output = display_data; + attr_data_output = display_attr_data; + + h5dump_type_table = type_table; + h5tools_dump_attribute(rawoutstream, outputformat, &ctx, oid, attr, attr_id, display_ai, display_char); + h5dump_type_table = NULL; + + if(attr_id < 0) { + goto error; + } + + /* Close object */ + if(H5Oclose(oid) < 0) { + goto error; + } /* end if */ + + HDfree(obj_name); + dump_indent -= COL; + return; + +error: + h5tools_setstatus(EXIT_FAILURE); + if(obj_name) + HDfree(obj_name); + + H5E_BEGIN_TRY { + H5Oclose(oid); + H5Aclose(attr_id); + } H5E_END_TRY; + dump_indent -= COL; +} + +/*------------------------------------------------------------------------- + * Function: handle_datasets + * + * Purpose: Handle the datasets from the command. + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 9. January 2001 + * + * Modifications: + * Pedro Vicente, Tuesday, January 15, 2008 + * check for block overlap\ + * + * Pedro Vicente, May 8, 2008 + * added a flag PE that prints/not prints error messages + * added for cases of external links not found, to avoid printing of + * objects not found, since external links are dumped on a trial error basis + * + *------------------------------------------------------------------------- + */ +void +handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name) +{ + H5O_info_t oinfo; + hid_t dsetid; + struct subset_t *sset = (struct subset_t *)data; + const char *real_name = display_name ? display_name : dset; + + if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) { + if (pe) { + HDfprintf(rawoutstream, "\n"); + begin_obj(h5tools_dump_header_format->datasetbegin, real_name, h5tools_dump_header_format->datasetblockbegin); + HDfprintf(rawoutstream, "\n"); + indentation(COL); + error_msg("unable to open dataset \"%s\"\n", real_name); + end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend); + h5tools_setstatus(EXIT_FAILURE); + } + return; + } /* end if */ + + if(sset) { + unsigned int i; + hid_t sid = H5Dget_space(dsetid); + int ndims = H5Sget_simple_extent_ndims(sid); + + H5Sclose(sid); + if(ndims < 0) { + error_msg("H5Sget_simple_extent_ndims failed\n"); + h5tools_setstatus(EXIT_FAILURE); + return; + } + + if(!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) { + /* they didn't specify a ``stride'' or ``block''. default to 1 in all + * dimensions */ + if(!sset->start.data) { + /* default to (0, 0, ...) for the start coord */ + sset->start.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t)); + sset->start.len = ndims; + } + + if(!sset->stride.data) { + sset->stride.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t)); + sset->stride.len = ndims; + for (i = 0; i < ndims; i++) + sset->stride.data[i] = 1; + } + + if(!sset->count.data) { + sset->count.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t)); + sset->count.len = ndims; + for (i = 0; i < ndims; i++) + sset->count.data[i] = 1; + } + + if(!sset->block.data) { + sset->block.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t)); + sset->block.len = ndims; + for (i = 0; i < ndims; i++) + sset->block.data[i] = 1; + } + } + + /*------------------------------------------------------------------------- + * check for dimension overflow + *------------------------------------------------------------------------- + */ + if(sset->start.len > ndims) { + error_msg("number of start dims (%u) exceed dataset dims (%u)\n", sset->start.len, ndims); + h5tools_setstatus(EXIT_FAILURE); + return; + } + if(sset->stride.len > ndims) { + error_msg("number of stride dims (%u) exceed dataset dims (%u)\n", sset->stride.len, ndims); + h5tools_setstatus(EXIT_FAILURE); + return; + } + if(sset->count.len > ndims) { + error_msg("number of count dims (%u) exceed dataset dims (%u)\n", sset->count.len, ndims); + h5tools_setstatus(EXIT_FAILURE); + return; + } + if(sset->block.len > ndims) { + error_msg("number of block dims (%u) exceed dataset dims (%u)\n", sset->block.len, ndims); + h5tools_setstatus(EXIT_FAILURE); + return; + } + + /*------------------------------------------------------------------------- + * check for block overlap + *------------------------------------------------------------------------- + */ + for(i = 0; i < ndims; i++) { + if(sset->count.data[i] > 1) { + if(sset->stride.data[i] < sset->block.data[i]) { + error_msg("wrong subset selection; blocks overlap\n"); + h5tools_setstatus(EXIT_FAILURE); + return; + } /* end if */ + } /* end if */ + } /* end for */ + } /* end if */ + + + H5Oget_info(dsetid, &oinfo); + if(oinfo.rc > 1 || hit_elink) { + obj_t *found_obj; /* Found object */ + + found_obj = search_obj(dset_table, oinfo.addr); + + if(found_obj) { + if (found_obj->displayed) { + HDfprintf(rawoutstream, "\n"); + indentation(dump_indent); + begin_obj(h5tools_dump_header_format->datasetbegin, real_name, h5tools_dump_header_format->datasetblockbegin); + HDfprintf(rawoutstream, "\n"); + indentation(dump_indent + COL); + HDfprintf(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname); + indentation(dump_indent); + end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend); + } + else { + found_obj->displayed = TRUE; + dump_indent += COL; + dump_dataset(dsetid, real_name, sset); + dump_indent -= COL; + } + } + else + h5tools_setstatus(EXIT_FAILURE); + } + else { + dump_indent += COL; + dump_dataset(dsetid, real_name, sset); + dump_indent -= COL; + } + + if(H5Dclose(dsetid) < 0) + h5tools_setstatus(EXIT_FAILURE); +} + +/*------------------------------------------------------------------------- + * Function: handle_groups + * + * Purpose: Handle the groups from the command. + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 9. January 2001 + * + * Modifications: Pedro Vicente, September 26, 2007 + * handle creation order + * + * Pedro Vicente, May 8, 2008 + * added a flag PE that prints/not prints error messages + * added for cases of external links not found, to avoid printing of + * objects not found, since external links are dumped on a trial error basis + * + *------------------------------------------------------------------------- + */ +void +handle_groups(hid_t fid, const char *group, void UNUSED *data, int pe, const char *display_name) +{ + hid_t gid; + const char *real_name = display_name ? display_name : group; + + if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) { + if (pe) { + HDfprintf(rawoutstream, "\n"); + begin_obj(h5tools_dump_header_format->groupbegin, real_name, h5tools_dump_header_format->groupblockbegin); + HDfprintf(rawoutstream, "\n"); + indentation(COL); + error_msg("unable to open group \"%s\"\n", real_name); + end_obj(h5tools_dump_header_format->groupend, h5tools_dump_header_format->groupblockend); + h5tools_setstatus(EXIT_FAILURE); + } + } + else { + size_t new_len = HDstrlen(group) + 1; + + if(prefix_len <= new_len) { + prefix_len = new_len; + prefix = (char *)HDrealloc(prefix, prefix_len); + } /* end if */ + + HDstrcpy(prefix, group); + + dump_indent += COL; + dump_group(gid, real_name); + dump_indent -= COL; + + if(H5Gclose(gid) < 0) + h5tools_setstatus(EXIT_FAILURE); + } /* end else */ +} /* end handle_groups() */ + +/*------------------------------------------------------------------------- + * Function: handle_links + * + * Purpose: Handle soft or UD links from the command. + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 9. January 2001 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, const char UNUSED *display_name) +{ + H5L_info_t linfo; + + if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) { + error_msg("unable to get link info from \"%s\"\n", links); + h5tools_setstatus(EXIT_FAILURE); + } + else if(linfo.type == H5L_TYPE_HARD) { + error_msg("\"%s\" is a hard link\n", links); + h5tools_setstatus(EXIT_FAILURE); + } + else { + char *buf = (char *)HDmalloc(linfo.u.val_size); + HDfprintf(rawoutstream, "\n"); + + switch(linfo.type) { + case H5L_TYPE_SOFT: /* Soft link */ + begin_obj(h5tools_dump_header_format->softlinkbegin, links, h5tools_dump_header_format->softlinkblockbegin); + HDfprintf(rawoutstream, "\n"); + indentation(COL); + if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) + HDfprintf(rawoutstream, "LINKTARGET \"%s\"\n", buf); + else { + error_msg("h5dump error: unable to get link value for \"%s\"\n", links); + h5tools_setstatus(EXIT_FAILURE); + } + end_obj(h5tools_dump_header_format->softlinkend, h5tools_dump_header_format->softlinkblockend); + break; + + case H5L_TYPE_EXTERNAL: + begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); + HDfprintf(rawoutstream, "\n"); + indentation(COL); + begin_obj(h5tools_dump_header_format->extlinkbegin, links, h5tools_dump_header_format->extlinkblockbegin); + HDfprintf(rawoutstream, "\n"); + if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) { + const char *elink_file; + const char *elink_path; + + if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path)>=0) { + indentation(COL); + HDfprintf(rawoutstream, "LINKCLASS %d\n", linfo.type); + indentation(COL); + HDfprintf(rawoutstream, "TARGETFILE \"%s\"\n", elink_file); + indentation(COL); + HDfprintf(rawoutstream, "TARGETPATH \"%s\"\n", elink_path); + } + else { + error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links); + h5tools_setstatus(EXIT_FAILURE); + } + } + else { + error_msg("h5dump error: unable to get external link value for \"%s\"\n", links); + h5tools_setstatus(EXIT_FAILURE); + } + end_obj(h5tools_dump_header_format->extlinkend, h5tools_dump_header_format->extlinkblockend); + break; + + default: + begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); + HDfprintf(rawoutstream, "\n"); + indentation(COL); + begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); + HDfprintf(rawoutstream, "\n"); + indentation(COL); + HDfprintf(rawoutstream, "LINKCLASS %d\n", linfo.type); + end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend); + break; + } /* end switch */ + HDfree(buf); + } /* end else */ +} + +/*------------------------------------------------------------------------- + * Function: handle_datatypes + * + * Purpose: Handle the datatypes from the command. + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 9. January 2001 + * + * Modifications: + * + * Pedro Vicente, May 8, 2008 + * added a flag PE that prints/not prints error messages + * added for cases of external links not found, to avoid printing of + * objects not found, since external links are dumped on a trial error basis + * + *------------------------------------------------------------------------- + */ +void +handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe, const char *display_name) +{ + hid_t type_id; + const char *real_name = display_name ? display_name : type; + + if((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) { + /* check if type is unamed datatype */ + unsigned idx = 0; + + while(idx < type_table->nobjs ) { + char name[128]; + + if(!type_table->objs[idx].recorded) { + /* unamed datatype */ + sprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno); + + if(!HDstrcmp(name, real_name)) + break; + } /* end if */ + + idx++; + } /* end while */ + + if(idx == type_table->nobjs) { + if (pe) { + /* unknown type */ + HDfprintf(rawoutstream, "\n"); + begin_obj(h5tools_dump_header_format->datatypebegin, real_name, h5tools_dump_header_format->datatypeblockbegin); + HDfprintf(rawoutstream, "\n"); + indentation(COL); + error_msg("unable to open datatype \"%s\"\n", real_name); + end_obj(h5tools_dump_header_format->datatypeend, h5tools_dump_header_format->datatypeblockend); + h5tools_setstatus(EXIT_FAILURE); + } + } + else { + hid_t dsetid = H5Dopen2(fid, type_table->objs[idx].objname, H5P_DEFAULT); + type_id = H5Dget_type(dsetid); + + dump_indent += COL; + dump_named_datatype(type_id, real_name); + dump_indent -= COL; + + H5Tclose(type_id); + H5Dclose(dsetid); + } + } + else { + dump_indent += COL; + dump_named_datatype(type_id, real_name); + dump_indent -= COL; + + if(H5Tclose(type_id) < 0) + h5tools_setstatus(EXIT_FAILURE); + } +} + + +/*------------------------------------------------------------------------- + * Function: dump_extlink + * + * made by: PVN + * + * Purpose: Dump an external link + * Since external links are soft links, they are dumped on a trial error + * basis, attempting to dump as a dataset, as a group and as a named datatype + * Error messages are supressed + * + * Modifications: + * Neil Fortner + * 13 October 2008 + * Function basically rewritten. No longer directly opens the target file, + * now initializes a new set of tables for the external file. No longer + * dumps on a trial and error basis, but errors are still suppressed. + * + *------------------------------------------------------------------------- + */ + + +static int dump_extlink(hid_t group, const char *linkname, const char *objname) +{ + hid_t oid; + H5O_info_t oi; + table_t *old_group_table = group_table; + table_t *old_dset_table = dset_table; + table_t *old_type_table = type_table; + hbool_t old_hit_elink; + ssize_t idx; + + /* Open target object */ + if ((oid = H5Oopen(group, linkname, H5P_DEFAULT)) < 0) + goto fail; + + /* Get object info */ + if (H5Oget_info(oid, &oi) < 0) { + H5Oclose(oid); + goto fail; + } + + /* Check if we have visited this file already */ + if ((idx = table_list_visited(oi.fileno)) < 0) { + /* We have not visited this file, build object tables */ + if ((idx = table_list_add(oid, oi.fileno)) < 0) { + H5Oclose(oid); + goto fail; + } + } + + /* Do not recurse through an external link into the original file (idx=0) */ + if (idx) { + /* Update table pointers */ + group_table = table_list.tables[idx].group_table; + dset_table = table_list.tables[idx].dset_table; + type_table = table_list.tables[idx].type_table; + + /* We will now traverse the external link, set this global to indicate this */ + old_hit_elink = hit_elink; + hit_elink = TRUE; + + /* add some indentation to distinguish that these objects are external */ + dump_indent += COL; + + /* Recurse into the external file */ + switch (oi.type) { + case H5O_TYPE_GROUP: + handle_groups(group, linkname, NULL, 0, objname); + break; + case H5O_TYPE_DATASET: + handle_datasets(group, linkname, NULL, 0, objname); + break; + case H5O_TYPE_NAMED_DATATYPE: + handle_datatypes(group, linkname, NULL, 0, objname); + break; + default: + h5tools_setstatus(EXIT_FAILURE); + } + + dump_indent -= COL; + + /* Reset table pointers */ + group_table = old_group_table; + dset_table = old_dset_table; + type_table = old_type_table; + + /* Reset hit_elink */ + hit_elink = old_hit_elink; + } /* end if */ + + if (H5Idec_ref(oid) < 0) + h5tools_setstatus(EXIT_FAILURE); + + return SUCCEED; + +fail: + return FAIL; +} + diff --git a/tools/h5dump/h5dump_ddl.h b/tools/h5dump/h5dump_ddl.h new file mode 100644 index 0000000..c769194 --- /dev/null +++ b/tools/h5dump/h5dump_ddl.h @@ -0,0 +1,50 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifndef H5DUMP_DDL_H__ +#define H5DUMP_DDL_H__ + +/* callback function used by H5Literate() */ +static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data); +static int dump_extlink(hid_t group, const char *linkname, const char *objname); + +#ifdef __cplusplus +extern "C" { +#endif + +/* The dump functions of the dump_function_table */ +/* standard format: no change */ +void dump_group(hid_t, const char *); +void dump_named_datatype(hid_t, const char *); +void dump_dataset(hid_t, const char *, struct subset_t *); +void dump_dataspace(hid_t space); +void dump_datatype(hid_t type); +void dump_data(hid_t, int, struct subset_t *, int); +void dump_fcpl(hid_t fid); +void dump_fcontents(hid_t fid); + +/* callback function used by H5Aiterate2() */ +herr_t dump_attr_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data); + +void handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name); +void handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe, const char UNUSED *display_name); +void handle_groups(hid_t fid, const char *group, void UNUSED *data, int pe, const char *display_name); +void handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, const char UNUSED *display_name); +void handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe, const char *display_name); + +#ifdef __cplusplus +} +#endif + +#endif /* !H5DUMP_DDL_H__ */ diff --git a/tools/h5dump/h5dump_defines.h b/tools/h5dump/h5dump_defines.h new file mode 100644 index 0000000..4af5360 --- /dev/null +++ b/tools/h5dump/h5dump_defines.h @@ -0,0 +1,54 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifndef H5DUMP_DEFINES_H__ +#define H5DUMP_DEFINES_H__ + +#define H5DUMP_MAX_RANK H5S_MAX_RANK + +#define ATTRIBUTE_DATA 0 +#define DATASET_DATA 1 +#define ENUM_DATA 2 +#define COL 3 + +/* Macros for displaying objects */ +#define begin_obj(obj,name,begin) \ + do { \ + if (name) \ + HDfprintf(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \ + else \ + HDfprintf(rawoutstream, "%s %s", (obj), (begin)); \ + } while(0); + +#define end_obj(obj,end) \ + do { \ + if(HDstrlen(end)) { \ + HDfprintf(rawoutstream, "%s", end); \ + if(HDstrlen(obj)) \ + HDfprintf(rawoutstream, " "); \ + } \ + if(HDstrlen(obj)) \ + HDfprintf(rawoutstream, "%s", obj); \ + } while(0); + + +/* 3 private values: can't be set, but can be read. + Note: these are defined in H5Zprivate, they are + duplicated here. + */ +#define H5_SZIP_LSB_OPTION_MASK 8 +#define H5_SZIP_MSB_OPTION_MASK 16 +#define H5_SZIP_RAW_OPTION_MASK 128 + +#endif /* !H5DUMP_DEFINES_H__ */ diff --git a/tools/h5dump/h5dump_extern.h b/tools/h5dump/h5dump_extern.h new file mode 100644 index 0000000..5a0f2bd --- /dev/null +++ b/tools/h5dump/h5dump_extern.h @@ -0,0 +1,112 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifndef H5DUMP_EXTERN_H__ +#define H5DUMP_EXTERN_H__ + +#include "hdf5.h" +#include "H5private.h" +#include "h5tools.h" +#include "h5tools_utils.h" +#include "h5tools_ref.h" +#include "h5trav.h" +#include "h5dump_defines.h" + +/** + ** This is the global dispatch table for the dump functions. + **/ +/* the table of dump functions */ +typedef struct dump_functions_t { + void (*dump_group_function) (hid_t, const char *); + void (*dump_named_datatype_function) (hid_t, const char *); + void (*dump_dataset_function) (hid_t, const char *, struct subset_t *); + void (*dump_dataspace_function) (hid_t); + void (*dump_datatype_function) (hid_t); + herr_t (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *); + void (*dump_data_function) (hid_t, int, struct subset_t *, int); +} dump_functions; + +/* List of table structures. There is one table structure for each file */ +typedef struct h5dump_table_list_t { + size_t nalloc; + size_t nused; + struct { + unsigned long fileno; /* File number that these tables refer to */ + hid_t oid; /* ID of an object in this file, held open so fileno is consistent */ + table_t *group_table; /* Table of groups */ + table_t *dset_table; /* Table of datasets */ + table_t *type_table; /* Table of datatypes */ + } *tables; +} h5dump_table_list_t; + +extern h5dump_table_list_t table_list; +extern table_t *group_table, *dset_table, *type_table; +extern int dump_indent; /*how far in to indent the line */ + +extern int unamedtype; /* shared datatype with no name */ +extern hbool_t hit_elink; /* whether we have traversed an external link */ +extern size_t prefix_len; +extern char *prefix; +extern const char *fp_format; + +/* things to display or which are set via command line parameters */ +extern int display_all; +extern int display_oid; +extern int display_data; +extern int display_attr_data; +extern int display_char; /*print 1-byte numbers as ASCII */ +extern int usingdasho; +extern int display_bb; /*superblock */ +extern int display_dcpl; /*dcpl */ +extern int display_fi; /*file index */ +extern int display_ai; /*array index */ +extern int display_escape; /*escape non printable characters */ +extern int display_region; /*print region reference data */ +extern int enable_error_stack; /* re-enable error stack */ +extern int disable_compact_subset; /* disable compact form of subset notation */ +extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/ + +/* sort parameters */ +extern H5_index_t sort_by; /*sort_by [creation_order | name] */ +extern H5_iter_order_t sort_order; /*sort_order [ascending | descending] */ + +#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */ +#define PACKED_BITS_SIZE_MAX 8*sizeof(long long) /* Maximum bits size of integer types of packed-bits */ +/* mask list for packed bits */ +extern unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */ + +/* packed bits display parameters */ +extern int packed_offset[PACKED_BITS_MAX]; +extern int packed_length[PACKED_BITS_MAX]; + +/* + * The global table is set to either ddl_function_table or + * xml_function_table in the initialization. + */ +extern const dump_functions *dump_function_table; + +#ifdef __cplusplus +extern "C" { +#endif + +void add_prefix(char **prfx, size_t *prfx_len, const char *name); +hid_t h5_fileaccess(void); +ssize_t table_list_add(hid_t oid, unsigned long file_no); +ssize_t table_list_visited(unsigned long file_no); + +#ifdef __cplusplus +} +#endif + +#endif /* !H5DUMP_EXTERN_H__ */ diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c new file mode 100644 index 0000000..e6f8043 --- /dev/null +++ b/tools/h5dump/h5dump_xml.c @@ -0,0 +1,4456 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + +#include "H5private.h" +#include "h5tools.h" +#include "h5tools_dump.h" +#include "h5tools_utils.h" +#include "h5tools_ref.h" +#include "h5trav.h" +#include "h5dump_extern.h" +#include "h5dump_xml.h" + +const char *xmlnsprefix="hdf5:"; + +/* internal functions */ +static int xml_name_to_XID(const char *, char *, int , int ); + +/* internal functions used by XML option */ +static void xml_print_datatype(hid_t, unsigned); +static void xml_print_enum(hid_t); +static int xml_print_refs(hid_t, int); +static int xml_print_strs(hid_t, int); +static char *xml_escape_the_string(const char *, int); +static char *xml_escape_the_name(const char *); + +/*------------------------------------------------------------------------- + * Function: dump_all_cb + * + * Purpose: function callback called by H5Literate, + * displays everything in the specified object + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Ruey-Hsia Li + * + * Modifications: + * RMcG, November 2000 + * Added XML support. Also, optionally checks the op_data argument + * + * PVN, May 2008 + * Dump external links + * + *------------------------------------------------------------------------- + */ +static herr_t +xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED *op_data) +{ + hid_t obj; + herr_t ret = SUCCEED; + char *obj_path = NULL; /* Full path of object */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + /* Build the object's path name */ + obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + if(!obj_path) { + ret = FAIL; + goto done; + } + + HDstrcpy(obj_path, prefix); + HDstrcat(obj_path, "/"); + HDstrcat(obj_path, name); + + if(linfo->type == H5L_TYPE_HARD) { + H5O_info_t oinfo; + + /* Stat the object */ + if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) { + error_msg("unable to get object information for \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + goto done; + } /* end if */ + + switch(oinfo.type) { + case H5O_TYPE_GROUP: + if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) { + error_msg("unable to dump group \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + char *old_prefix; /* Pointer to previous prefix */ + + /* Keep copy of prefix before iterating into group */ + old_prefix = HDstrdup(prefix); + HDassert(old_prefix); + + /* Append group name to prefix */ + add_prefix(&prefix, &prefix_len, name); + + /* Iterate into group */ + dump_function_table->dump_group_function(obj, name); + + /* Restore old prefix name */ + HDstrcpy(prefix, old_prefix); + HDfree(old_prefix); + + /* Close group */ + H5Gclose(obj); + } + break; + + case H5O_TYPE_DATASET: + if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { + if(oinfo.rc > 1 || hit_elink) { + obj_t *found_obj; /* Found object */ + + found_obj = search_obj(dset_table, oinfo.addr); + + if(found_obj == NULL) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->datasetbegin, name, + h5tools_dump_header_format->datasetblockbegin); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(HDstrlen(h5tools_dump_header_format->datasetblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend); + if(HDstrlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, " "); + } + if(HDstrlen(h5tools_dump_header_format->datasetend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + H5Dclose(obj); + goto done; + } + else if(found_obj->displayed) { + /* the XML version */ + char *t_obj_path = xml_escape_the_name(obj_path); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + char *t_name = xml_escape_the_name(name); + char *t_objname = xml_escape_the_name(found_obj->objname); + char dsetxid[100]; + char parentxid[100]; + char pointerxid[100]; + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(obj_path, dsetxid, sizeof(dsetxid), 1); + xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" " + "H5Path=\"%s\" Parents=\"%s\" " + "H5ParentPaths=\"%s\">", + xmlnsprefix, + t_name, /* Dataset Name */ + dsetxid, get_next_xid(), /* OBJ-XID */ + t_obj_path, /* H5Path */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1); + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", + xmlnsprefix, + pointerxid,t_objname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(t_name); + HDfree(t_obj_path); + HDfree(t_prefix); + HDfree(t_objname); + + H5Dclose(obj); + goto done; + } + else { + found_obj->displayed = TRUE; + } + } /* end if */ + + dump_function_table->dump_dataset_function(obj, name, NULL); + H5Dclose(obj); + } + else { + error_msg("unable to dump dataset \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + break; + + case H5O_TYPE_NAMED_DATATYPE: + if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) { + error_msg("unable to dump datatype \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + dump_function_table->dump_named_datatype_function(obj, name); + H5Tclose(obj); + } + break; + + default: + error_msg("unknown object \"%s\"\n", name); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + } /* end if */ + else { + char *targbuf; + + switch(linfo->type) { + case H5L_TYPE_SOFT: + targbuf = (char *)HDmalloc(linfo->u.val_size); + HDassert(targbuf); + + if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { + error_msg("unable to get link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + /* print the value of a soft link */ + /* XML */ + char linkxid[100]; + char parentxid[100]; + char targetxid[100]; + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + char *t_name = xml_escape_the_name(name); + char *t_targbuf = xml_escape_the_name(targbuf); + char *t_obj_path = xml_escape_the_name(obj_path); + char *t_link_path; + int res; + + t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1); + if(targbuf[0] == '/') + HDstrcpy(t_link_path, targbuf); + else { + HDstrcpy(t_link_path, prefix); + HDstrcat(HDstrcat(t_link_path, "/"), targbuf); + } /* end else */ + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + + /* Try to create an OBJ-XID for the object pointed to */ + res = xml_name_to_XID(t_link_path, targetxid, sizeof(targetxid), 0); + if (res == 0) { + /* target obj found */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "TargetPath=\"%s\" TargetObj=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, + t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + t_targbuf, /* TargetPath */ + targetxid, /* TargetObj */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + /* dangling link -- omit from xml attributes */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "TargetPath=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, + t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + t_targbuf, /* TargetPath */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + + HDfree(t_prefix); + HDfree(t_name); + HDfree(t_targbuf); + HDfree(t_obj_path); + HDfree(t_link_path); + } + + HDfree(targbuf); + break; + + case H5L_TYPE_EXTERNAL: + targbuf = (char *)HDmalloc(linfo->u.val_size); + HDassert(targbuf); + + if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { + error_msg("unable to get external link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } /* end if */ + else { + const char *filename; + const char *targname; + + if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) { + error_msg("unable to unpack external link value\n"); + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } /* end if */ + else { + char linkxid[100]; + char parentxid[100]; + char *t_name = xml_escape_the_name(name); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + char *t_obj_path = xml_escape_the_name(obj_path); + char *t_filename = xml_escape_the_name(filename); + char *t_targname = xml_escape_the_name(targname); + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sExternalLink LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "TargetFilename=\"%s\" " + "TargetPath=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, + t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + filename, /* TargetFilename */ + targname, /* TargetPath*/ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(t_prefix); + HDfree(t_name); + HDfree(t_filename); + HDfree(t_targname); + HDfree(t_obj_path); + } /* end else */ + } /* end else */ + HDfree(targbuf); + break; + + default: + { + char linkxid[100]; + char parentxid[100]; + char *t_name = xml_escape_the_name(name); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + char *t_obj_path = xml_escape_the_name(obj_path); + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sUserDefined LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "LinkClass=\"%d\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, + t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + linfo->type, /* LinkClass */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(t_prefix); + HDfree(t_name); + HDfree(t_obj_path); + } + break; + } /* end switch */ + } /* end else */ + +done: + + h5tools_str_close(&buffer); + + if(obj_path) + HDfree(obj_path); + return ret; +} + +/* + * create a string suitable for and XML NCNAME. Uses the + * object reference to create the string. + * + * 'gen'; 0 - return null if not found + * 1 - generate a fake entry and return fake id. + */ +int +xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) +{ + haddr_t objno; /* Object ID for object at path */ + + if (outlen < 22) return 1; + + objno = ref_path_table_lookup(str); + if (objno == HADDR_UNDEF) { + if (HDstrlen(str) == 0) { + objno = ref_path_table_lookup("/"); + if (objno == HADDR_UNDEF) { + if (gen) { + objno = ref_path_table_gen_fake(str); + sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + return 0; + } + else { + return 1; + } + } + } + else { + if (gen) { + objno = ref_path_table_gen_fake(str); + sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + return 0; + } + else { + return 1; + } + } + } + + sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + + return(0); +} + +static const char *quote = """; +static const char *amp = "&"; +static const char *lt = "<"; +static const char *gt = ">"; +static const char *apos = "'"; + +/*------------------------------------------------------------------------- + * Function: xml_escape_the_name + * + * Purpose: Escape XML reserved chars in a name, so HDF5 strings + * and paths can be correctly read back in XML element. + * + * Return: The revised string. + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static char * +xml_escape_the_name(const char *str) +{ + size_t extra; + size_t len; + size_t i; + const char *cp; + char *ncp; + char *rcp; + + if (!str) + return NULL; + + cp = str; + len = HDstrlen(str); + extra = 0; + + for (i = 0; i < len; i++) { + if (*cp == '\"') { + extra += (HDstrlen(quote) - 1); + } + else if (*cp == '\'') { + extra += (HDstrlen(apos) - 1); + } + else if (*cp == '<') { + extra += (HDstrlen(lt) - 1); + } + else if (*cp == '>') { + extra += (HDstrlen(gt) - 1); + } + else if (*cp == '&') { + extra += (HDstrlen(amp) - 1); + } + + cp++; + } + + if (extra == 0) + return HDstrdup(str); + + cp = str; + rcp = ncp = (char *)HDmalloc(len + extra + 1); + + if (!ncp) + return NULL; /* ?? */ + + for (i = 0; i < len; i++) { + if (*cp == '\'') { + HDstrncpy(ncp, apos, HDstrlen(apos)); + ncp += HDstrlen(apos); + cp++; + } + else if (*cp == '<') { + HDstrncpy(ncp, lt, HDstrlen(lt)); + ncp += HDstrlen(lt); + cp++; + } + else if (*cp == '>') { + HDstrncpy(ncp, gt, HDstrlen(gt)); + ncp += HDstrlen(gt); + cp++; + } + else if (*cp == '\"') { + HDstrncpy(ncp, quote, HDstrlen(quote)); + ncp += HDstrlen(quote); + cp++; + } + else if (*cp == '&') { + HDstrncpy(ncp, amp, HDstrlen(amp)); + ncp += HDstrlen(amp); + cp++; + } + else { + *ncp++ = *cp++; + } + } + + *ncp = '\0'; + return rcp; +} + +/*------------------------------------------------------------------------- + * Function: xml_escape_the_string + * + * Purpose: Escape XML reserved chars in a string, so HDF5 strings + * and paths can be correctly read back in XML CDATA. + * + * Return: The revised string. + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static char * +xml_escape_the_string(const char *str, int slen) +{ + size_t extra; + size_t len; + size_t i; + const char *cp; + char *ncp; + char *rcp; + + if (!str) + return NULL; + + cp = str; + + if (slen < 0) + len = HDstrlen(str); + else + len = slen; + + extra = 0; + + for (i = 0; i < len; i++) { + if (*cp == '\\') { + extra++; + } + else if (*cp == '\"') { + extra++; + } + else if (*cp == '\'') { + extra += (HDstrlen(apos) - 1); + } + else if (*cp == '<') { + extra += (HDstrlen(lt) - 1); + } + else if (*cp == '>') { + extra += (HDstrlen(gt) - 1); + } + else if (*cp == '&') { + extra += (HDstrlen(amp) - 1); + } + cp++; + } + + cp = str; + rcp = ncp = (char *) HDcalloc((len + extra + 1), sizeof(char)); + + if (ncp == NULL) + return NULL; /* ?? */ + + for (i = 0; i < len; i++) { + if (*cp == '\\') { + *ncp++ = '\\'; + *ncp++ = *cp++; + } + else if (*cp == '\"') { + *ncp++ = '\\'; + *ncp++ = *cp++; + } + else if (*cp == '\'') { + HDstrncpy(ncp, apos, HDstrlen(apos)); + ncp += HDstrlen(apos); + cp++; + } + else if (*cp == '<') { + HDstrncpy(ncp, lt, HDstrlen(lt)); + ncp += HDstrlen(lt); + cp++; + } + else if (*cp == '>') { + HDstrncpy(ncp, gt, HDstrlen(gt)); + ncp += HDstrlen(gt); + cp++; + } + else if (*cp == '&') { + HDstrncpy(ncp, amp, HDstrlen(amp)); + ncp += HDstrlen(amp); + cp++; + } + else { + *ncp++ = *cp++; + } + } + + *ncp = '\0'; + return rcp; +} + +/** + ** XML print functions--these replace some functions in the + ** h5tools.c suite. + **/ + +/*------------------------------------------------------------------------- + * Function: xml_print_datatype + * + * Purpose: Print description of a datatype in XML. + * Note: this is called inside a element. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +xml_print_datatype(hid_t type, unsigned in_group) +{ + char *mname; + hid_t mtype; + unsigned nmembers; + unsigned ndims; + unsigned i; + size_t size; + hsize_t dims[H5DUMP_MAX_RANK]; + H5T_str_t str_pad; + H5T_cset_t cset; + hid_t super; + H5T_order_t ord; + H5T_sign_t sgn; + size_t sz; + size_t spos; + size_t epos; + size_t esize; + size_t mpos; + size_t msize; + int nmembs; + htri_t is_vlstr=FALSE; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + if(!in_group && H5Tcommitted(type) > 0) { + H5O_info_t oinfo; + obj_t *found_obj; /* Found object */ + + /* detect a shared datatype, output only once */ + H5Oget_info(type, &oinfo); + found_obj = search_obj(type_table, oinfo.addr); + + if(found_obj) { + /* This should be defined somewhere else */ + /* These 2 cases are handled the same right now, but + probably will have something different eventually */ + char * dtxid = (char *)HDmalloc(100); + + xml_name_to_XID(found_obj->objname, dtxid, 100, 1); + if (!found_obj->recorded) { + /* 'anonymous' NDT. Use it's object num. + as it's name. */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>", + xmlnsprefix, dtxid); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + /* point to the NDT by name */ + char *t_objname = xml_escape_the_name(found_obj->objname); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", + xmlnsprefix, dtxid, t_objname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + HDfree(t_objname); + } + HDfree(dtxid); + } + else { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_setstatus(EXIT_FAILURE); + } + } + else { + + switch (H5Tget_class(type)) { + case H5T_INTEGER: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + /* */ + ord = H5Tget_order(type); + sgn = H5Tget_sign(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"",xmlnsprefix); + switch (ord) { + case H5T_ORDER_LE: + h5tools_str_append(&buffer, "LE"); + break; + case H5T_ORDER_BE: + h5tools_str_append(&buffer, "BE"); + break; + case H5T_ORDER_VAX: + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + } + + h5tools_str_append(&buffer, "\" Sign=\""); + + switch (sgn) { + case H5T_SGN_NONE: + h5tools_str_append(&buffer, "false"); + break; + case H5T_SGN_2: + h5tools_str_append(&buffer, "true"); + break; + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + } + + h5tools_str_append(&buffer, "\" Size=\""); + sz = H5Tget_size(type); + h5tools_str_append(&buffer, "%lu", (unsigned long)sz); + h5tools_str_append(&buffer, "\" />"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_FLOAT: + /* */ + ord = H5Tget_order(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"",xmlnsprefix); + + switch (ord) { + case H5T_ORDER_LE: + h5tools_str_append(&buffer, "LE"); + break; + case H5T_ORDER_BE: + h5tools_str_append(&buffer, "BE"); + break; + case H5T_ORDER_VAX: + h5tools_str_append(&buffer, "VAX"); + break; + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + } + + h5tools_str_append(&buffer, "\" Size=\""); + sz = H5Tget_size(type); + h5tools_str_append(&buffer, "%lu", (unsigned long)sz); + H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize); + h5tools_str_append(&buffer, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos); + h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos); + h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", (unsigned long)msize, (unsigned long)mpos); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_TIME: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_str_append(&buffer, ""); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_STRING: + /* */ + size = H5Tget_size(type); + str_pad = H5Tget_strpad(type); + cset = H5Tget_cset(type); + is_vlstr = H5Tis_variable_str(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sStringType Cset=\"",xmlnsprefix); + if (cset == H5T_CSET_ASCII) { + h5tools_str_append(&buffer, "H5T_CSET_ASCII\" "); + } + else { + h5tools_str_append(&buffer, "unknown_cset\" "); + } + if(is_vlstr) + h5tools_str_append(&buffer, "StrSize=\"H5T_VARIABLE\" StrPad=\""); + else + h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int) size); + if (str_pad == H5T_STR_NULLTERM) { + h5tools_str_append(&buffer, "H5T_STR_NULLTERM\"/>"); + } + else if (str_pad == H5T_STR_NULLPAD) { + h5tools_str_append(&buffer, "H5T_STR_NULLPAD\"/>"); + } + else if (str_pad == H5T_STR_SPACEPAD) { + h5tools_str_append(&buffer, "H5T_STR_SPACEPAD\"/>"); + } + else { + h5tools_str_append(&buffer, "H5T_STR_ERROR\"/>"); + } + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_BITFIELD: + /* */ + ord = H5Tget_order(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"",xmlnsprefix); + + switch (ord) { + case H5T_ORDER_LE: + h5tools_str_append(&buffer, "LE"); + break; + case H5T_ORDER_BE: + h5tools_str_append(&buffer, "BE"); + break; + case H5T_ORDER_VAX: + default: + h5tools_str_append(&buffer, "ERROR_UNKNOWN"); + } + + size = H5Tget_size(type); + h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_OPAQUE: + /* */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + mname = H5Tget_tag(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname); + HDfree(mname); + size = H5Tget_size(type); + h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_COMPOUND: + /* recursively describe the components of a compound datatype */ + + /* type of a dataset */ + nmembers = H5Tget_nmembers(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* List each member Field of the type */ + /* */ + /* */ + ctx.indent_level++; + dump_indent += COL; + for (i = 0; i < nmembers; i++) { + char *t_fname; + + mname = H5Tget_member_name(type, i); + mtype = H5Tget_member_type(type, i); + t_fname = xml_escape_the_name(mname); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(mname); + HDfree(t_fname); + dump_indent += COL; + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + dump_indent += COL; + xml_print_datatype(mtype,0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_REFERENCE: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + /* Only Object references supported at this time */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_ENUM: + /* list Name, values of enum */ + nmembs = H5Tget_nmembers(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent += COL; + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">",xmlnsprefix, nmembs); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + xml_print_enum(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_VLEN: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + super = H5Tget_super(type); + dump_indent += COL; + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent += COL; + ctx.indent_level++; + xml_print_datatype(super,0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + H5Tclose(super); + + break; + + case H5T_ARRAY: + /* Get array base type */ + super = H5Tget_super(type); + + /* Print lead-in */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sArrayType Ndims=\"",xmlnsprefix); + ndims = H5Tget_array_ndims(type); + h5tools_str_append(&buffer, "%u\">", ndims); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* Get array information */ + H5Tget_array_dims2(type, dims); + + /* list of dimensions */ + ctx.indent_level++; + for (i = 0; i < ndims; i++) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, (int) dims[i]); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + ctx.indent_level--; + + dump_indent += COL; + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent += COL; + ctx.indent_level++; + xml_print_datatype(super,0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_indent -= COL; + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + /* Close array base type */ + H5Tclose(super); + break; + + default: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_setstatus(EXIT_FAILURE); + break; + } + } /* end else */ + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_datatype + * + * Purpose: Dump description of a datatype in XML. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +xml_dump_datatype(hid_t type) +{ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + ctx.indent_level++; + dump_indent += COL; + + if(H5Tcommitted(type) > 0) { + H5O_info_t oinfo; + obj_t *found_obj; /* Found object */ + + /* Datatype is a shared or named datatype */ + H5Oget_info(type, &oinfo); + found_obj = search_obj(type_table, oinfo.addr); + + if(found_obj) { + /* Shared datatype, must be entered as an object */ + /* These 2 cases are the same now, but may change */ + char *dtxid = (char *)HDmalloc(100); + + xml_name_to_XID(found_obj->objname, dtxid, 100, 1); + if (!found_obj->recorded) { + /* anonymous stored datatype: + following the dumper's current + practice: + use it's object ref as its name + */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>", + xmlnsprefix, dtxid); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + /* pointer to a named datatype already in XML */ + char *t_objname = xml_escape_the_name(found_obj->objname); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />", + xmlnsprefix, dtxid, t_objname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + HDfree(t_objname); + } + HDfree(dtxid); + } + else { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + } + else { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + dump_indent += COL; + xml_print_datatype(type, 0); + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + ctx.indent_level--; + dump_indent -= COL; + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_dataspace + * + * Purpose: Dump description of a dataspace in XML. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +xml_dump_dataspace(hid_t space) +{ + hsize_t size[H5DUMP_MAX_RANK]; + hsize_t maxsize[H5DUMP_MAX_RANK]; + int i; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + int ndims = H5Sget_simple_extent_dims(space, size, maxsize); + H5S_class_t space_type = H5Sget_simple_extent_type(space); + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataspace>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + switch (space_type) { + case H5S_SCALAR: + /* scalar dataspace (just a tag, no XML attrs. defined */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sScalarDataspace />",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5S_SIMPLE: + /* simple dataspace */ + /* */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sSimpleDataspace Ndims=\"%d\">",xmlnsprefix, ndims); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* print the elements */ + ctx.indent_level++; + for (i = 0; i < ndims; i++) { + if (maxsize[i] == H5S_UNLIMITED) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"UNLIMITED\"/>", + xmlnsprefix,size[i]); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else if (maxsize[i] == (hsize_t) 0) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>", + xmlnsprefix,size[i], size[i]); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>", + xmlnsprefix, size[i], maxsize[i]); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + } + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix ); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + +#ifdef TMP + /* Commented out: wait until the schema is updated first */ + case H5S_NULL: + /* null dataspace (just a tag, no XML attrs. defined */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNullDataspace />",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; +#endif /* TMP */ + + case H5S_NO_CLASS: + default: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_data + * + * Purpose: Dump description of data in XML. + * Note that this calls the h5dump_xxx calls in + * the h5tools library. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNUSED pindex) +{ + hid_t space = -1; + hid_t type = -1; + hid_t p_type = -1; + hsize_t size[64]; + hsize_t nelmts = 1; + int ndims; + int i; + int depth; + int status = -1; + int stdindent = COL; /* should be 3 */ + void *buf = NULL; + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + /* Print all the values. */ + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + string_dataformat.cmpd_sep = " "; + string_dataformat.cmpd_pre = ""; + string_dataformat.cmpd_suf = ""; + string_dataformat.cmpd_end = ""; + string_dataformat.arr_linebreak = 0; + string_dataformat.arr_pre = ""; + outputformat = &string_dataformat; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + dump_indent += COL; + ctx.indent_level++; + + if (obj_data == DATASET_DATA) { + type = H5Dget_type(obj_id); + if (H5Tget_class(type) == H5T_REFERENCE) { + status = xml_print_refs(obj_id, DATASET_DATA); + } + else if (H5Tget_class(type) == H5T_STRING) { + status = xml_print_strs(obj_id, DATASET_DATA); + } + else { + h5tools_context_t datactx; + HDmemset(&datactx, 0, sizeof(datactx)); + datactx.need_prefix = TRUE; + datactx.indent_level = ctx.indent_level; + datactx.cur_column = ctx.cur_column; + status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id, -1, NULL); + } + } + else { + /* Attribute data */ + type = H5Aget_type(obj_id); + + if (H5Tget_class(type) == H5T_REFERENCE) { + /* references are done differently than + the standard output: + XML dumps a path to the object + referenced. + */ + status = xml_print_refs(obj_id, ATTRIBUTE_DATA); + H5Tclose(type); + } + else if (H5Tget_class(type) == H5T_STRING) { + status = xml_print_strs(obj_id, ATTRIBUTE_DATA); + } + else { /* all other data */ + /* VL data special information */ + unsigned int vl_data = 0; /* contains VL datatypes */ + + p_type = h5tools_get_native_type(type); + + /* Check if we have VL data in the dataset's datatype */ + if (h5tools_detect_vlen_str(p_type) == TRUE) + vl_data = TRUE; + if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + vl_data = TRUE; + + H5Tclose(type); + + space = H5Aget_space(obj_id); + + ndims = H5Sget_simple_extent_dims(space, size, NULL); + + for (i = 0; i < ndims; i++) + nelmts *= size[i]; + + buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)))); + HDassert(buf); + + if (H5Aread(obj_id, p_type, buf) >= 0) { + h5tools_context_t datactx; + HDmemset(&datactx, 0, sizeof(datactx)); + datactx.need_prefix = TRUE; + datactx.indent_level = ctx.indent_level; + datactx.cur_column = ctx.cur_column; + status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf); + } + /* Reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); + + HDfree(buf); + H5Tclose(p_type); + H5Sclose(space); + H5Tclose(type); + } + } + + if (status == FAIL) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "Unable to print data."); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + status = 1; + } + ctx.indent_level--; + dump_indent -= COL; + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_attr + * + * Purpose: Dump a description of an HDF5 attribute in XML. + * + * Return: herr_t + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, + void UNUSED * op_data) +{ + hid_t attr_id = -1; + hid_t type = -1; + hid_t space = -1; + H5S_class_t space_type; + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + + char *t_aname = xml_escape_the_name(attr_name); + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sAttribute Name=\"%s\">", xmlnsprefix, t_aname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + HDfree(t_aname); + + if ((attr_id = H5Aopen(attr, attr_name, H5P_DEFAULT)) >= 0) { + type = H5Aget_type(attr_id); + space = H5Aget_space(attr_id); + space_type = H5Sget_simple_extent_type(space); + + dump_function_table->dump_dataspace_function(space); + dump_function_table->dump_datatype_function(type); + + ctx.indent_level++; + dump_indent += COL; + + if (display_attr_data && space_type != H5S_NULL) { + switch (H5Tget_class(type)) { + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_ENUM: + case H5T_ARRAY: + dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); + break; + + case H5T_TIME: + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + dump_indent -= COL; + break; + + case H5T_COMPOUND: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); + break; + + case H5T_REFERENCE: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + if (!H5Tequal(type, H5T_STD_REF_OBJ)) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + xml_print_refs(attr_id, ATTRIBUTE_DATA); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_VLEN: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0); + break; + default: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", H5Tget_class(type)); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + } + } + else { + /* The case of an attribute never yet written ?? + * Or dataspace is H5S_NULL. */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + ctx.indent_level--; + dump_indent -= COL; + + H5Tclose(type); + H5Sclose(space); + H5Aclose(attr_id); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); + return SUCCEED; + } + else { + /* ?? failed */ + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); + + h5tools_setstatus(EXIT_FAILURE); + return FAIL; + } +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_named_datatype + * + * Purpose: Dump a description of an HDF5 NDT in XML. + * + * Return: herr_t + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +xml_dump_named_datatype(hid_t type, const char *name) +{ + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + char *tmp; + char *dtxid; + char *parentxid; + char *t_tmp; + char *t_prefix; + char *t_name; + + tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + HDstrcpy(tmp, prefix); + HDstrcat(tmp, "/"); + HDstrcat(tmp, name); + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + dtxid = (char *)HDmalloc(100); + parentxid = (char *)HDmalloc(100); + t_tmp = xml_escape_the_name(tmp); + t_prefix = xml_escape_the_name(prefix); + t_name = xml_escape_the_name(name); + + xml_name_to_XID(tmp, dtxid, 100, 1); + xml_name_to_XID(prefix, parentxid, 100, 1); + if(HDstrncmp(name, "#", 1) == 0) { + /* Special: this is an 'anonymous' NDT, deleted but + still in use. + We follow the dumper's undocumented practice, and + use its object id as its name. + Exactly the same as normal, but a separate case + in the event we want to do something else in + the future. + */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\">", + xmlnsprefix, + name, dtxid, + parentxid, HDstrcmp(prefix,"") ? t_prefix : "/"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + H5O_info_t oinfo; /* Object info */ + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " + "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">", + xmlnsprefix, + t_name, dtxid, + t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/")); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* Check uniqueness of named datatype */ + H5Oget_info(type, &oinfo); + if(oinfo.rc > 1) { + obj_t *found_obj; /* Found object */ + + /* Group with more than one link to it... */ + found_obj = search_obj(type_table, oinfo.addr); + + if (found_obj == NULL) { + indentation(dump_indent); + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if(found_obj->displayed) { + /* We have already printed this named datatype, print it as a + * NamedDatatypePtr + */ + char pointerxid[100]; + char *t_objname = xml_escape_the_name(found_obj->objname); + + ctx.indent_level++; + + xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, pointerxid, t_objname); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + HDfree(t_objname); + goto done; + } + else + found_obj->displayed = TRUE; + } + } + + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + dump_indent += COL; + xml_print_datatype(type,1); + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + +done: + + h5tools_str_close(&buffer); + + HDfree(dtxid); + HDfree(parentxid); + HDfree(t_tmp); + HDfree(t_prefix); + HDfree(t_name); + HDfree(tmp); +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_group + * + * Purpose: Dump a description of an HDF5 Group (and its members) in XML. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * Pedro Vicente, October 9, 2007 + * added parameters to H5A(L)iterate to allow for other iteration orders + * + *------------------------------------------------------------------------- + */ +void +xml_dump_group(hid_t gid, const char *name) +{ + H5O_info_t oinfo; + hid_t gcpl_id; + hid_t dset, type; + unsigned crt_order_flags; + unsigned attr_crt_order_flags; + int isRoot = 0; + char type_name[1024]; + char *t_objname = NULL; + char *par_name = NULL; + char *cp = NULL; + char *tmp = NULL; + char *par = NULL; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { + error_msg("error in getting group creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* query the group creation properties for attributes */ + if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) { + error_msg("error in getting group creation properties\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* query the group creation properties */ + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { + error_msg("error in getting group creation properties\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + if(H5Pclose(gcpl_id) < 0) { + error_msg("error in closing group creation property list ID\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + if(HDstrcmp(name, "/") == 0) { + isRoot = 1; + tmp = HDstrdup("/"); + } + else { + tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + HDstrcpy(tmp, prefix); + par = HDstrdup(tmp); + cp = HDstrrchr(par, '/'); + if(cp) { + if((cp == par) && HDstrlen(par) > 1) + *(cp + 1) = '\0'; + else + *cp = '\0'; + } + } + + H5Oget_info(gid, &oinfo); + + if(oinfo.rc > 1) { + obj_t *found_obj; /* Found object */ + + /* Group with more than one link to it... */ + found_obj = search_obj(group_table, oinfo.addr); + + if (found_obj == NULL) { + indentation(dump_indent); + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); + h5tools_setstatus(EXIT_FAILURE); + } + else { + char *t_name = xml_escape_the_name(name); + char *grpxid = (char *)HDmalloc(100); + char *parentxid = (char *)HDmalloc(100); + + if(found_obj->displayed) { + char *ptrstr = (char *)HDmalloc(100); + + /* already seen: enter a groupptr */ + if(isRoot) { + /* probably can't happen! */ + xml_name_to_XID("/", grpxid, 100, 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", + xmlnsprefix, grpxid, "/"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + t_objname = xml_escape_the_name(found_obj->objname); + par_name = xml_escape_the_name(par); + xml_name_to_XID(tmp, grpxid, 100, 1); + xml_name_to_XID(par, parentxid, 100, 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\">", + xmlnsprefix,t_name, grpxid, get_next_xid(), + t_objname, parentxid, par_name); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + HDfree(t_objname); + HDfree(par_name); + + ctx.indent_level++; + + t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */ + par_name = xml_escape_the_name(par); + xml_name_to_XID(found_obj->objname, ptrstr, 100, 1); + xml_name_to_XID(par, parentxid, 100, 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />", + xmlnsprefix, + ptrstr, t_objname, parentxid, par_name); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + + HDfree(t_objname); + HDfree(par_name); + } + HDfree(ptrstr); + } + else { + + /* first time this group has been seen -- describe it */ + if(isRoot) { + xml_name_to_XID("/", grpxid, 100, 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", + xmlnsprefix, grpxid, "/"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + char *t_tmp = xml_escape_the_name(tmp); + + par_name = xml_escape_the_name(par); + xml_name_to_XID(tmp, grpxid, 100, 1); + xml_name_to_XID(par, parentxid, 100, 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" >", + xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(t_tmp); + HDfree(par_name); + } + found_obj->displayed = TRUE; + + /* 1. do all the attributes of the group */ + + ctx.indent_level++; + dump_indent += COL; + + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end if */ + else { + if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end else */ + + if(isRoot && unamedtype) { + unsigned u; + + /* Very special case: dump unamed type in root group */ + for(u = 0; u < type_table->nobjs; u++) { + if(!type_table->objs[u].recorded) { + dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); + type = H5Dget_type(dset); + sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + dump_function_table->dump_named_datatype_function(type, type_name); + H5Tclose(type); + H5Dclose(dset); + } + } + } + + /* iterate through all the links */ + + if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) + H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL); + else + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL); + + dump_indent -= COL; + ctx.indent_level--; + } + HDfree(t_name); + HDfree(grpxid); + HDfree(parentxid); + } + } + else { + /* only link -- must be first time! */ + char *t_name = xml_escape_the_name(name); + char *grpxid = (char *)HDmalloc(100); + char *parentxid = (char *)HDmalloc(100); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + + if(isRoot) { + xml_name_to_XID("/", grpxid, 100, 1); + h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/"); + } + else { + char *t_tmp = xml_escape_the_name(tmp); + + par_name = xml_escape_the_name(par); + xml_name_to_XID(tmp, grpxid, 100, 1); + xml_name_to_XID(par, parentxid, 100, 1); + h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" >", + xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name); + HDfree(t_tmp); + HDfree(par_name); + } + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(t_name); + HDfree(grpxid); + HDfree(parentxid); + + /* 1. do all the attributes of the group */ + + ctx.indent_level++; + dump_indent += COL; + + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end if */ + else { + if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end else */ + + if(isRoot && unamedtype) { + unsigned u; + + /* Very special case: dump unamed type in root group */ + for(u = 0; u < type_table->nobjs; u++) { + if(!type_table->objs[u].recorded) { + dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); + type = H5Dget_type(dset); + sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + dump_function_table->dump_named_datatype_function(type, type_name); + H5Tclose(type); + H5Dclose(dset); + } + } + } + + /* iterate through all the links */ + + if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) + H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL); + else + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL); + + dump_indent -= COL; + ctx.indent_level--; + } + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if(isRoot) + h5tools_str_append(&buffer, "", xmlnsprefix); + else + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); + + if(par) + HDfree(par); + if(tmp) + HDfree(tmp); +} + +/*------------------------------------------------------------------------- + * Function: xml_print_refs + * + * Purpose: Print a path to the objects referenced by HDF5 Referneces. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +xml_print_refs(hid_t did, int source) +{ + herr_t e; + hid_t type; + hid_t space; + hssize_t ssiz; + hsize_t i; + size_t tsiz; + hobj_ref_t *refbuf = NULL; + char *buf = NULL; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + if (source == DATASET_DATA) { + type = H5Dget_type(did); + } + else if (source == ATTRIBUTE_DATA) { + type = H5Aget_type(did); + } + else { + /* return an error */ + return FAIL; + } + if (H5Tget_class(type) != H5T_REFERENCE) { + /* return an error */ + goto error; + } + if (!H5Tequal(type, H5T_STD_REF_OBJ)) { + /* region ref not supported yet... */ + /* return an error */ + goto error; + } + if (source == DATASET_DATA) { + space = H5Dget_space(did); + if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) + goto error; + if ((tsiz = H5Tget_size(type)) == 0) + goto error; + + buf = (char *) HDcalloc((size_t)(ssiz * tsiz), sizeof(char)); + if (buf == NULL) + goto error; + e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + /* need to check result here */ + if (e < 0) { + goto error; + } + } + else if (source == ATTRIBUTE_DATA) { + space = H5Aget_space(did); + if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) + goto error; + if ((tsiz = H5Tget_size(type)) == 0) + goto error; + + buf = (char *) HDcalloc((size_t)(ssiz * tsiz), sizeof(char)); + if (buf == NULL) { + goto error; + } + e = H5Aread(did, H5T_STD_REF_OBJ, buf); + /* need to check the result here */ + if (e < 0) { + goto error; + } + } + + refbuf = (hobj_ref_t *) buf; + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + for (i = 0; i < ssiz; i++) { + const char *path = lookup_ref_path(*refbuf); + ctx.indent_level++; + + if (!path) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%s\"", "NULL"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + char *t_path = xml_escape_the_string(path, -1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%s\"", t_path); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + HDfree(t_path); + } + ctx.indent_level--; + + refbuf++; + } + + h5tools_str_close(&buffer); + + HDfree(buf); + H5Tclose(type); + H5Sclose(space); + return SUCCEED; + +error: + if(buf) + HDfree(buf); + + H5E_BEGIN_TRY { + H5Tclose(type); + H5Sclose(space); + } H5E_END_TRY; + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: xml_print_strs + * + * Purpose: Print strings. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +xml_print_strs(hid_t did, int source) +{ + herr_t e; + hid_t type; + hid_t space; + hssize_t ssiz; + htri_t is_vlstr = FALSE; + size_t tsiz; + size_t i; + size_t str_size = 0; + char *bp = NULL; + char *onestring = NULL; + void *buf = NULL; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + if (source == DATASET_DATA) { + type = H5Dget_type(did); + } + else if (source == ATTRIBUTE_DATA) { + type = H5Aget_type(did); + } + else { + /* return an error */ + return FAIL; + } + if (H5Tget_class(type) != H5T_STRING) { + /* return an error */ + goto error; + } + /* Check if we have VL data in the dataset's datatype */ + is_vlstr = H5Tis_variable_str(type); + + if (source == DATASET_DATA) { + space = H5Dget_space(did); + if((ssiz = H5Sget_simple_extent_npoints(space)) < 0) + goto error; + if((tsiz = H5Tget_size(type)) == 0) + goto error; + + buf = HDmalloc((size_t)(ssiz * tsiz)); + if (buf == NULL) + goto error; + + e = H5Dread(did, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + if (e < 0) { + goto error; + } + } + else if (source == ATTRIBUTE_DATA) { + space = H5Aget_space(did); + if((ssiz = H5Sget_simple_extent_npoints(space)) < 0) + goto error; + if((tsiz = H5Tget_size(type)) == 0) + goto error; + + buf = HDmalloc((size_t)(ssiz * tsiz)); + if (buf == NULL) + goto error; + + e = H5Aread(did, type, buf); + if (e < 0) { + goto error; + } + } + + bp = (char*) buf; + if (!is_vlstr) + onestring = (char *) HDcalloc(tsiz, sizeof(char)); + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + for (i = 0; i < ssiz; i++) { + if (is_vlstr) { + onestring = *(char **) bp; + if (onestring) + str_size = (size_t) HDstrlen(onestring); + } + else { + HDstrncpy(onestring, bp, tsiz); + str_size = tsiz; + } + + if (!onestring) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "NULL"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + char *t_onestring = xml_escape_the_string(onestring, (int) str_size); + if (t_onestring) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%s\"", t_onestring); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + HDfree(t_onestring); + } + } + bp += tsiz; + } + + h5tools_str_close(&buffer); + + /* Reclaim any VL memory, if necessary */ + if (!is_vlstr) + if (onestring) + HDfree(onestring); + if (buf) { + if (is_vlstr) + H5Dvlen_reclaim(type, space, H5P_DEFAULT, buf); + HDfree(buf); + } + H5Tclose(type); + H5Sclose(space); + return SUCCEED; + +error: + if(buf) + HDfree(buf); + + H5E_BEGIN_TRY { + H5Tclose(type); + H5Sclose(space); + } H5E_END_TRY; + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: check_filters + * + * Purpose: private function to check for the filters and + * put tags in the XML. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +check_filters(hid_t dcpl) +{ + int nfilt; + int i; + H5Z_filter_t filter; + char namebuf[120]; + size_t cd_nelmts = 20; + unsigned int cd_values[20]; + unsigned int flags; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + nfilt = H5Pget_nfilters(dcpl); + if (nfilt <= 0) + return; + for (i = 0; i < nfilt; i++) { + filter = H5Pget_filter2(dcpl, (unsigned) i, &flags, (size_t *) &cd_nelmts, cd_values, 120, namebuf, NULL); + if (filter == H5Z_FILTER_DEFLATE) { + ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDeflate Level=\"", xmlnsprefix); + if (cd_nelmts < 1) { + /* not sure what this means? */ + h5tools_str_append(&buffer, "6"); + } + else { + h5tools_str_append(&buffer, "%d", cd_values[0]); + } + h5tools_str_append(&buffer, "\"/>"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + else if (filter == H5Z_FILTER_FLETCHER32) { + ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sFletcher32 />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + else if (filter == H5Z_FILTER_SHUFFLE) { + ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sShuffle />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + else if (filter == H5Z_FILTER_SZIP) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sSZIP ", xmlnsprefix); + if (cd_nelmts < 2) { + /* no pixels ? */ + h5tools_str_append(&buffer, "Pixels_per_block=\"-1\" "); + } + else { + h5tools_str_append(&buffer, "Pixels_per_block=\"%d\" ", cd_values[1]); + } + /* analyse the options mask */ + if (cd_values[0] & H5_SZIP_CHIP_OPTION_MASK) { + h5tools_str_append(&buffer, "Mode =\"Hardware\" "); + } + else if (cd_values[0] & H5_SZIP_ALLOW_K13_OPTION_MASK) { + h5tools_str_append(&buffer, "Mode =\"K13\" "); + } + h5tools_str_append(&buffer, "Coding=\""); + if (cd_values[0] & H5_SZIP_EC_OPTION_MASK) { + h5tools_str_append(&buffer, "Entropy"); + } + else if (cd_values[0] & H5_SZIP_NN_OPTION_MASK) { + h5tools_str_append(&buffer, "NN"); + } + h5tools_str_append(&buffer, "\" "); + + h5tools_str_append(&buffer, "ByteOrder=\""); + if (cd_values[0] & H5_SZIP_LSB_OPTION_MASK) { + h5tools_str_append(&buffer, "LSB"); + } + else if (cd_values[0] & H5_SZIP_MSB_OPTION_MASK) { + h5tools_str_append(&buffer, "MSB"); + } + h5tools_str_append(&buffer, "\" "); + + if (cd_values[0] & H5_SZIP_RAW_OPTION_MASK) { + h5tools_str_append(&buffer, "Header=\"Raw\""); + } + h5tools_str_append(&buffer, "/>"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + else { + /* unknown option */ + } + } + + h5tools_str_close(&buffer); +} + +static void +xml_dump_fill_value(hid_t dcpl, hid_t type) +{ + size_t sz; + size_t i; + hsize_t space; + void *buf; + char *name; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + dump_indent += COL; + + space = H5Tget_size(type); + buf = HDmalloc((size_t) space); + + H5Pget_fill_value(dcpl, type, buf); + + if (H5Tget_class(type) == H5T_REFERENCE) { + const char * path = lookup_ref_path(*(hobj_ref_t *) buf); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + if (!path) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%s\"", "NULL"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + char *t_path = xml_escape_the_string(path, -1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%s\"", t_path); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + HDfree(t_path); + } + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else if (H5Tget_class(type) == H5T_STRING) { + /* ????? */ + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + /* all other data */ + switch (H5Tget_class(type)) { + case H5T_INTEGER: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%d\"", *(int *) buf); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_FLOAT: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%f\"", *(float *) buf); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_BITFIELD: + case H5T_OPAQUE: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + sz = H5Tget_size(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\""); + for (i = 0; i < sz; i++) { + h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf); + buf = (char *) buf + sizeof(unsigned int); + } + h5tools_str_append(&buffer, "\""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_ENUM: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + name = H5Tget_member_name(type, *(unsigned *) buf); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\"%s\"", name); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_ARRAY: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_TIME: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_COMPOUND: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + case H5T_VLEN: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + default: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", H5Tget_class(type)); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + } + } + HDfree(buf); + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + dump_indent -= COL; + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: xml_dump_dataset + * + * Purpose: Dump a description of an HDF5 dataset in XML. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * Pedro Vicente, October 9, 2007 + * added parameters to H5Aiterate2 to allow for other iteration orders + * + *------------------------------------------------------------------------- + */ +void +xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) +{ + hid_t type; + hid_t space; + hid_t dcpl; + H5D_fill_value_t fvstatus; + int maxdims; + hsize_t *chsize; + int ndims; + int i; + H5D_alloc_time_t at; + H5D_fill_time_t ft; + hsize_t tempi; + char *tmp; + char *t_name; + char *t_tmp; + char *t_prefix; + unsigned attr_crt_order_flags; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + char *rstr = (char*) HDmalloc(100); + char *pstr = (char*) HDmalloc(100); + + tmp = (char*) HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + HDstrcpy(tmp, prefix); + HDstrcat(tmp, "/"); + HDstrcat(tmp, name); + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + t_name = xml_escape_the_name(name); + t_tmp = xml_escape_the_name(tmp); + t_prefix = xml_escape_the_name(prefix); + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + xml_name_to_XID(tmp, rstr, 100, 1); + xml_name_to_XID(prefix, pstr, 100, 1); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">", + xmlnsprefix, t_name, rstr, t_tmp, pstr, + strcmp(prefix, "") ? t_prefix : "/"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + HDfree(t_name); + HDfree(t_tmp); + HDfree(t_prefix); + HDfree(rstr); + HDfree(pstr); + HDfree(tmp); + + dcpl = H5Dget_create_plist(did); + type = H5Dget_type(did); + space = H5Dget_space(did); + + /* query the creation properties for attributes */ + H5Pget_attr_creation_order(dcpl, &attr_crt_order_flags); + + /* Print information about storage layout */ + if (H5D_CHUNKED == H5Pget_layout(dcpl)) { + maxdims = H5Sget_simple_extent_ndims(space); + chsize = (hsize_t *) HDmalloc(maxdims * sizeof(hsize_t)); + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sChunkedLayout ", xmlnsprefix); + ndims = H5Pget_chunk(dcpl, maxdims, chsize); + h5tools_str_append(&buffer, "Ndims=\"%d\">", ndims); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + dump_indent += COL; + + for (i = 0; i < ndims; i++) { + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />", xmlnsprefix, chsize[i]); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sRequiredFilter>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + dump_indent += COL; + check_filters(dcpl); + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + dump_indent -= COL; + HDfree(chsize); + } + else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl)) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sContiguousLayout/>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + else if (H5D_COMPACT == H5Pget_layout(dcpl)) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sCompactLayout/>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + /* and check for external.... ?? */ + + /* fill value */ + + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sFillValueInfo ", xmlnsprefix); + H5Pget_fill_time(dcpl, &ft); + h5tools_str_append(&buffer, "FillTime=\""); + switch (ft) { + case H5D_FILL_TIME_ALLOC: + h5tools_str_append(&buffer, "FillOnAlloc"); + break; + case H5D_FILL_TIME_NEVER: + h5tools_str_append(&buffer, "FillNever"); + break; + case H5D_FILL_TIME_IFSET: + h5tools_str_append(&buffer, "FillIfSet"); + break; + default: + h5tools_str_append(&buffer, "?"); + break; + } + h5tools_str_append(&buffer, "\" "); + H5Pget_alloc_time(dcpl, &at); + h5tools_str_append(&buffer, "AllocationTime=\""); + switch (at) { + case H5D_ALLOC_TIME_EARLY: + h5tools_str_append(&buffer, "Early"); + break; + case H5D_ALLOC_TIME_INCR: + h5tools_str_append(&buffer, "Incremental"); + break; + case H5D_ALLOC_TIME_LATE: + h5tools_str_append(&buffer, "Late"); + break; + case H5D_ALLOC_TIME_DEFAULT: + default: + h5tools_str_append(&buffer, "?"); + break; + } + h5tools_str_append(&buffer, "\""); + h5tools_str_append(&buffer, ">"); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + dump_indent += COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sFillValue>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + H5Pfill_value_defined(dcpl, &fvstatus); + if (fvstatus == H5D_FILL_VALUE_UNDEFINED || (fvstatus == H5D_FILL_VALUE_DEFAULT && ft == H5D_FILL_TIME_IFSET)) { + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoFill/>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + else { + xml_dump_fill_value(dcpl, type); + } + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + dump_indent -= COL; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + dump_indent -= COL; + + dump_function_table->dump_dataspace_function(space); + dump_function_table->dump_datatype_function(type); + + ctx.indent_level++; + dump_indent += COL; + + if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { + if (H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end if */ + else { + if (H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { + error_msg("error getting attribute information\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end if */ + } /* end else */ + + ctx.indent_level--; + dump_indent -= COL; + tempi = H5Dget_storage_size(did); + + if (display_data && (tempi > 0)) { + switch (H5Tget_class(type)) { + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_ENUM: + case H5T_ARRAY: + ctx.indent_level++; + dump_indent += COL; + dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); + ctx.indent_level--; + dump_indent -= COL; + break; + + case H5T_TIME: + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level--; + break; + + case H5T_COMPOUND: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.indent_level++; + dump_indent += COL; + dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); + ctx.indent_level--; + dump_indent -= COL; + break; + + case H5T_REFERENCE: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + if (!H5Tequal(type, H5T_STD_REF_OBJ)) { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + else { + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + xml_print_refs(did, DATASET_DATA); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + + case H5T_VLEN: + ctx.indent_level--; + dump_indent -= COL; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ""); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + dump_indent += COL; + + ctx.indent_level++; + dump_indent += COL; + dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0); + ctx.indent_level--; + dump_indent -= COL; + break; + default: + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", H5Tget_class(type)); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + break; + } + } + else { + /* no data written */ + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + } + + H5Tclose(type); + H5Sclose(space); + H5Pclose(dcpl); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "", xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: xml_print_enum + * + * Purpose: Print the values of an HDF5 ENUM in XML. + * Very similar to regular DDL output. + * + * Return: void + * + * Programmer: REMcG + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +xml_print_enum(hid_t type) +{ + char **name = NULL; /*member names */ + unsigned char *value = NULL; /*value array */ + unsigned nmembs; /*number of members */ + hid_t super; /*enum base integer type */ + hid_t native = -1; /*native integer datatype */ + size_t dst_size; /*destination value type size */ + unsigned i; /*miscellaneous counters */ + size_t j; + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *outputformat = &xml_dataformat; + h5tool_format_t string_dataformat; + hsize_t curr_pos = 0; /* total data element position */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + HDmemset(&ctx, 0, sizeof(ctx)); + ctx.indent_level = dump_indent/COL; + ctx.cur_column = dump_indent; + + string_dataformat = *outputformat; + + if (fp_format) { + string_dataformat.fmt_double = fp_format; + string_dataformat.fmt_float = fp_format; + } + + if (h5tools_nCols==0) { + string_dataformat.line_ncols = 65535; + string_dataformat.line_per_line = 1; + } + else + string_dataformat.line_ncols = h5tools_nCols; + + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + + nmembs = (unsigned)H5Tget_nmembers(type); + super = H5Tget_super(type); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + xml_print_datatype(super,0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + /* + * Determine what datatype to use for the native values. To simplify + * things we entertain three possibilities: + * 1. long long -- the largest native signed integer + * 2. unsigned long long -- the largest native unsigned integer + * 3. raw format + */ + if (H5Tget_size(type) <= sizeof(long long)) { + dst_size = sizeof(long long); + + if (H5T_SGN_NONE == H5Tget_sign(type)) { + native = H5T_NATIVE_ULLONG; + } + else { + native = H5T_NATIVE_LLONG; + } + } + else { + dst_size = H5Tget_size(type); + } + + /* Get the names and raw values of all members */ + name = (char **)HDcalloc(nmembs, sizeof(char *)); + value = (unsigned char *)HDcalloc(nmembs, MAX(H5Tget_size(type), dst_size)); + + for (i = 0; i < nmembs; i++) { + name[i] = H5Tget_member_name(type, i); + H5Tget_member_value(type, i, value + i * H5Tget_size(type)); + } + + /* Convert values to native datatype */ + if (native > 0) + H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT); + + /* Sort members by increasing value */ + /*not implemented yet */ + + /* Print members */ + ctx.indent_level++; + dump_indent += COL; + for (i = 0; i < nmembs; i++) { + char *t_name = xml_escape_the_name(name[i]); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sEnumElement>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", t_name); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + HDfree(t_name); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "<%sEnumValue>",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level++; + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + if (native < 0) { + h5tools_str_append(&buffer, "0x"); + + for (j = 0; j < dst_size; j++) + h5tools_str_append(&buffer, "%02x", value[i * dst_size + j]); + } + else if (H5T_SGN_NONE == H5Tget_sign(native)) { + h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *) + ((void *) (value + i * dst_size)))); + } + else { + h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "d", + *((long long *) ((void *) (value + i * dst_size)))); + } + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + ctx.indent_level--; + + ctx.need_prefix = TRUE; + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); + + /* Render the element */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "",xmlnsprefix); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + } + ctx.indent_level--; + dump_indent -= COL; + + h5tools_str_close(&buffer); + + /* Release resources */ + for (i = 0; i < nmembs; i++) + HDfree(name[i]); + + HDfree(name); + HDfree(value); + H5Tclose(super); +} + diff --git a/tools/h5dump/h5dump_xml.h b/tools/h5dump/h5dump_xml.h new file mode 100644 index 0000000..28485f8 --- /dev/null +++ b/tools/h5dump/h5dump_xml.h @@ -0,0 +1,128 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifndef H5DUMP_XML_H__ +#define H5DUMP_XML_H__ + +extern const char *xmlnsprefix; + +/* + * Alternative formating for data dumped to XML + * In general, the numbers are the same, but separators + * except spaces are not used. + * + * Some of these are not used, as some kinds of data are + * dumped in completely new subroutines. + * + * Some of this formatting may yet need to change. + * + * This table only affects XML output. + */ +static h5tool_format_t xml_dataformat = { + 0, /*raw */ + + "", /*fmt_raw */ + "%d", /*fmt_int */ + "%u", /*fmt_uint */ + "%hhd", /*fmt_schar */ + "%u", /*fmt_uchar */ + "%d", /*fmt_short */ + "%u", /*fmt_ushort */ + "%ld", /*fmt_long */ + "%lu", /*fmt_ulong */ + NULL, /*fmt_llong */ + NULL, /*fmt_ullong */ + "%g", /*fmt_double */ + "%g", /*fmt_float */ + + 0, /*ascii */ + 0, /*str_locale */ + 0, /*str_repeat */ + + "", /*arr_pre */ + "", /*arr_sep */ + "", /*arr_suf */ + 1, /*arr_linebreak */ + + "", /*cmpd_name */ + "", /*cmpd_sep */ + "", /*cmpd_pre */ + "", /*cmpd_suf */ + "", /*cmpd_end */ + + " ", /*vlen_sep */ + " ", /*vlen_pre */ + "", /*vlen_suf */ + "", /*vlen_end */ + + "%s", /*elmt_fmt */ + "", /*elmt_suf1 */ + " ", /*elmt_suf2 */ + + "", /*idx_n_fmt */ + "", /*idx_sep */ + "", /*idx_fmt */ + + 80, /*line_ncols *//*standard default columns */ + 0, /*line_per_line */ + "", /*line_pre */ + "%s", /*line_1st */ + "%s", /*line_cont */ + "", /*line_suf */ + "", /*line_sep */ + 1, /*line_multi_new */ + " ", /*line_indent */ + + 1, /*skip_first */ + + 1, /*obj_hidefileno */ + " "H5_PRINTF_HADDR_FMT, /*obj_format */ + + 1, /*dset_hidefileno */ + "DATASET %s ", /*dset_format */ + "%s", /*dset_blockformat_pre */ + "%s", /*dset_ptformat_pre */ + "%s", /*dset_ptformat */ + 0, /*array indices */ + 0 /*escape non printable characters */ +}; + +#ifdef __cplusplus +extern "C" { +#endif + +/* internal functions used by XML option */ +static void xml_print_datatype(hid_t, unsigned); +static void xml_print_enum(hid_t); +static int xml_print_refs(hid_t, int); +static int xml_print_strs(hid_t, int); +static char *xml_escape_the_string(const char *, int); +static char *xml_escape_the_name(const char *); + +/* The dump functions of the dump_function_table */ +/* XML format: same interface, alternative output */ + +void xml_dump_group(hid_t, const char *); +void xml_dump_named_datatype(hid_t, const char *); +void xml_dump_dataset(hid_t, const char *, struct subset_t *); +void xml_dump_dataspace(hid_t space); +void xml_dump_datatype(hid_t type); +herr_t xml_dump_attr(hid_t, const char *, const H5A_info_t *, void *); +void xml_dump_data(hid_t, int, struct subset_t *, int); + +#ifdef __cplusplus +} +#endif + +#endif /* !H5DUMP_XML_H__ */ diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index ab67db8..ba9741b 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -1941,9 +1941,9 @@ static void gent_objref(void) const char *write_comment = "Foo!"; /* Comments for group */ /* Allocate write & read buffers */ - wbuf = (hobj_ref_t*) malloc(sizeof(hobj_ref_t) * SPACE1_DIM1); - rbuf = (hobj_ref_t*) malloc(sizeof(hobj_ref_t) * SPACE1_DIM1); - tbuf = (hobj_ref_t*) malloc(sizeof(hobj_ref_t) * SPACE1_DIM1); + wbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1); + rbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1); + tbuf = (hobj_ref_t*) HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1); /* Create file */ fid1 = H5Fcreate(FILE16, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2022,9 +2022,9 @@ static void gent_objref(void) H5Fclose(fid1); /* Free memory buffers */ - free(wbuf); - free(rbuf); - free(tbuf); + HDfree(wbuf); + HDfree(rbuf); + HDfree(tbuf); } static void gent_datareg(void) @@ -2051,10 +2051,10 @@ static void gent_datareg(void) int i; /* counting variables */ /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t*) calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); - rbuf = (hdset_reg_ref_t*) malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1); - dwbuf = (uint8_t*) malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - drbuf = (uint8_t*) calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); + wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + rbuf = (hdset_reg_ref_t*) HDmalloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1); + dwbuf = (uint8_t*) HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); + drbuf = (uint8_t*) HDcalloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); /* Create file */ fid1 = H5Fcreate(FILE17, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2128,10 +2128,10 @@ static void gent_datareg(void) H5Fclose(fid1); /* Free memory buffers */ - free(wbuf); - free(rbuf); - free(dwbuf); - free(drbuf); + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); } static void gent_attrreg(void) @@ -2160,13 +2160,13 @@ static void gent_attrreg(void) int i; /* counting variables */ /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t*) calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); - rbuf = (hdset_reg_ref_t*) malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1); - dwbuf = (uint8_t*) malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); - drbuf = (uint8_t*) calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); + wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + rbuf = (hdset_reg_ref_t*) HDmalloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1); + dwbuf = (uint8_t*) HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); + drbuf = (uint8_t*) HDcalloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); /* Create file */ - fid1 = H5Fcreate(FILE65, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(FILE64, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /* Create dataspace for datasets */ sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL); @@ -2248,10 +2248,10 @@ static void gent_attrreg(void) H5Fclose(fid1); /* Free memory buffers */ - free(wbuf); - free(rbuf); - free(dwbuf); - free(drbuf); + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); } /*taken from Elena's compound test file*/ @@ -2466,7 +2466,7 @@ static void gent_vldatatypes(void) for(i = 0; i < SPACE1_DIM1; i++) { int j; - wdata[i].p = malloc((i + 1) * sizeof(int)); + wdata[i].p = HDmalloc((i + 1) * sizeof(int)); wdata[i].len = i + 1; for(j = 0; j < i + 1; j++) @@ -2478,22 +2478,22 @@ static void gent_vldatatypes(void) type = H5Tvlen_create(H5T_NATIVE_INT); dset = H5Dcreate2(file, "Dataset1.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(type); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(space); - assert(ret >= 0); + HDassert(ret >= 0); /* Allocate and initialize VL dataset to write */ for(i = 0; i < SPACE1_DIM1; i++) { int j; - wdata[i].p = malloc((i + 1) * sizeof(float)); + wdata[i].p = HDmalloc((i + 1) * sizeof(float)); wdata[i].len = i + 1; for(j = 0; j < i + 1; j++) @@ -2505,19 +2505,19 @@ static void gent_vldatatypes(void) type = H5Tvlen_create(H5T_NATIVE_FLOAT); dset = H5Dcreate2(file, "Dataset2.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(type); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(space); - assert(ret >= 0); + HDassert(ret >= 0); /* Allocate and initialize a scalar VL dataset to write */ - adata.p = malloc(37 * sizeof(int)); + adata.p = HDmalloc(37 * sizeof(int)); adata.len = 37; for(i = 0; i < 37; i++) @@ -2528,18 +2528,18 @@ static void gent_vldatatypes(void) type = H5Tvlen_create(H5T_NATIVE_INT); dset = H5Dcreate2(file, "Dataset3.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &adata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &adata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(type); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(space); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(file); - assert(ret >= 0); + HDassert(ret >= 0); } static void @@ -2557,14 +2557,14 @@ gent_vldatatypes2(void) /* Allocate and initialize VL data to write */ for(i = 0; i < SPACE1_DIM1; i++) { - wdata[i].p = (hvl_t *)malloc((i + 1) * sizeof(hvl_t)); + wdata[i].p = (hvl_t *)HDmalloc((i + 1) * sizeof(hvl_t)); if(wdata[i].p == NULL) { printf("Cannot allocate memory for VL data! i=%u\n", i); return; } /* end if */ wdata[i].len = i + 1; for(t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) { - t1->p = (unsigned *)malloc((j + 1) * sizeof(unsigned)); + t1->p = (unsigned *)HDmalloc((j + 1) * sizeof(unsigned)); if(t1->p == NULL) { printf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); return; @@ -2592,23 +2592,23 @@ gent_vldatatypes2(void) /* Write dataset to disk */ ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Reclaim the write VL data */ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } @@ -2632,7 +2632,7 @@ static void gent_vldatatypes3(void) for(i=0; i= 0); + HDassert(ret >= 0); ret = H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a dataset */ dataset = H5Dcreate2(fid1, "Dataset1", tid2, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ ret = H5Dwrite(dataset, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Reclaim the write VL data */ ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_vldatatypes4(void) @@ -2699,7 +2699,7 @@ static void gent_vldatatypes4(void) /* Allocate and initialize VL data to write */ for(i=0; i= 0); + HDassert(ret >= 0); ret = H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a datatype to refer to */ tid1 = H5Tvlen_create(tid2); @@ -2730,23 +2730,23 @@ static void gent_vldatatypes4(void) /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Reclaim the write VL data */ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } /* Generate a variable-length dataset with NULL values in it */ @@ -2769,7 +2769,7 @@ static void gent_vldatatypes5(void) } /* end if */ else { wdata[i].len=i+5; - wdata[i].p=malloc(sizeof(unsigned)*(i+5)); + wdata[i].p=HDmalloc(sizeof(unsigned)*(i+5)); for(j=0; j0); + HDassert(fid1>0); /* Create dataspace for datasets */ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); - assert(sid1>0); + HDassert(sid1>0); /* Create a datatype to refer to */ tid1 = H5Tvlen_create(H5T_NATIVE_UINT); - assert(tid1>0); + HDassert(tid1>0); /* Create a dataset */ dataset = H5Dcreate2(fid1, F43_DSETNAME, tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(dataset>0); + HDassert(dataset>0); ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose (sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose (fid1); - assert(ret >= 0); + HDassert(ret >= 0); } /* This is big enough to make h5dump to use hyperslap to read @@ -2848,8 +2848,8 @@ static void gent_array1_big(void) block[0] = 1; /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t*) calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); - wdata = (int *)malloc(sizeof(int) * (size_t)(SPACE_ARRAY1BIG_DIM * ARRAY1BIG_DIM)); + wbuf = (hdset_reg_ref_t*) HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + wdata = (int *)HDmalloc(sizeof(int) * (size_t)(SPACE_ARRAY1BIG_DIM * ARRAY1BIG_DIM)); /* Allocate and initialize array data to write */ for(i = 0; i < SPACE_ARRAY1BIG_DIM; i++) @@ -2873,7 +2873,7 @@ static void gent_array1_big(void) /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /*--------------------------- * Region Reference dataset @@ -2897,17 +2897,17 @@ static void gent_array1_big(void) /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); /* Release memory */ - free(wbuf); - free(wdata); + HDfree(wbuf); + HDfree(wdata); } static void gent_array1(void) @@ -2941,17 +2941,17 @@ static void gent_array1(void) /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_array2(void) @@ -2987,17 +2987,17 @@ static void gent_array2(void) /* Write dataset to disk */ ret = H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_array3(void) @@ -3038,19 +3038,19 @@ static void gent_array3(void) /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_array4(void) @@ -3088,35 +3088,35 @@ static void gent_array4(void) /* Insert integer field */ ret = H5Tinsert(tid2, "i", HOFFSET(s2_t, i), H5T_NATIVE_INT); - assert(ret >= 0); + HDassert(ret >= 0); /* Insert float field */ ret = H5Tinsert(tid2, "f", HOFFSET(s2_t, f), H5T_NATIVE_FLOAT); - assert(ret >= 0); + HDassert(ret >= 0); /* Create an array datatype to refer to */ tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); /* Close compound datatype */ ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a dataset */ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_array5(void) @@ -3156,42 +3156,42 @@ static void gent_array5(void) /* Insert integer field */ ret = H5Tinsert (tid2, "i", HOFFSET(s2_t,i), H5T_NATIVE_INT); - assert(ret >= 0); + HDassert(ret >= 0); /* Create an array of floats datatype */ tid3 = H5Tarray_create2(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1); /* Insert float array field */ ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), tid3); - assert(ret >= 0); + HDassert(ret >= 0); /* Close array of floats field datatype */ ret = H5Tclose(tid3); - assert(ret >= 0); + HDassert(ret >= 0); /* Create an array datatype to refer to */ tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); /* Close compound datatype */ ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a dataset */ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_array6(void) @@ -3210,7 +3210,7 @@ static void gent_array6(void) /* Initialize array data to write */ for(i=0; i= 0); + HDassert(ret >= 0); /* Create a dataset */ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Reclaim the write VL data */ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } static void gent_array7(void) @@ -3271,7 +3271,7 @@ static void gent_array7(void) /* Initialize array data to write */ for(i=0; i= 0); + HDassert(ret >= 0); /* Create an array datatype to refer to */ tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); /* Close VL datatype */ ret = H5Tclose(tid2); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a dataset */ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write dataset to disk */ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Reclaim the write VL data */ ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, wdata); - assert(ret >= 0); + HDassert(ret >= 0); /* Close Dataset */ ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid1); - assert(ret >= 0); + HDassert(ret >= 0); } /* Test the boundary of the display output buffer at the reallocation event */ @@ -3397,30 +3397,30 @@ static void gent_empty(void) dset = H5Dcreate2(file, "Dataset1.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(type); - assert(ret >= 0); + HDassert(ret >= 0); /* write out an empty native integer dataset dataset */ dset = H5Dcreate2(file, "Dataset2.0", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); /* write out an empty native floating-point dataset dataset */ dset = H5Dcreate2(file, "Dataset3.0", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); /* write out an empty array dataset */ type = H5Tarray_create2(H5T_NATIVE_INT, SPACE1_RANK, dims); dset = H5Dcreate2(file, "Dataset4.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(type); - assert(ret >= 0); + HDassert(ret >= 0); /* write out an empty compound dataset */ type = H5Tcreate(H5T_COMPOUND,sizeof(empty_struct)); @@ -3430,15 +3430,15 @@ static void gent_empty(void) dset = H5Dcreate2(file, "Dataset5.0", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(type); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(space); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(file); - assert(ret >= 0); + HDassert(ret >= 0); } static void @@ -3519,7 +3519,7 @@ void gent_split_file(void) root = H5Gopen2(fid, "/", H5P_DEFAULT); atype = H5Tcopy(H5T_C_S1); - H5Tset_size(atype, strlen(meta) + 1); + H5Tset_size(atype, HDstrlen(meta) + 1); H5Tset_strpad(atype, H5T_STR_NULLTERM); dims[0] = 1; @@ -3602,7 +3602,7 @@ void gent_multi(void) HDmemset(memb_name, 0, sizeof memb_name); HDmemset(memb_addr, 0, sizeof memb_addr); - assert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { memb_fapl[mt] = H5P_DEFAULT; @@ -3720,7 +3720,7 @@ static void gent_char(void) hid_t sid1; /* Dataspace ID */ hsize_t dims1[1]; - dims1[0] = strlen(wdata); + dims1[0] = HDstrlen(wdata); /* Create file */ fid1 = H5Fcreate(FILE39, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -3886,10 +3886,10 @@ 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)); + buf5[0].p = HDmalloc(1 * sizeof(int)); ((int *)buf5[0].p)[0] = 1; buf5[1].len = 2; - buf5[1].p = malloc(2 * sizeof(int)); + buf5[1].p = HDmalloc(2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; @@ -3897,9 +3897,9 @@ static void write_attr_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(aid, tid, buf5); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); - assert(status >= 0); + HDassert(status >= 0); status = H5Aclose(aid); status = H5Tclose(tid); status = H5Sclose(sid); @@ -3997,7 +3997,7 @@ static void write_attr_in(hid_t loc_id, for(j = 0; j < 2; j++) { int l; - buf52[i][j].p = malloc((i + 1) * sizeof(int)); + buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); buf52[i][j].len = i + 1; for(l = 0; l < i + 1; l++) ((int *)buf52[i][j].p)[l] = n++; @@ -4008,9 +4008,9 @@ static void write_attr_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(aid, tid, buf52); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52); - assert(status >= 0); + HDassert(status >= 0); status = H5Aclose(aid); status = H5Tclose(tid); status = H5Sclose(sid); @@ -4129,7 +4129,7 @@ static void write_attr_in(hid_t loc_id, for(k = 0; k < 2; k++) { int l; - buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); + buf53[i][j][k].p = HDmalloc((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++; @@ -4141,9 +4141,9 @@ static void write_attr_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT); status = H5Awrite(aid, tid, buf53); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53); - assert(status >= 0); + HDassert(status >= 0); status = H5Aclose(aid); status = H5Tclose(tid); status = H5Sclose(sid); @@ -4328,10 +4328,10 @@ 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)); + buf5[0].p = HDmalloc( 1 * sizeof(int)); ((int *)buf5[0].p)[0]=1; buf5[1].len = 2; - buf5[1].p = malloc( 2 * sizeof(int)); + buf5[1].p = HDmalloc( 2 * sizeof(int)); ((int *)buf5[1].p)[0]=2; ((int *)buf5[1].p)[1]=3; @@ -4339,9 +4339,9 @@ static void write_dset_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5); - assert(status >= 0); + HDassert(status >= 0); status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); @@ -4439,7 +4439,7 @@ static void write_dset_in(hid_t loc_id, for(j = 0; j < 2; j++) { int l; - buf52[i][j].p = malloc((i + 1) * sizeof(int)); + buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); buf52[i][j].len = i + 1; for(l = 0; l < i + 1; l++) ((int *)buf52[i][j].p)[l] = n++; @@ -4449,9 +4449,9 @@ static void write_dset_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52); - assert(status >= 0); + HDassert(status >= 0); status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); @@ -4583,7 +4583,7 @@ static void write_dset_in(hid_t loc_id, for(k = 0; k < 2; k++) { int l; - buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); + buf53[i][j][k].p = HDmalloc((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++; @@ -4593,9 +4593,9 @@ static void write_dset_in(hid_t loc_id, tid = H5Tvlen_create(H5T_NATIVE_INT); did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53); - assert(status >= 0); + HDassert(status >= 0); status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53); - assert(status >= 0); + HDassert(status >= 0); status = H5Dclose(did); status = H5Tclose(tid); status = H5Sclose(sid); @@ -4667,7 +4667,7 @@ static void gent_attr_all(void) sid = H5Screate_simple(1,dims,NULL); did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Sclose(sid); - assert(status >= 0); + HDassert(status >= 0); /* Create groups */ group_id = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -4692,17 +4692,17 @@ static void gent_attr_all(void) /* Close */ status = H5Dclose(did); - assert(status >= 0); + HDassert(status >= 0); status = H5Gclose(group_id); - assert(status >= 0); + HDassert(status >= 0); status = H5Gclose(group2_id); - assert(status >= 0); + HDassert(status >= 0); status = H5Gclose(root_id); - assert(status >= 0); + HDassert(status >= 0); /* Close file */ status = H5Fclose(fid); - assert(status >= 0); + HDassert(status >= 0); } @@ -4854,73 +4854,73 @@ static void gent_compound_complex(void) /* Create the dataspace */ dataspace = H5Screate_simple(F41_RANK, dim, NULL); - assert(dataspace >= 0); + HDassert(dataspace >= 0); /* Create the file */ datafile = H5Fcreate(FILE41, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(datafile >= 0); + HDassert(datafile >= 0); /* Copy the array data type for the string array */ array_tid = H5Tcopy (H5T_C_S1); - assert(array_tid >= 0); + HDassert(array_tid >= 0); /* Set the string array size to Variable */ status = H5Tset_size (array_tid,H5T_VARIABLE); - assert(status >= 0); + HDassert(status >= 0); /* Create the array data type for the string array */ str_array_id = H5Tarray_create2(array_tid, F41_ARRAY_RANK, array_dimb); - assert(str_array_id >= 0); + HDassert(str_array_id >= 0); /* Copy the array data type for the character array */ array1_tid = H5Tcopy (H5T_C_S1); - assert(array1_tid >= 0); + HDassert(array1_tid >= 0); /* Set the character array size */ status = H5Tset_size (array1_tid, F41_ARRAY_DIMc); - assert(status >= 0); + HDassert(status >= 0); /* Create the array data type for the character array */ array2_tid = H5Tarray_create2(H5T_NATIVE_SHORT, F41_ARRAY_RANKd, array_dimd); - assert(array2_tid >= 0); + HDassert(array2_tid >= 0); /* Create the array data type for the character array */ array4_tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F41_ARRAY_RANK, array_dimf); - assert(array4_tid >= 0); + HDassert(array4_tid >= 0); /* Create the memory data type */ Array1Structid = H5Tcreate (H5T_COMPOUND, sizeof(Array1Struct)); - assert(Array1Structid >= 0); + HDassert(Array1Structid >= 0); /* Insert the arrays and variables into the structure */ status = H5Tinsert(Array1Structid, "a_name", HOFFSET(Array1Struct, a), H5T_NATIVE_INT); - assert(status >= 0); + HDassert(status >= 0); status = H5Tinsert(Array1Structid, "b_name", HOFFSET(Array1Struct, b), str_array_id); - assert(status >= 0); + HDassert(status >= 0); status = H5Tinsert(Array1Structid, "c_name", HOFFSET(Array1Struct, c), array1_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tinsert(Array1Structid, "d_name", HOFFSET(Array1Struct, d), array2_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tinsert(Array1Structid, "e_name", HOFFSET(Array1Struct, e), H5T_NATIVE_FLOAT); - assert(status >= 0); + HDassert(status >= 0); status = H5Tinsert(Array1Structid, "f_name", HOFFSET(Array1Struct, f), array4_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tinsert(Array1Structid, "g_name", HOFFSET(Array1Struct, g), H5T_NATIVE_CHAR); - assert(status >= 0); + HDassert(status >= 0); /* Create the dataset */ dataset = H5Dcreate2(datafile, F41_DATASETNAME, Array1Structid, @@ -4929,35 +4929,35 @@ static void gent_compound_complex(void) /* Write data to the dataset */ status = H5Dwrite(dataset, Array1Structid, H5S_ALL, H5S_ALL, H5P_DEFAULT, Array1); - assert(status >= 0); + HDassert(status >= 0); /* Release resources */ status = H5Tclose(Array1Structid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tclose(array_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tclose(array1_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tclose(array2_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tclose(array4_tid); - assert(status >= 0); + HDassert(status >= 0); status = H5Tclose(str_array_id); - assert(status >= 0); + HDassert(status >= 0); status = H5Sclose(dataspace); - assert(status >= 0); + HDassert(status >= 0); status = H5Dclose(dataset); - assert(status >= 0); + HDassert(status >= 0); status = H5Fclose(datafile); - assert(status >= 0); + HDassert(status >= 0); } @@ -4974,7 +4974,7 @@ static void gent_named_dtype_attr(void) /* Create a file */ fid=H5Fcreate(FILE42, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>0); + HDassert(fid>0); /*------------------------------------------------------------------------- * datatype @@ -4983,27 +4983,27 @@ static void gent_named_dtype_attr(void) /* Create a datatype to commit and use */ tid=H5Tcopy(H5T_NATIVE_INT); - assert(tid>0); + HDassert(tid>0); /* Commit datatype to file */ ret = H5Tcommit2(fid, F42_TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a hard link to the datatype */ ret = H5Lcreate_hard(fid, F42_TYPENAME, fid, F42_LINKNAME, H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* Create a scalar dataspace used for all objects */ sid = H5Screate(H5S_SCALAR); - assert(sid > 0); + HDassert(sid > 0); /* Create attribute on commited datatype */ aid = H5Acreate2(tid, F42_ATTRNAME, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT); - assert(aid > 0); + HDassert(aid > 0); /* Write data into the attribute */ ret = H5Awrite(aid, H5T_NATIVE_INT, &data); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * dataset @@ -5012,15 +5012,15 @@ static void gent_named_dtype_attr(void) /* Create dataset */ did = H5Dcreate2(fid, F42_DSETNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(did > 0); + HDassert(did > 0); /* Create attribute on dataset */ aid = H5Acreate2(did, F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT); - assert(aid > 0); + HDassert(aid > 0); /* Write data into the attribute */ ret = H5Awrite(aid, H5T_NATIVE_INT, &data); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * group @@ -5029,15 +5029,15 @@ static void gent_named_dtype_attr(void) /* Create a group */ gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(gid > 0); + HDassert(gid > 0); /* Create attribute on group */ aid = H5Acreate2(gid, F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT); - assert(aid > 0); + HDassert(aid > 0); /* Write data into the attribute */ ret = H5Awrite(aid, H5T_NATIVE_INT, &data); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * close @@ -5046,23 +5046,23 @@ static void gent_named_dtype_attr(void) /* Close attribute */ ret = H5Aclose(aid); - assert(ret >= 0); + HDassert(ret >= 0); /* Close dataset */ ret = H5Dclose(did); - assert(ret >= 0); + HDassert(ret >= 0); /* Close dataspace */ ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); /* Close datatype */ ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); /* Close file */ ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } @@ -5109,7 +5109,7 @@ static void gent_null_space(void) static void gent_zero_dim_size(void) { hid_t fid, root, dataset, space, attr; - hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2}; int dset_buf = 10; int point = 4; @@ -5199,25 +5199,25 @@ make_external(hid_t fid) dcpl = H5Pcreate(H5P_DATASET_CREATE); ret = H5Pset_external(dcpl, "ext1.bin", (off_t)0, size); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_external(dcpl, "ext2.bin", (off_t)0, size); - assert(ret >= 0); + HDassert(ret >= 0); sid = H5Screate_simple(1, cur_size, max_size); - assert(ret >= 0); + HDassert(ret >= 0); dsid = H5Dcreate2(fid, "external", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); H5Dclose(dsid); - assert(ret >= 0); + HDassert(ret >= 0); H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); H5Pclose(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); } /*------------------------------------------------------------------------- @@ -5250,7 +5250,7 @@ static void gent_filters(void) /* create a file */ fid = H5Fcreate(FILE44, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); /* create a space */ sid = H5Screate_simple(SPACE2_RANK, dims1, NULL); @@ -5264,34 +5264,34 @@ static void gent_filters(void) *------------------------------------------------------------------------- */ ret = H5Pset_layout(dcpl, H5D_COMPACT); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"compact",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Oset_comment_by_name(fid, "compact", "This is a dataset with compact storage", H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_layout(dcpl, H5D_CONTIGUOUS); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"contiguous",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Oset_comment_by_name(fid, "contiguous", "This is a dataset with contiguous storage", H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_layout(dcpl, H5D_CHUNKED); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"chunked",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Oset_comment_by_name(fid, "chunked", "This is a dataset with chunked storage", H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * make several dataset with filters @@ -5300,7 +5300,7 @@ static void gent_filters(void) /* set up chunk */ ret = H5Pset_chunk(dcpl, SPACE2_RANK, chunk_dims); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * SZIP @@ -5310,14 +5310,14 @@ static void gent_filters(void) if(h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /* set szip data */ ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"szip",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); } #endif /* H5_HAVE_FILTER_SZIP */ @@ -5328,14 +5328,14 @@ static void gent_filters(void) #if defined (H5_HAVE_FILTER_DEFLATE) /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /* set deflate data */ ret = H5Pset_deflate(dcpl, 9); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"deflate",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); #endif @@ -5346,14 +5346,14 @@ static void gent_filters(void) #if defined (H5_HAVE_FILTER_SHUFFLE) /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /* set the shuffle filter */ ret = H5Pset_shuffle(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"shuffle",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); #endif @@ -5364,14 +5364,14 @@ static void gent_filters(void) #if defined (H5_HAVE_FILTER_FLETCHER32) /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /* set the checksum filter */ ret = H5Pset_fletcher32(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"fletcher32",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); #endif /*------------------------------------------------------------------------- @@ -5381,16 +5381,16 @@ static void gent_filters(void) #if defined (H5_HAVE_FILTER_NBIT) /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /* set the checksum filter */ ret = H5Pset_nbit(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); tid=H5Tcopy(H5T_NATIVE_INT); H5Tset_precision(tid,H5Tget_size(tid)-1); ret=make_dset(fid,"nbit",sid,tid,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); #endif /*------------------------------------------------------------------------- @@ -5400,14 +5400,14 @@ static void gent_filters(void) #if defined (H5_HAVE_FILTER_SCALEOFFSET) /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /* set the scaleoffset filter */ ret = H5Pset_scaleoffset(dcpl,H5Z_SO_INT,(int)H5Tget_size(H5T_NATIVE_INT)); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"scaleoffset",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); #endif /*------------------------------------------------------------------------- @@ -5416,12 +5416,12 @@ static void gent_filters(void) */ /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); #if defined (H5_HAVE_FILTER_SHUFFLE) /* set the shuffle filter */ ret = H5Pset_shuffle(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); #endif #ifdef H5_HAVE_FILTER_SZIP @@ -5429,30 +5429,30 @@ static void gent_filters(void) szip_options_mask=H5_SZIP_CHIP_OPTION_MASK | H5_SZIP_EC_OPTION_MASK; /* set szip data */ ret = H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block); - assert(ret >= 0); + HDassert(ret >= 0); } #endif /* H5_HAVE_FILTER_SZIP */ #if defined (H5_HAVE_FILTER_DEFLATE) /* set deflate data */ ret = H5Pset_deflate(dcpl, 5); - assert(ret >= 0); + HDassert(ret >= 0); #endif #if defined (H5_HAVE_FILTER_FLETCHER32) /* set the checksum filter */ ret = H5Pset_fletcher32(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); #endif #if defined (H5_HAVE_FILTER_NBIT) /* set the nbit filter */ ret = H5Pset_nbit(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); #endif ret=make_dset(fid,"all",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- @@ -5461,20 +5461,20 @@ static void gent_filters(void) */ /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Zregister (H5Z_MYFILTER); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_filter (dcpl, MYFILTER_ID, 0, 0, NULL); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"myfilter",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); /* remove the filters from the dcpl */ ret = H5Premove_filter(dcpl,H5Z_FILTER_ALL); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * make an external dataset @@ -5487,27 +5487,27 @@ static void gent_filters(void) *------------------------------------------------------------------------- */ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"alloc_time_early",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * H5D_ALLOC_TIME_INCR *------------------------------------------------------------------------- */ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"alloc_time_incr",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * H5D_ALLOC_TIME_LATE *------------------------------------------------------------------------- */ ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"alloc_time_late",sid,H5T_NATIVE_INT,dcpl,buf1); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * commit a H5G_TYPE type with a comment @@ -5515,26 +5515,26 @@ static void gent_filters(void) */ tid = H5Tcopy(H5T_STD_B8LE); ret = H5Tcommit2(fid, "mytype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Oset_comment_by_name(fid, "mytype", "This is a commited datatype", H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pclose(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } @@ -5601,7 +5601,7 @@ static void gent_fcontents(void) /* create a file */ fid = H5Fcreate(FILE46, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); write_dset(fid,1,dims,"dset",H5T_NATIVE_INT,buf); @@ -5633,30 +5633,30 @@ static void gent_fcontents(void) /* hard link to "dset" */ ret = H5Lcreate_hard(fid, "/dset", H5L_SAME_LOC, "dset3", H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* hard link to "dset" */ ret = H5Lcreate_hard(fid, "/dset", H5L_SAME_LOC, "dset4", H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* soft link to itself */ ret = H5Lcreate_soft("mylink", fid, "mylink", H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* soft link to "dset" */ ret = H5Lcreate_soft("/dset", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* dangling external link */ ret = H5Lcreate_external("fname", "oname", fid, "extlink", H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* dangling udlink */ ret = H5Lcreate_ud(fid, "udlink", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * datatypes @@ -5664,20 +5664,20 @@ static void gent_fcontents(void) */ tid = H5Tcopy(H5T_NATIVE_INT); ret = H5Tcommit2(fid, "mytype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); /* no name datatype */ tid = H5Tcopy(H5T_NATIVE_INT); ret = H5Tcommit2(fid, "mytype2", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); write_dset(fid, 1, dims, "dsetmytype2", tid, buf); ret = H5Ldelete(fid, "mytype2", H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- @@ -5687,16 +5687,16 @@ static void gent_fcontents(void) ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); /* create a file for the bootblock test */ fid = H5Fcreate(FILE47, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } /*------------------------------------------------------------------------- @@ -5734,7 +5734,7 @@ static void gent_fvalues(void) /* create a file */ fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); /* create a space */ sid = H5Screate_simple(1, dims, NULL); @@ -5748,42 +5748,42 @@ static void gent_fvalues(void) *------------------------------------------------------------------------- */ ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"fill_time_ifset",sid,H5T_NATIVE_INT,dcpl,buf); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * H5D_FILL_TIME_NEVER *------------------------------------------------------------------------- */ ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"fill_time_never",sid,H5T_NATIVE_INT,dcpl,buf); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * H5D_FILL_TIME_ALLOC *------------------------------------------------------------------------- */ ret = H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"fill_time_alloc",sid,H5T_NATIVE_INT,dcpl,buf); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pclose(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * dataset with no fill value @@ -5800,23 +5800,23 @@ static void gent_fvalues(void) H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_CHAR); H5Tinsert(tid, "b", HOFFSET(c_t, b), H5T_NATIVE_DOUBLE); ret = H5Pset_fill_value(dcpl, tid, &fillval2); - assert(ret >= 0); + HDassert(ret >= 0); ret=make_dset(fid,"fill_compound",sid,tid,dcpl,buf2); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Pclose(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * dataset with a H5T_VLEN fill value *------------------------------------------------------------------------- */ buf3[0].len = 1; - buf3[0].p = malloc( 1 * sizeof(int)); + buf3[0].p = HDmalloc( 1 * sizeof(int)); ((int *)buf3[0].p)[0]=1; buf3[1].len = 2; - buf3[1].p = malloc(2 * sizeof(int)); + buf3[1].p = HDmalloc(2 * sizeof(int)); ((int *)buf3[1].p)[0] = 2; ((int *)buf3[1].p)[1] = 3; @@ -5825,17 +5825,17 @@ static void gent_fvalues(void) fillval3.p=NULL; fillval3.len=0; ret = H5Pset_fill_value(dcpl, tid, &fillval3); - assert(ret >= 0); + HDassert(ret >= 0); did = H5Dcreate2(fid, "fill_vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); ret = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf3); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf3); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(did); ret = H5Tclose(tid); ret = H5Pclose(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * dataset with a H5T_ARRAY fill value @@ -5851,9 +5851,9 @@ static void gent_fvalues(void) *------------------------------------------------------------------------- */ ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } @@ -5896,7 +5896,7 @@ static void gent_string(void) /* create a file */ fid = H5Fcreate(FILE49, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); /*------------------------------------------------------------------------- * str1 @@ -5905,11 +5905,11 @@ static void gent_string(void) tid=H5Tcopy(H5T_C_S1); ret = H5Tset_size(tid, sizeof(buf1)); - assert(ret >= 0); + HDassert(ret >= 0); write_dset(fid,1,dims1,"str1",tid,buf1); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * str2 @@ -5918,16 +5918,16 @@ static void gent_string(void) sid = H5Screate_simple(SPACE1_RANK, dims2, NULL); tid = H5Tcopy(H5T_C_S1); ret = H5Tset_size(tid, H5T_VARIABLE); - assert(ret >= 0); + HDassert(ret >= 0); did = H5Dcreate2(fid, "str2", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); ret = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(did); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * str3 @@ -5940,13 +5940,13 @@ static void gent_string(void) H5Tinsert(tid, "a", HOFFSET(c_t, a), H5T_NATIVE_INT); H5Tinsert(tid, "str", HOFFSET(c_t, str), str_tid ); ret=make_dset(fid,"str3",sid,tid,H5P_DEFAULT,&buf3); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Tclose(str_tid); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * str4 @@ -5955,14 +5955,14 @@ static void gent_string(void) sid = H5Screate_simple(SPACE1_RANK, dims4, NULL); ret=make_dset(fid,"str4",sid,H5T_NATIVE_CHAR,H5P_DEFAULT,buf4); ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } @@ -6005,7 +6005,7 @@ static void gent_aindices(void) /* create a file */ fid = H5Fcreate(FILE50, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); /*------------------------------------------------------------------------- * root datasets @@ -6038,7 +6038,7 @@ static void gent_aindices(void) *------------------------------------------------------------------------- */ ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); } @@ -6060,34 +6060,34 @@ static void gent_longlinks(void) /* Create files */ fid = H5Fcreate(FILE51, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid >= 0); + HDassert(fid >= 0); /* Create group with short name in file (used as target for hard links) */ gid = H5Gcreate2(fid, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(gid >= 0); + HDassert(gid >= 0); /* Construct very long file name */ objname = (char*) HDmalloc((size_t)(F51_MAX_NAME_LEN + 1)); - assert(objname); + HDassert(objname); for(u = 0; u < F51_MAX_NAME_LEN; u++) objname[u] = 'a'; objname[F51_MAX_NAME_LEN] = '\0'; /* Create hard link to existing object */ - assert(H5Lcreate_hard(fid, "grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) >= 0); + HDassert(H5Lcreate_hard(fid, "grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) >= 0); /* Create soft link to existing object */ objname[0] = 'b'; - assert(H5Lcreate_soft("grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) >= 0); + HDassert(H5Lcreate_soft("grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) >= 0); /* Create group with long name in existing group */ gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(gid2 >= 0); + HDassert(gid2 >= 0); /* Close objects */ - assert(H5Gclose(gid2) >= 0); - assert(H5Gclose(gid) >= 0); - assert(H5Fclose(fid) >= 0); + HDassert(H5Gclose(gid2) >= 0); + HDassert(H5Gclose(gid) >= 0); + HDassert(H5Fclose(fid) >= 0); /* Release memory */ HDfree(objname); @@ -6237,7 +6237,7 @@ gent_bigdims(void) /* create a file */ fid = H5Fcreate(FILE56, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid >= 0); + HDassert(fid >= 0); /* create dataset */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) @@ -6263,7 +6263,7 @@ gent_bigdims(void) if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0) goto out; - buf=(char *) malloc((unsigned)(nelmts*size)); + buf=(char *) HDmalloc((unsigned)(nelmts*size)); for(i=0, c=0; i= 0); + HDassert(ret >= 0); return; @@ -6331,20 +6331,20 @@ gent_hyperslab(void) double *buf; int i, ret; - buf = (double*) malloc(32 * 4097 * sizeof(double) ); + buf = (double*) HDmalloc(32 * 4097 * sizeof(double) ); for(i = 0; i < 32 * 4097; i++) buf[i] = 1; /* create a file */ fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + HDassert(fid>=0); write_dset(fid,2,dims,"stripmine",H5T_NATIVE_DOUBLE,buf); ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); - free(buf); + HDfree(buf); } /*------------------------------------------------------------------------- @@ -6913,8 +6913,8 @@ gent_extlinks(void) * Three more datasets of 1, 2 and 4 bytes of signed int types are created. * Fill them with raw data such that no bit will be all zero in a dataset. * A dummy dataset of double type is created for failure test. - * Created: Albert Cheng, 2010/5/10. - * Modified: + * Created: Albert Cheng, 2010/5/10. + * Modified: Allen Byrne, 2011/1/5 Use file to test Signed/Unsigned datatypes *------------------------------------------------------------------------- */ static void @@ -6940,13 +6940,13 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu8bits = (uint8_t) ~0u; /* all 1s */ + valu8bits = (uint8_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu8[i][0] = valu8bits; - for(j = 1; j < dims[1]; j++) { + dsetu8[i][0] = valu8bits; + for(j = 1; j < dims[1]; j++) { dsetu8[i][j] = dsetu8[i][j-1] << 1; - } - valu8bits <<= 1; + } + valu8bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); @@ -6960,11 +6960,11 @@ gent_packedbits(void) valu16bits = (uint16_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu16[i][0] = valu16bits; - for(j = 1; j < dims[1]; j++) { + dsetu16[i][0] = valu16bits; + for(j = 1; j < dims[1]; j++) { dsetu16[i][j] = dsetu16[i][j-1] << 1; - } - valu16bits <<= 1; + } + valu16bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); @@ -6978,10 +6978,10 @@ gent_packedbits(void) valu32bits = (uint32_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu32[i][0] = valu32bits; - for(j = 1; j < dims[1]; j++) { + dsetu32[i][0] = valu32bits; + for(j = 1; j < dims[1]; j++) { dsetu32[i][j] = dsetu32[i][j-1] << 1; - } + } valu32bits <<= 1; } @@ -6996,11 +6996,11 @@ gent_packedbits(void) valu64bits = (uint64_t) ~0Lu; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dsetu64[i][0] = valu64bits; - for(j = 1; j < dims[1]; j++) { + dsetu64[i][0] = valu64bits; + for(j = 1; j < dims[1]; j++) { dsetu64[i][j] = dsetu64[i][j-1] << 1; - } - valu64bits <<= 1; + } + valu64bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64); @@ -7014,11 +7014,11 @@ gent_packedbits(void) val8bits = (int8_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset8[i][0] = val8bits; - for(j = 1; j < dims[1]; j++) { + dset8[i][0] = val8bits; + for(j = 1; j < dims[1]; j++) { dset8[i][j] = dset8[i][j-1] << 1; - } - val8bits <<= 1; + } + val8bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); @@ -7032,11 +7032,11 @@ gent_packedbits(void) val16bits = (int16_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset16[i][0] = val16bits; - for(j = 1; j < dims[1]; j++) { + dset16[i][0] = val16bits; + for(j = 1; j < dims[1]; j++) { dset16[i][j] = dset16[i][j-1] << 1; - } - val16bits <<= 1; + } + val16bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); @@ -7050,11 +7050,11 @@ gent_packedbits(void) val32bits = (int32_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset32[i][0] = val32bits; - for(j = 1; j < dims[1]; j++) { + dset32[i][0] = val32bits; + for(j = 1; j < dims[1]; j++) { dset32[i][j] = dset32[i][j-1] << 1; - } - val32bits <<= 1; + } + val32bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32); @@ -7068,11 +7068,11 @@ gent_packedbits(void) val64bits = (int64_t) ~0L; /* all 1s */ for(i = 0; i < dims[0]; i++){ - dset64[i][0] = val64bits; - for(j = 1; j < dims[1]; j++) { + dset64[i][0] = val64bits; + for(j = 1; j < dims[1]; j++) { dset64[i][j] = dset64[i][j-1] << 1; - } - val64bits <<= 1; + } + val64bits <<= 1; } H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64); @@ -7095,7 +7095,6 @@ gent_packedbits(void) H5Fclose(fid); } - /*------------------------------------------------------------------------- * Function: main * diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 8cac31f..03f399b 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -136,6 +136,7 @@ $SRC_H5DUMP_TESTFILES/tmulti-r.h5 $SRC_H5DUMP_TESTFILES/tmulti-s.h5 $SRC_H5DUMP_TESTFILES/tnamed_dtype_attr.h5 $SRC_H5DUMP_TESTFILES/tnestedcomp.h5 +$SRC_H5DUMP_TESTFILES/tno-subset.h5 $SRC_H5DUMP_TESTFILES/tnullspace.h5 $SRC_H5DUMP_TESTFILES/zerodim.h5 $SRC_H5DUMP_TESTFILES/torderattr.h5 @@ -244,7 +245,7 @@ $SRC_H5DUMP_TESTFILES/tmulti.ddl $SRC_H5DUMP_TESTFILES/tnamed_dtype_attr.ddl $SRC_H5DUMP_TESTFILES/tnestcomp-1.ddl $SRC_H5DUMP_TESTFILES/tnbit.ddl -$SRC_H5DUMP_TESTFILES/tnofilename.ddl +$SRC_H5DUMP_TESTFILES/tno-subset.ddl $SRC_H5DUMP_TESTFILES/tnullspace.ddl $SRC_H5DUMP_TESTFILES/zerodim.ddl $SRC_H5DUMP_TESTFILES/tordergr1.ddl @@ -282,6 +283,7 @@ $SRC_H5DUMP_TESTFILES/tvlstr.ddl $SRC_H5DUMP_TESTFILES/tvms.ddl $SRC_H5DUMP_TESTFILES/h5dump-help.txt $SRC_H5DUMP_TESTFILES/out3.h5import +$SRC_H5DUMP_TESTFILES/tnofilename-with-packed-bits.ddl $SRC_H5DUMP_TESTFILES/tpbitsArray.ddl $SRC_H5DUMP_TESTFILES/tpbitsCompound.ddl $SRC_H5DUMP_TESTFILES/tpbitsIncomplete.ddl @@ -484,7 +486,7 @@ TOOLTEST() { TESTING $DUMPER $@ ( cd $TESTDIR - $RUNSERIAL $DUMPER_BIN $@ + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -531,7 +533,7 @@ TOOLTEST2() { TESTING $DUMPER $@ ( cd $TESTDIR - $RUNSERIAL $DUMPER_BIN $@ + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err cat $actual_err >> $actual @@ -582,7 +584,7 @@ TOOLTEST3() { TESTING $DUMPER $@ ( cd $TESTDIR - $RUNSERIAL $DUMPER_BIN $@ + $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -696,175 +698,178 @@ IMPORTTEST() # prepare for test COPY_TESTFILES_TO_TESTDIR +#TOOLTEST h5dump-help.txt -h + # test for signed/unsigned datasets -TOOLTEST packedbits.ddl packedbits.h5 +TOOLTEST packedbits.ddl --enable-error-stack packedbits.h5 # test for displaying groups -TOOLTEST tgroup-1.ddl tgroup.h5 +TOOLTEST tgroup-1.ddl --enable-error-stack tgroup.h5 # test for displaying the selected groups TOOLTEST tgroup-2.ddl --group=/g2 --group / -g /y tgroup.h5 # test for displaying simple space datasets -TOOLTEST tdset-1.ddl tdset.h5 +TOOLTEST tdset-1.ddl --enable-error-stack tdset.h5 # test for displaying selected datasets TOOLTEST tdset-2.ddl -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5 # test for displaying attributes -TOOLTEST tattr-1.ddl tattr.h5 +TOOLTEST tattr-1.ddl --enable-error-stack tattr.h5 # test for displaying the selected attributes of string type and scalar space -TOOLTEST tattr-2.ddl -a /attr1 --attribute /attr4 --attribute=/attr5 tattr.h5 +TOOLTEST tattr-2.ddl --enable-error-stack -a /attr1 --attribute /attr4 --attribute=/attr5 tattr.h5 # test for header and error messages TOOLTEST tattr-3.ddl --header -a /attr2 --attribute=/attr tattr.h5 # test for displaying at least 9 attributes on root from a BE machine -TOOLTEST tattr-4_be.ddl tattr4_be.h5 +TOOLTEST tattr-4_be.ddl --enable-error-stack tattr4_be.h5 # test for displaying attributes in shared datatype (also in group and dataset) -TOOLTEST tnamed_dtype_attr.ddl tnamed_dtype_attr.h5 +TOOLTEST tnamed_dtype_attr.ddl --enable-error-stack tnamed_dtype_attr.h5 # test for displaying soft links and user-defined links -TOOLTEST tslink-1.ddl tslink.h5 -TOOLTEST tudlink-1.ddl tudlink.h5 +TOOLTEST tslink-1.ddl --enable-error-stack tslink.h5 +TOOLTEST tudlink-1.ddl --enable-error-stack tudlink.h5 # test for displaying the selected link -TOOLTEST tslink-2.ddl -l slink2 tslink.h5 -TOOLTEST tudlink-2.ddl -l udlink2 tudlink.h5 +TOOLTEST tslink-2.ddl --enable-error-stack -l slink2 tslink.h5 +TOOLTEST tudlink-2.ddl --enable-error-stack -l udlink2 tudlink.h5 # tests for hard links -TOOLTEST thlink-1.ddl thlink.h5 -TOOLTEST thlink-2.ddl -d /g1/dset2 --dataset /dset1 --dataset=/g1/g1.1/dset3 thlink.h5 -TOOLTEST thlink-3.ddl -d /g1/g1.1/dset3 --dataset /g1/dset2 --dataset=/dset1 thlink.h5 -TOOLTEST thlink-4.ddl -g /g1 thlink.h5 -TOOLTEST thlink-5.ddl -d /dset1 -g /g2 -d /g1/dset2 thlink.h5 +TOOLTEST thlink-1.ddl --enable-error-stack thlink.h5 +TOOLTEST thlink-2.ddl --enable-error-stack -d /g1/dset2 --dataset /dset1 --dataset=/g1/g1.1/dset3 thlink.h5 +TOOLTEST thlink-3.ddl --enable-error-stack -d /g1/g1.1/dset3 --dataset /g1/dset2 --dataset=/dset1 thlink.h5 +TOOLTEST thlink-4.ddl --enable-error-stack -g /g1 thlink.h5 +TOOLTEST thlink-5.ddl --enable-error-stack -d /dset1 -g /g2 -d /g1/dset2 thlink.h5 # tests for compound data types -TOOLTEST tcomp-1.ddl tcompound.h5 +TOOLTEST tcomp-1.ddl --enable-error-stack tcompound.h5 # test for named data types -TOOLTEST tcomp-2.ddl -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5 +TOOLTEST tcomp-2.ddl --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5 # test for unamed type +# JIRA HDFFV-7936 TOOLTEST tcomp-3.ddl --enable-error-stack -t /#6632 -g /group2 tcompound.h5 TOOLTEST tcomp-3.ddl -t /#6632 -g /group2 tcompound.h5 # test complicated compound datatype -TOOLTEST tcomp-4.ddl tcompound_complex.h5 +TOOLTEST tcomp-4.ddl --enable-error-stack tcompound_complex.h5 #test for the nested compound type -TOOLTEST tnestcomp-1.ddl tnestedcomp.h5 +TOOLTEST tnestcomp-1.ddl --enable-error-stack tnestedcomp.h5 # test for options +# JIRA HDFFV-7936 TOOLTEST tall-1.ddl --enable-error-stack tall.h5 TOOLTEST tall-1.ddl tall.h5 -TOOLTEST tall-2.ddl --header -g /g1/g1.1 -a attr2 tall.h5 -TOOLTEST tall-3.ddl -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5 +TOOLTEST tall-2.ddl --enable-error-stack --header -g /g1/g1.1 -a attr2 tall.h5 +TOOLTEST tall-3.ddl --enable-error-stack -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5 # test for loop detection -TOOLTEST tloop-1.ddl tloop.h5 +TOOLTEST tloop-1.ddl --enable-error-stack tloop.h5 # test for string -TOOLTEST tstr-1.ddl tstr.h5 -TOOLTEST tstr-2.ddl tstr2.h5 +TOOLTEST tstr-1.ddl --enable-error-stack tstr.h5 +TOOLTEST tstr-2.ddl --enable-error-stack tstr2.h5 # test for file created by Lib SAF team -TOOLTEST tsaf.ddl tsaf.h5 +TOOLTEST tsaf.ddl --enable-error-stack tsaf.h5 # test for file with variable length data -TOOLTEST tvldtypes1.ddl tvldtypes1.h5 -TOOLTEST tvldtypes2.ddl tvldtypes2.h5 -TOOLTEST tvldtypes3.ddl tvldtypes3.h5 -TOOLTEST tvldtypes4.ddl tvldtypes4.h5 -TOOLTEST tvldtypes5.ddl tvldtypes5.h5 +TOOLTEST tvldtypes1.ddl --enable-error-stack tvldtypes1.h5 +TOOLTEST tvldtypes2.ddl --enable-error-stack tvldtypes2.h5 +TOOLTEST tvldtypes3.ddl --enable-error-stack tvldtypes3.h5 +TOOLTEST tvldtypes4.ddl --enable-error-stack tvldtypes4.h5 +TOOLTEST tvldtypes5.ddl --enable-error-stack tvldtypes5.h5 #test for file with variable length string data -TOOLTEST tvlstr.ddl tvlstr.h5 +TOOLTEST tvlstr.ddl --enable-error-stack tvlstr.h5 # test for files with array data -TOOLTEST tarray1.ddl tarray1.h5 +TOOLTEST tarray1.ddl --enable-error-stack tarray1.h5 # # added for bug# 2092 - tarray1_big.h +# JIRA HDFFV-7936 TOOLTEST tarray1_big.ddl --enable-error-stack -R tarray1_big.h5 TOOLTEST tarray1_big.ddl -R tarray1_big.h5 -TOOLTEST tarray2.ddl tarray2.h5 -TOOLTEST tarray3.ddl tarray3.h5 -TOOLTEST tarray4.ddl tarray4.h5 -TOOLTEST tarray5.ddl tarray5.h5 -TOOLTEST tarray6.ddl tarray6.h5 -TOOLTEST tarray7.ddl tarray7.h5 -TOOLTEST tarray8.ddl tarray8.h5 +TOOLTEST tarray2.ddl --enable-error-stack tarray2.h5 +TOOLTEST tarray3.ddl --enable-error-stack tarray3.h5 +TOOLTEST tarray4.ddl --enable-error-stack tarray4.h5 +TOOLTEST tarray5.ddl --enable-error-stack tarray5.h5 +TOOLTEST tarray6.ddl --enable-error-stack tarray6.h5 +TOOLTEST tarray7.ddl --enable-error-stack tarray7.h5 +TOOLTEST tarray8.ddl --enable-error-stack tarray8.h5 # test for files with empty data -TOOLTEST tempty.ddl tempty.h5 +TOOLTEST tempty.ddl --enable-error-stack tempty.h5 # test for files with groups that have comments -TOOLTEST tgrp_comments.ddl tgrp_comments.h5 +TOOLTEST tgrp_comments.ddl --enable-error-stack tgrp_comments.h5 # test the --filedriver flag -TOOLTEST tsplit_file.ddl --filedriver=split tsplit_file -TOOLTEST tfamily.ddl --filedriver=family tfamily%05d.h5 -TOOLTEST tmulti.ddl --filedriver=multi tmulti +TOOLTEST tsplit_file.ddl --enable-error-stack --filedriver=split tsplit_file +TOOLTEST tfamily.ddl --enable-error-stack --filedriver=family tfamily%05d.h5 +TOOLTEST tmulti.ddl --enable-error-stack --filedriver=multi tmulti # test for files with group names which reach > 1024 bytes in size -TOOLTEST tlarge_objname.ddl -w157 tlarge_objname.h5 +TOOLTEST tlarge_objname.ddl --enable-error-stack -w157 tlarge_objname.h5 # test '-A' to suppress data but print attr's +# JIRA HDFFV-7936 TOOLTEST tall-2A.ddl --enable-error-stack -A tall.h5 TOOLTEST tall-2A.ddl -A tall.h5 # test '-r' to print attributes in ASCII instead of decimal +# JIRA HDFFV-7936 TOOLTEST tall-2B.ddl --enable-error-stack -A -r tall.h5 TOOLTEST tall-2B.ddl -A -r tall.h5 # test Subsetting -TOOLTEST tall-4s.ddl --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5 -TOOLTEST tall-5s.ddl -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall.h5 -TOOLTEST tdset-3s.ddl -d "/dset1[1,1;;;]" tdset.h5 - +TOOLTEST tall-4s.ddl --enable-error-stack --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5 +TOOLTEST tall-5s.ddl --enable-error-stack -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall.h5 +TOOLTEST tdset-3s.ddl --enable-error-stack -d "/dset1[1,1;;;]" tdset.h5 +TOOLTEST tno-subset.ddl --no-compact-subset -d "AHFINDERDIRECT::ah_centroid_t[0] it=0 tl=0" tno-subset.h5 # test printing characters in ASCII instead of decimal -TOOLTEST tchar1.ddl -r tchar.h5 - -# test failure handling -# Missing file name -TOOLTEST tnofilename.ddl +TOOLTEST tchar1.ddl --enable-error-stack -r tchar.h5 # rev. 2004 # tests for super block -TOOLTEST tboot1.ddl -H -B -d dset tfcontents1.h5 -TOOLTEST tboot2.ddl -B tfcontents2.h5 +TOOLTEST tboot1.ddl --enable-error-stack -H -B -d dset tfcontents1.h5 +TOOLTEST tboot2.ddl --enable-error-stack -B tfcontents2.h5 # test -p with a non existing dataset TOOLTEST tperror.ddl -p -d bogus tfcontents1.h5 # test for file contents -TOOLTEST tcontents.ddl -n tfcontents1.h5 +TOOLTEST tcontents.ddl --enable-error-stack -n tfcontents1.h5 # tests for storage layout # compact -TOOLTEST tcompact.ddl -H -p -d compact tfilters.h5 +TOOLTEST tcompact.ddl --enable-error-stack -H -p -d compact tfilters.h5 # contiguous -TOOLTEST tcontiguos.ddl -H -p -d contiguous tfilters.h5 +TOOLTEST tcontiguos.ddl --enable-error-stack -H -p -d contiguous tfilters.h5 # chunked -TOOLTEST tchunked.ddl -H -p -d chunked tfilters.h5 +TOOLTEST tchunked.ddl --enable-error-stack -H -p -d chunked tfilters.h5 # external -TOOLTEST texternal.ddl -H -p -d external tfilters.h5 +TOOLTEST texternal.ddl --enable-error-stack -H -p -d external tfilters.h5 # fill values -TOOLTEST tfill.ddl -p tfvalues.h5 +TOOLTEST tfill.ddl --enable-error-stack -p tfvalues.h5 # several datatype, with references , print path -TOOLTEST treference.ddl tattr2.h5 +TOOLTEST treference.ddl --enable-error-stack tattr2.h5 # escape/not escape non printable characters -TOOLTEST tstringe.ddl -e tstr3.h5 -TOOLTEST tstring.ddl tstr3.h5 +TOOLTEST tstringe.ddl --enable-error-stack -e tstr3.h5 +TOOLTEST tstring.ddl --enable-error-stack tstr3.h5 # char data as ASCII with non escape -TOOLTEST tstring2.ddl -r -d str4 tstr3.h5 +TOOLTEST tstring2.ddl --enable-error-stack -r -d str4 tstr3.h5 # array indices print/not print -TOOLTEST tindicesyes.ddl taindices.h5 -TOOLTEST tindicesno.ddl -y taindices.h5 +TOOLTEST tindicesyes.ddl --enable-error-stack taindices.h5 +TOOLTEST tindicesno.ddl --enable-error-stack -y taindices.h5 ########## array indices with subsetting # 1D case -TOOLTEST tindicessub1.ddl -d 1d -s 1 -S 10 -c 2 -k 3 taindices.h5 +TOOLTEST tindicessub1.ddl --enable-error-stack -d 1d -s 1 -S 10 -c 2 -k 3 taindices.h5 # 2D case -TOOLTEST tindicessub2.ddl -d 2d -s 1,2 -S 3,3 -c 3,2 -k 2,2 taindices.h5 +TOOLTEST tindicessub2.ddl --enable-error-stack -d 2d -s 1,2 -S 3,3 -c 3,2 -k 2,2 taindices.h5 # 3D case -TOOLTEST tindicessub3.ddl -d 3d -s 0,1,2 -S 1,3,3 -c 2,2,2 -k 1,2,2 taindices.h5 +TOOLTEST tindicessub3.ddl --enable-error-stack -d 3d -s 0,1,2 -S 1,3,3 -c 2,2,2 -k 1,2,2 taindices.h5 # 4D case -TOOLTEST tindicessub4.ddl -d 4d -s 0,0,1,2 -c 2,2,3,2 -S 1,1,3,3 -k 1,1,2,2 taindices.h5 +TOOLTEST tindicessub4.ddl --enable-error-stack -d 4d -s 0,0,1,2 -c 2,2,3,2 -S 1,1,3,3 -k 1,1,2,2 taindices.h5 #Exceed the dimensions for subsetting TOOLTEST texceedsubstart.ddl -d 1d -s 1,3 taindices.h5 @@ -924,48 +929,48 @@ else TOOLTEST tallfilters.ddl $option fi # user defined -TOOLTEST tuserfilter.ddl -H -p -d myfilter tfilters.h5 +TOOLTEST tuserfilter.ddl --enable-error-stack -H -p -d myfilter tfilters.h5 # test for displaying objects with very long names -TOOLTEST tlonglinks.ddl tlonglinks.h5 +TOOLTEST tlonglinks.ddl --enable-error-stack tlonglinks.h5 # dimensions over 4GB, print boundary -TOOLTEST tbigdims.ddl -d dset4gb -s 4294967284 -c 22 tbigdims.h5 +TOOLTEST tbigdims.ddl --enable-error-stack -d dset4gb -s 4294967284 -c 22 tbigdims.h5 # hyperslab read -TOOLTEST thyperslab.ddl thyperslab.h5 +TOOLTEST thyperslab.ddl --enable-error-stack thyperslab.h5 # # test for displaying dataset and attribute of null space -TOOLTEST tnullspace.ddl tnullspace.h5 +TOOLTEST tnullspace.ddl --enable-error-stack tnullspace.h5 # test for displaying dataset and attribute of space with 0 dimension size -TOOLTEST zerodim.ddl zerodim.h5 +TOOLTEST zerodim.ddl --enable-error-stack zerodim.h5 # test for long double (some systems do not have long double) -#TOOLTEST tldouble.ddl tldouble.h5 +#TOOLTEST tldouble.ddl --enable-error-stack tldouble.h5 # test for vms -TOOLTEST tvms.ddl tvms.h5 +TOOLTEST tvms.ddl --enable-error-stack tvms.h5 # test for binary output -TOOLTEST tbin1.ddl -d integer -o out1.bin -b LE tbinary.h5 +TOOLTEST tbin1.ddl --enable-error-stack -d integer -o out1.bin -b LE tbinary.h5 # NATIVE default. the NATIVE test can be validated with h5import/h5diff -TOOLTEST tbin1.ddl -d integer -o out1.bin -b tbinary.h5 +TOOLTEST tbin1.ddl --enable-error-stack -d integer -o out1.bin -b tbinary.h5 IMPORTTEST out1.bin -c out3.h5import -o out1.h5 DIFFTEST tbinary.h5 out1.h5 /integer /integer -TOOLTEST tbin2.ddl -b BE -d float -o out2.bin tbinary.h5 +TOOLTEST tbin2.ddl --enable-error-stack -b BE -d float -o out2.bin tbinary.h5 # the NATIVE test can be validated with h5import/h5diff -TOOLTEST tbin3.ddl -d integer -o out3.bin -b NATIVE tbinary.h5 +TOOLTEST tbin3.ddl --enable-error-stack -d integer -o out3.bin -b NATIVE tbinary.h5 IMPORTTEST out3.bin -c out3.h5import -o out3.h5 DIFFTEST tbinary.h5 out3.h5 /integer /integer -TOOLTEST tbin4.ddl -d double -b FILE -o out4.bin tbinary.h5 +TOOLTEST tbin4.ddl --enable-error-stack -d double -b FILE -o out4.bin tbinary.h5 # Clean up binary output files if test -z "$HDF5_NOCLEANUP"; then @@ -975,12 +980,14 @@ if test -z "$HDF5_NOCLEANUP"; then fi # test for dataset region references -TOOLTEST tdatareg.ddl tdatareg.h5 +TOOLTEST tdatareg.ddl --enable-error-stack tdatareg.h5 +# JIRA HDFFV-7936 TOOLTEST tdataregR.ddl --enable-error-stack -R tdatareg.h5 TOOLTEST tdataregR.ddl -R tdatareg.h5 -TOOLTEST tattrreg.ddl tattrreg.h5 +TOOLTEST tattrreg.ddl --enable-error-stack tattrreg.h5 +# JIRA HDFFV-7936 TOOLTEST tattrregR.ddl --enable-error-stack -R tattrreg.h5 TOOLTEST tattrregR.ddl -R tattrreg.h5 -TOOLTEST2 tbinregR.exp -d /Dataset1 -s 0 -R -y -o tbinregR.txt tdatareg.h5 +TOOLTEST2 tbinregR.exp --enable-error-stack -d /Dataset1 -s 0 -R -y -o tbinregR.txt tdatareg.h5 # Clean up text output files if test -z "$HDF5_NOCLEANUP"; then @@ -989,35 +996,42 @@ fi # tests for group creation order # "1" tracked, "2" name, root tracked -TOOLTEST tordergr1.ddl --group=1 --sort_by=creation_order --sort_order=ascending tordergr.h5 -TOOLTEST tordergr2.ddl --group=1 --sort_by=creation_order --sort_order=descending tordergr.h5 -TOOLTEST tordergr3.ddl -g 2 -q name -z ascending tordergr.h5 -TOOLTEST tordergr4.ddl -g 2 -q name -z descending tordergr.h5 -TOOLTEST tordergr5.ddl -q creation_order tordergr.h5 +TOOLTEST tordergr1.ddl --enable-error-stack --group=1 --sort_by=creation_order --sort_order=ascending tordergr.h5 +TOOLTEST tordergr2.ddl --enable-error-stack --group=1 --sort_by=creation_order --sort_order=descending tordergr.h5 +TOOLTEST tordergr3.ddl --enable-error-stack -g 2 -q name -z ascending tordergr.h5 +TOOLTEST tordergr4.ddl --enable-error-stack -g 2 -q name -z descending tordergr.h5 +TOOLTEST tordergr5.ddl --enable-error-stack -q creation_order tordergr.h5 # tests for attribute order -TOOLTEST torderattr1.ddl -H --sort_by=name --sort_order=ascending torderattr.h5 -TOOLTEST torderattr2.ddl -H --sort_by=name --sort_order=descending torderattr.h5 -TOOLTEST torderattr3.ddl -H --sort_by=creation_order --sort_order=ascending torderattr.h5 -TOOLTEST torderattr4.ddl -H --sort_by=creation_order --sort_order=descending torderattr.h5 +TOOLTEST torderattr1.ddl --enable-error-stack -H --sort_by=name --sort_order=ascending torderattr.h5 +TOOLTEST torderattr2.ddl --enable-error-stack -H --sort_by=name --sort_order=descending torderattr.h5 +TOOLTEST torderattr3.ddl --enable-error-stack -H --sort_by=creation_order --sort_order=ascending torderattr.h5 +TOOLTEST torderattr4.ddl --enable-error-stack -H --sort_by=creation_order --sort_order=descending torderattr.h5 # tests for floating point user defined printf format -TOOLTEST tfpformat.ddl -m %.7f tfpformat.h5 +TOOLTEST tfpformat.ddl --enable-error-stack -m %.7f tfpformat.h5 # tests for traversal of external links +# JIRA HDFFV-7936 TOOLTEST textlinksrc.ddl --enable-error-stack textlinksrc.h5 TOOLTEST textlinksrc.ddl textlinksrc.h5 +# JIRA HDFFV-7936 TOOLTEST textlinkfar.ddl --enable-error-stack textlinkfar.h5 TOOLTEST textlinkfar.ddl textlinkfar.h5 # test for dangling external links +# JIRA HDFFV-7936 TOOLTEST textlink.ddl --enable-error-stack textlink.h5 TOOLTEST textlink.ddl textlink.h5 # test for error stack display (BZ2048) TOOLTEST3 filter_fail.ddl --enable-error-stack filter_fail.h5 # test for -o -y for dataset with attributes -TOOLTEST tall-6.ddl -y -o data -d /g1/g1.1/dset1.1.1 tall.h5 +TOOLTEST tall-6.ddl --enable-error-stack -y -o data -d /g1/g1.1/dset1.1.1 tall.h5 + +####### test for dataset packed bits ###### -# test for dataset packed bits +# test failure handling +# Missing file name +TOOLTEST tnofilename-with-packed-bits.ddl # Limits: # Maximum number of packed bits is 8 (for now). # Maximum integer size is 64 (for now). @@ -1027,70 +1041,70 @@ TOOLTEST tall-6.ddl -y -o data -d /g1/g1.1/dset1.1.1 tall.h5 # Normal operation on both signed and unsigned int datasets. # Sanity check # Their rawdata output should be the same. -TOOLTEST tpbitsSignedWhole.ddl -d /DS08BITS -M 0,8 packedbits.h5 -TOOLTEST tpbitsUnsignedWhole.ddl -d /DU08BITS -M 0,8 packedbits.h5 -TOOLTEST tpbitsSignedIntWhole.ddl -d /DS16BITS -M 0,16 packedbits.h5 -TOOLTEST tpbitsUnsignedIntWhole.ddl -d /DU16BITS -M 0,16 packedbits.h5 -TOOLTEST tpbitsSignedLongWhole.ddl -d /DS32BITS -M 0,32 packedbits.h5 -TOOLTEST tpbitsUnsignedLongWhole.ddl -d /DU32BITS -M 0,32 packedbits.h5 -TOOLTEST tpbitsSignedLongLongWhole.ddl -d /DS64BITS -M 0,64 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLongWhole.ddl -d /DU64BITS -M 0,64 packedbits.h5 -TOOLTEST tpbitsSignedLongLongWhole63.ddl -d /DS64BITS -M 0,63 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLongWhole63.ddl -d /DU64BITS -M 0,63 packedbits.h5 -TOOLTEST tpbitsSignedLongLongWhole1.ddl -d /DS64BITS -M 1,63 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLongWhole1.ddl -d /DU64BITS -M 1,63 packedbits.h5 +TOOLTEST tpbitsSignedWhole.ddl --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5 +TOOLTEST tpbitsUnsignedWhole.ddl --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5 +TOOLTEST tpbitsSignedIntWhole.ddl --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5 +TOOLTEST tpbitsUnsignedIntWhole.ddl --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5 +TOOLTEST tpbitsSignedLongWhole.ddl --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5 +TOOLTEST tpbitsUnsignedLongWhole.ddl --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5 +TOOLTEST tpbitsSignedLongLongWhole.ddl --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLongWhole.ddl --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5 +TOOLTEST tpbitsSignedLongLongWhole63.ddl --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLongWhole63.ddl --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5 +TOOLTEST tpbitsSignedLongLongWhole1.ddl --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLongWhole1.ddl --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5 # Half sections -TOOLTEST tpbitsSigned4.ddl -d /DS08BITS -M 0,4,4,4 packedbits.h5 -TOOLTEST tpbitsUnsigned4.ddl -d /DU08BITS -M 0,4,4,4 packedbits.h5 -TOOLTEST tpbitsSignedInt8.ddl -d /DS16BITS -M 0,8,8,8 packedbits.h5 -TOOLTEST tpbitsUnsignedInt8.ddl -d /DU16BITS -M 0,8,8,8 packedbits.h5 -TOOLTEST tpbitsSignedLong16.ddl -d /DS32BITS -M 0,16,16,16 packedbits.h5 -TOOLTEST tpbitsUnsignedLong16.ddl -d /DU32BITS -M 0,16,16,16 packedbits.h5 -TOOLTEST tpbitsSignedLongLong32.ddl -d /DS64BITS -M 0,32,32,32 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLong32.ddl -d /DU64BITS -M 0,32,32,32 packedbits.h5 +TOOLTEST tpbitsSigned4.ddl --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5 +TOOLTEST tpbitsUnsigned4.ddl --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5 +TOOLTEST tpbitsSignedInt8.ddl --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5 +TOOLTEST tpbitsUnsignedInt8.ddl --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5 +TOOLTEST tpbitsSignedLong16.ddl --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5 +TOOLTEST tpbitsUnsignedLong16.ddl --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5 +TOOLTEST tpbitsSignedLongLong32.ddl --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLong32.ddl --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5 # Quarter sections -TOOLTEST tpbitsSigned2.ddl -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5 -TOOLTEST tpbitsUnsigned2.ddl -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5 -TOOLTEST tpbitsSignedInt4.ddl -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5 -TOOLTEST tpbitsUnsignedInt4.ddl -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5 -TOOLTEST tpbitsSignedLong8.ddl -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5 -TOOLTEST tpbitsUnsignedLong8.ddl -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5 -TOOLTEST tpbitsSignedLongLong16.ddl -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLong16.ddl -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5 +TOOLTEST tpbitsSigned2.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5 +TOOLTEST tpbitsUnsigned2.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5 +TOOLTEST tpbitsSignedInt4.ddl --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5 +TOOLTEST tpbitsUnsignedInt4.ddl --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5 +TOOLTEST tpbitsSignedLong8.ddl --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5 +TOOLTEST tpbitsUnsignedLong8.ddl --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5 +TOOLTEST tpbitsSignedLongLong16.ddl --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLong16.ddl --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5 # Begin and End -TOOLTEST tpbitsSigned.ddl -d /DS08BITS -M 0,2,2,6 packedbits.h5 -TOOLTEST tpbitsUnsigned.ddl -d /DU08BITS -M 0,2,2,6 packedbits.h5 -TOOLTEST tpbitsSignedInt.ddl -d /DS16BITS -M 0,2,10,6 packedbits.h5 -TOOLTEST tpbitsUnsignedInt.ddl -d /DU16BITS -M 0,2,10,6 packedbits.h5 -TOOLTEST tpbitsSignedLong.ddl -d /DS32BITS -M 0,2,26,6 packedbits.h5 -TOOLTEST tpbitsUnsignedLong.ddl -d /DU32BITS -M 0,2,26,6 packedbits.h5 -TOOLTEST tpbitsSignedLongLong.ddl -d /DS64BITS -M 0,2,58,6 packedbits.h5 -TOOLTEST tpbitsUnsignedLongLong.ddl -d /DU64BITS -M 0,2,58,6 packedbits.h5 +TOOLTEST tpbitsSigned.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5 +TOOLTEST tpbitsUnsigned.ddl --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5 +TOOLTEST tpbitsSignedInt.ddl --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5 +TOOLTEST tpbitsUnsignedInt.ddl --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5 +TOOLTEST tpbitsSignedLong.ddl --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5 +TOOLTEST tpbitsUnsignedLong.ddl --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5 +TOOLTEST tpbitsSignedLongLong.ddl --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5 +TOOLTEST tpbitsUnsignedLongLong.ddl --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5 # Overlapped packed bits. -TOOLTEST tpbitsOverlapped.ddl -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5 +TOOLTEST tpbitsOverlapped.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5 # Maximum number of packed bits. -TOOLTEST tpbitsMax.ddl -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5 +TOOLTEST tpbitsMax.ddl --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5 # Compound type. -TOOLTEST tpbitsCompound.ddl -d /dset1 -M 0,1,1,1 tcompound.h5 +TOOLTEST tpbitsCompound.ddl --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5 # Array type. -TOOLTEST tpbitsArray.ddl -d /Dataset1 -M 0,1,1,1 tarray1.h5 +TOOLTEST tpbitsArray.ddl --enable-error-stack -d /Dataset1 -M 0,1,1,1 tarray1.h5 # Test Error handling. # Too many packed bits requested. Max is 8 for now. TOOLTEST tpbitsMaxExceeded.ddl -d /DS08BITS -M 0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5 # Offset too large. Max is 7 (8-1) for now. TOOLTEST tpbitsOffsetExceeded.ddl -d /DS08BITS -M 64,1 packedbits.h5 -TOOLTEST tpbitsCharOffsetExceeded.ddl -d /DS08BITS -M 8,1 packedbits.h5 -TOOLTEST tpbitsIntOffsetExceeded.ddl -d /DS16BITS -M 16,1 packedbits.h5 -TOOLTEST tpbitsLongOffsetExceeded.ddl -d /DS32BITS -M 32,1 packedbits.h5 +TOOLTEST tpbitsCharOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5 +TOOLTEST tpbitsIntOffsetExceeded.ddl --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5 +TOOLTEST tpbitsLongOffsetExceeded.ddl --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5 # Bad offset, must not be negative. TOOLTEST tpbitsOffsetNegative.ddl -d /DS08BITS -M -1,1 packedbits.h5 # Bad length, must not be positive. TOOLTEST tpbitsLengthPositive.ddl -d /DS08BITS -M 4,0 packedbits.h5 # Offset+Length is too large. Max is 8 for now. TOOLTEST tpbitsLengthExceeded.ddl -d /DS08BITS -M 37,28 packedbits.h5 -TOOLTEST tpbitsCharLengthExceeded.ddl -d /DS08BITS -M 2,7 packedbits.h5 -TOOLTEST tpbitsIntLengthExceeded.ddl -d /DS16BITS -M 10,7 packedbits.h5 -TOOLTEST tpbitsLongLengthExceeded.ddl -d /DS32BITS -M 26,7 packedbits.h5 +TOOLTEST tpbitsCharLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5 +TOOLTEST tpbitsIntLengthExceeded.ddl --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5 +TOOLTEST tpbitsLongLengthExceeded.ddl --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5 # Incomplete pair of packed bits request. TOOLTEST tpbitsIncomplete.ddl -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5 diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index 232f3c1..56dc5ab 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -20,6 +20,7 @@ #include #include #include "h5import.h" +#include "h5tools.h" #include "h5tools_utils.h" /* Name of tool */ @@ -53,19 +54,22 @@ int main(int argc, char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); + /* Initialize h5tools lib */ + h5tools_init(); + (void) HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0); (void) HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0); if (argv[1] && (HDstrcmp("-V", argv[1]) == 0)) { print_version(PROGRAMNAME); - exit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); } /* * validate the number of command line arguments */ if (argc < 2) { - (void) fprintf(stderr, err1, argc); + (void) HDfprintf(stderr, err1, argc); usage(argv[0]); goto err; } @@ -95,7 +99,7 @@ int main(int argc, char *argv[]) opt.fcount++; } else { - (void) fprintf(stderr, err9, argv[i]); + (void) HDfprintf(stderr, err9, argv[i]); goto err; } @@ -119,7 +123,7 @@ int main(int argc, char *argv[]) case 6: /* -h found; help, then exit */ help(argv[0]); - exit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); break; case 7: /* -d found; look for dimensions */ @@ -127,7 +131,7 @@ int main(int argc, char *argv[]) case 8: /* read dimensions */ if (parseDimensions(in, argv[i]) == -1) { - (void) fprintf(stderr, err6, argv[i]); + (void) HDfprintf(stderr, err6, argv[i]); goto err; } break; @@ -137,7 +141,7 @@ int main(int argc, char *argv[]) case 10: /* read path name */ if (parsePathInfo(&in->path, argv[i]) == -1) { - (void) fprintf(stderr, err5, argv[i]); + (void) HDfprintf(stderr, err5, argv[i]); goto err; } break; @@ -147,7 +151,7 @@ int main(int argc, char *argv[]) case 12: /* read data type */ if (getInputClass(in, argv[i]) == -1) { - (void) fprintf(stderr, err7, argv[i]); + (void) HDfprintf(stderr, err7, argv[i]); goto err; } @@ -164,7 +168,7 @@ int main(int argc, char *argv[]) case 14: /* read data size */ if (getInputSize(in, (int) HDstrtol(argv[i], NULL, BASE_10)) == -1) { - (void) fprintf(stderr, err8, argv[i]); + (void) HDfprintf(stderr, err8, argv[i]); goto err; } /*set default value for output-size */ @@ -173,14 +177,14 @@ int main(int argc, char *argv[]) case ERR: /* command syntax error */ default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); usage(argv[0]); goto err; } } if (FALSE == outfile_named) { - (void) fprintf(stderr, "%s", err3); + (void) HDfprintf(stderr, "%s", err3); usage(argv[0]); goto err; } @@ -204,7 +208,7 @@ int main(int argc, char *argv[]) return (EXIT_SUCCESS); err: - (void) fprintf(stderr, "%s", err4); + (void) HDfprintf(stderr, "%s", err4); for (i = 0; i < opt.fcount; i++) { in = &(opt.infiles[i].in); if (in->sizeOfDimension) @@ -272,7 +276,7 @@ static int gtoken(char *s) } if (token == ERR) - (void) fprintf(stderr, err1, s); + (void) HDfprintf(stderr, err1, s); } else { /* filename */ token = FILNAME; @@ -318,7 +322,7 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) if (in->inputClass == 4 /* "IN" */|| in->inputClass == 3 /* "FP" */|| in->inputClass == 7 /* "UIN" */) { if ((strm = HDfopen(infile, READ_OPEN_FLAGS)) == NULL) { - (void) fprintf(stderr, err1, infile); + (void) HDfprintf(stderr, err1, infile); return (-1); } } @@ -328,7 +332,7 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) */ else { if ((strm = HDfopen(infile, "r")) == NULL) { - (void) fprintf(stderr, err1, infile); + (void) HDfprintf(stderr, err1, infile); return (-1); } } @@ -337,13 +341,13 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) case 0: /* TEXTIN */ case 4: /* IN */ if (allocateIntegerStorage(in) == -1) { - (void) fprintf(stderr, err2, infile); + (void) HDfprintf(stderr, err2, infile); HDfclose(strm); return (-1); } if (readIntegerData(strm, in) == -1) { - (void) fprintf(stderr, err4, infile); + (void) HDfprintf(stderr, err4, infile); HDfclose(strm); return (-1); } @@ -353,14 +357,14 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) case 2: /* TEXTFPE */ case 3: /* FP */ if (allocateFloatStorage(in) == -1) { - (void) fprintf(stderr, err3, infile); + (void) HDfprintf(stderr, err3, infile); HDfclose(strm); return (-1); } if (readFloatData(strm, in) == -1) { - (void) fprintf(stderr, err5, infile); + (void) HDfprintf(stderr, err5, infile); HDfclose(strm); return (-1); } @@ -369,7 +373,7 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) case 5: /* STR */ if (processStrData(strm, in, file_id) == -1) { - (void) fprintf(stderr, err11, infile); + (void) HDfprintf(stderr, err11, infile); HDfclose(strm); return (-1); } @@ -379,19 +383,19 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id) case 6: /* TEXTUIN */ case 7: /* UIN */ if (allocateUIntegerStorage(in) == -1) { - (void) fprintf(stderr, err6, infile); + (void) HDfprintf(stderr, err6, infile); HDfclose(strm); return (-1); } if (readUIntegerData(strm, in) == -1) { - (void) fprintf(stderr, err7, infile); + (void) HDfprintf(stderr, err7, infile); HDfclose(strm); return (-1); } break; default: - (void) fprintf(stderr, "%s", err10); + (void) HDfprintf(stderr, "%s", err10); HDfclose(strm); return (-1); } @@ -427,7 +431,7 @@ static int readIntegerData(FILE *strm, struct Input *in) in08 = (H5DT_INT8 *) in->data; for (i = 0; i < len; i++, in08++) { if (fscanf(strm, "%hd", &temp) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } (*in08) = (H5DT_INT8) temp; @@ -438,14 +442,14 @@ static int readIntegerData(FILE *strm, struct Input *in) in08 = (H5DT_INT8 *) in->data; for (i = 0; i < len; i++, in08++) { if (HDfread((char *) in08, sizeof(H5DT_INT8), 1, strm) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } break; default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } break; @@ -456,7 +460,7 @@ static int readIntegerData(FILE *strm, struct Input *in) case 0: /* TEXTIN */ for (i = 0; i < len; i++, in16++) { if (fscanf(strm, "%hd", in16) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } @@ -466,14 +470,14 @@ static int readIntegerData(FILE *strm, struct Input *in) case 4: /* IN */ for (i = 0; i < len; i++, in16++) { if (HDfread((char *) in16, sizeof(H5DT_INT16), 1, strm) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } break; default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } break; @@ -484,7 +488,7 @@ static int readIntegerData(FILE *strm, struct Input *in) case 0: /* TEXTIN */ for (i = 0; i < len; i++, in32++) { if (fscanf(strm, "%d", in32) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } @@ -493,14 +497,14 @@ static int readIntegerData(FILE *strm, struct Input *in) case 4: /* IN */ for (i = 0; i < len; i++, in32++) { if (HDfread((char *) in32, sizeof(H5DT_INT32), 1, strm) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } break; default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } break; @@ -512,7 +516,7 @@ static int readIntegerData(FILE *strm, struct Input *in) case 0: /* TEXTIN */ for (i = 0; i < len; i++, in64++) { if (fscanf(strm, "%s", buffer) < 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } *in64 = (H5DT_INT64) HDstrtoll(buffer, NULL, 10); @@ -522,21 +526,21 @@ static int readIntegerData(FILE *strm, struct Input *in) case 4: /* IN */ for (i = 0; i < len; i++, in64++) { if (HDfread((char *) in64, sizeof(H5DT_INT64), 1, strm) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } break; default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } break; #endif /* ifdef H5_SIZEOF_LONG_LONG */ default: - (void) fprintf(stderr, "%s", err3); + (void) HDfprintf(stderr, "%s", err3); break; } return (0); @@ -569,7 +573,7 @@ static int readUIntegerData(FILE *strm, struct Input *in) in08 = (H5DT_UINT8 *) in->data; for (i = 0; i < len; i++, in08++) { if (fscanf(strm, "%hu", &temp) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } (*in08) = (H5DT_UINT8) temp; @@ -580,14 +584,14 @@ static int readUIntegerData(FILE *strm, struct Input *in) in08 = (H5DT_UINT8 *) in->data; for (i = 0; i < len; i++, in08++) { if (HDfread((char *) in08, sizeof(H5DT_UINT8), 1, strm) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } break; default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } break; @@ -598,7 +602,7 @@ static int readUIntegerData(FILE *strm, struct Input *in) case 6: /* TEXTUIN */ for (i = 0; i < len; i++, in16++) { if (fscanf(strm, "%hu", in16) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } @@ -607,14 +611,14 @@ static int readUIntegerData(FILE *strm, struct Input *in) case 7: /* UIN */ for (i = 0; i < len; i++, in16++) { if (HDfread((char *) in16, sizeof(H5DT_UINT16), 1, strm) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } break; default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } break; @@ -625,7 +629,7 @@ static int readUIntegerData(FILE *strm, struct Input *in) case 6: /* TEXTUIN */ for (i = 0; i < len; i++, in32++) { if (fscanf(strm, "%u", in32) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } @@ -634,14 +638,14 @@ static int readUIntegerData(FILE *strm, struct Input *in) case 7: /* UIN */ for (i = 0; i < len; i++, in32++) { if (HDfread((char *) in32, sizeof(H5DT_UINT32), 1, strm) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } break; default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } break; @@ -653,7 +657,7 @@ static int readUIntegerData(FILE *strm, struct Input *in) case 6: /* TEXTUIN */ for (i = 0; i < len; i++, in64++) { if (fscanf(strm, "%s", buffer) < 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } *in64 = (H5DT_UINT64) HDstrtoll(buffer, NULL, 10); @@ -663,21 +667,21 @@ static int readUIntegerData(FILE *strm, struct Input *in) case 7: /* UIN */ for (i = 0; i < len; i++, in64++) { if (HDfread((char *) in64, sizeof(H5DT_UINT64), 1, strm) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } break; default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } break; #endif /* ifdef H5_SIZEOF_LONG_LONG */ default: - (void) fprintf(stderr, "%s", err3); + (void) HDfprintf(stderr, "%s", err3); break; } return (0); @@ -705,7 +709,7 @@ static int readFloatData(FILE *strm, struct Input *in) case 1: /* TEXTFP */ for (i = 0; i < len; i++, fp32++) { if (fscanf(strm, "%f", fp32) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } @@ -718,7 +722,7 @@ static int readFloatData(FILE *strm, struct Input *in) for (i = 0; i < len; i++, fp32++) { if (fscanf(strm, "%f", fp32) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } @@ -729,14 +733,14 @@ static int readFloatData(FILE *strm, struct Input *in) case 3: /* FP */ for (i = 0; i < len; i++, fp32++) { if (HDfread((char *) fp32, sizeof(H5DT_FLOAT32), 1, strm) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } break; default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } break; @@ -747,7 +751,7 @@ static int readFloatData(FILE *strm, struct Input *in) case 1: /* TEXTFP */ for (i = 0; i < len; i++, fp64++) { if (fscanf(strm, "%lf", fp64) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } @@ -760,7 +764,7 @@ static int readFloatData(FILE *strm, struct Input *in) for (i = 0; i < len; i++, fp64++) { if (fscanf(strm, "%lf", fp64) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } @@ -771,20 +775,20 @@ static int readFloatData(FILE *strm, struct Input *in) case 3: /* FP */ for (i = 0; i < len; i++, fp64++) { if (HDfread((char *) fp64, sizeof(H5DT_FLOAT64), 1, strm) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } } break; default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } break; default: - (void) fprintf(stderr, "%s", err3); + (void) HDfprintf(stderr, "%s", err3); break; } return (0); @@ -953,34 +957,34 @@ static int allocateIntegerStorage(struct Input *in) switch (in->inputSize) { case 8: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT8))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } break; case 16: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT16))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } break; case 32: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT32))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } break; case 64: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT64))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } break; default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); break; } return (0); @@ -999,34 +1003,34 @@ static int allocateUIntegerStorage(struct Input *in) switch (in->inputSize) { case 8: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT8))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } break; case 16: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT16))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } break; case 32: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT32))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } break; case 64: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT64))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } break; default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); break; } return (0); @@ -1045,20 +1049,20 @@ static int allocateFloatStorage(struct Input *in) switch (in->inputSize) { case 32: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_FLOAT32))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } break; case 64: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_FLOAT64))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } break; default: - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); break; } return (0); @@ -1116,30 +1120,30 @@ static int processConfigurationFile(char *infile, struct Input *in) */ if ((strm = HDfopen(infile, "r")) == NULL) { - (void) fprintf(stderr, err1, infile); + (void) HDfprintf(stderr, err1, infile); return (-1); } while (fscanf(strm, "%s", key) == 1) { if ((kindex = mapKeywordToIndex(key)) == -1) { - (void) fprintf(stderr, err2, infile); + (void) HDfprintf(stderr, err2, infile); HDfclose(strm); return (-1); } switch (kindex) { case 0: /* PATH */ if (in->configOptionVector[PATH] == 1) { - (void) fprintf(stderr, err3a, infile); + (void) HDfprintf(stderr, err3a, infile); HDfclose(strm); return (-1); } if (fscanf(strm, "%s", temp) != 1) { - (void) fprintf(stderr, "%s", err18); + (void) HDfprintf(stderr, "%s", err18); HDfclose(strm); return (-1); } if (parsePathInfo(&in->path, temp) == -1) { - (void) fprintf(stderr, err3b, infile); + (void) HDfprintf(stderr, err3b, infile); HDfclose(strm); return (-1); } @@ -1148,18 +1152,18 @@ static int processConfigurationFile(char *infile, struct Input *in) case 1: /* INPUT-CLASS */ if (in->configOptionVector[INPUT_CLASS] == 1) { - (void) fprintf(stderr, err4a, infile); + (void) HDfprintf(stderr, err4a, infile); HDfclose(strm); return (-1); } if (fscanf(strm, "%s", temp) != 1) { - (void) fprintf(stderr, "%s", err18); + (void) HDfprintf(stderr, "%s", err18); HDfclose(strm); return (-1); } if (getInputClass(in, temp) == -1) { - (void) fprintf(stderr, err4b, infile); + (void) HDfprintf(stderr, err4b, infile); HDfclose(strm); return (-1); } @@ -1180,17 +1184,17 @@ static int processConfigurationFile(char *infile, struct Input *in) case 2: /* INPUT-SIZE */ if (in->configOptionVector[INPUT_SIZE] == 1) { - (void) fprintf(stderr, err5a, infile); + (void) HDfprintf(stderr, err5a, infile); HDfclose(strm); return (-1); } if (fscanf(strm, "%d", (&ival)) != 1) { - (void) fprintf(stderr, "%s", err19); + (void) HDfprintf(stderr, "%s", err19); HDfclose(strm); return (-1); } if (getInputSize(in, ival) == -1) { - (void) fprintf(stderr, err5b, infile); + (void) HDfprintf(stderr, err5b, infile); HDfclose(strm); return (-1); } @@ -1203,13 +1207,13 @@ static int processConfigurationFile(char *infile, struct Input *in) case 3: /* RANK */ if (in->configOptionVector[RANK] == 1) { - (void) fprintf(stderr, err6a, infile); + (void) HDfprintf(stderr, err6a, infile); HDfclose(strm); return (-1); } if (getRank(in, strm) == -1) { - (void) fprintf(stderr, err6b, infile); + (void) HDfprintf(stderr, err6b, infile); HDfclose(strm); return (-1); } @@ -1218,18 +1222,18 @@ static int processConfigurationFile(char *infile, struct Input *in) case 4: /* DIMENSION-SIZES */ if (in->configOptionVector[DIM] == 1) { - (void) fprintf(stderr, err7a, infile); + (void) HDfprintf(stderr, err7a, infile); HDfclose(strm); return (-1); } if (in->configOptionVector[RANK] == 0) { - (void) fprintf(stderr, err7b, infile); + (void) HDfprintf(stderr, err7b, infile); HDfclose(strm); return (-1); } if (getDimensionSizes(in, strm) == -1) { - (void) fprintf(stderr, err7c, infile); + (void) HDfprintf(stderr, err7c, infile); HDfclose(strm); return (-1); } @@ -1238,13 +1242,13 @@ static int processConfigurationFile(char *infile, struct Input *in) case 5: /* OUTPUT-CLASS */ if (in->configOptionVector[OUTPUT_CLASS] == 1) { - (void) fprintf(stderr, err8a, infile); + (void) HDfprintf(stderr, err8a, infile); HDfclose(strm); return (-1); } if (getOutputClass(in, strm) == -1) { - (void) fprintf(stderr, err8b, infile); + (void) HDfprintf(stderr, err8b, infile); HDfclose(strm); return (-1); } @@ -1253,13 +1257,13 @@ static int processConfigurationFile(char *infile, struct Input *in) case 6: /* OUTPUT-SIZE */ if (in->configOptionVector[OUTPUT_SIZE] == 1) { - (void) fprintf(stderr, err9a, infile); + (void) HDfprintf(stderr, err9a, infile); HDfclose(strm); return (-1); } if (getOutputSize(in, strm) == -1) { - (void) fprintf(stderr, err9b, infile); + (void) HDfprintf(stderr, err9b, infile); HDfclose(strm); return (-1); } @@ -1268,13 +1272,13 @@ static int processConfigurationFile(char *infile, struct Input *in) case 7: /* OUTPUT-ARCHITECTURE */ if (in->configOptionVector[OUTPUT_ARCH] == 1) { - (void) fprintf(stderr, err10a, infile); + (void) HDfprintf(stderr, err10a, infile); HDfclose(strm); return (-1); } if (getOutputArchitecture(in, strm) == -1) { - (void) fprintf(stderr, err10b, infile); + (void) HDfprintf(stderr, err10b, infile); HDfclose(strm); return (-1); } @@ -1283,13 +1287,13 @@ static int processConfigurationFile(char *infile, struct Input *in) case 8: /* OUTPUT-BYTE-ORDER */ if (in->configOptionVector[OUTPUT_B_ORDER] == 1) { - (void) fprintf(stderr, err11a, infile); + (void) HDfprintf(stderr, err11a, infile); HDfclose(strm); return (-1); } if (getOutputByteOrder(in, strm) == -1) { - (void) fprintf(stderr, err11b, infile); + (void) HDfprintf(stderr, err11b, infile); HDfclose(strm); return (-1); } @@ -1298,19 +1302,19 @@ static int processConfigurationFile(char *infile, struct Input *in) case 9: /* CHUNKED-DIMENSION-SIZES */ if (in->configOptionVector[CHUNK] == 1) { - (void) fprintf(stderr, err12a, infile); + (void) HDfprintf(stderr, err12a, infile); HDfclose(strm); return (-1); } /* cant appear before dimension sizes have been provided */ if (in->configOptionVector[DIM] == 0) { - (void) fprintf(stderr, err12b, infile); + (void) HDfprintf(stderr, err12b, infile); HDfclose(strm); return (-1); } if (getChunkedDimensionSizes(in, strm) == -1) { - (void) fprintf(stderr, err12c, infile); + (void) HDfprintf(stderr, err12c, infile); HDfclose(strm); return (-1); } @@ -1319,13 +1323,13 @@ static int processConfigurationFile(char *infile, struct Input *in) case 10: /* COMPRESSION-TYPE */ if (in->configOptionVector[COMPRESS] == 1) { - (void) fprintf(stderr, err13a, infile); + (void) HDfprintf(stderr, err13a, infile); HDfclose(strm); return (-1); } if (getCompressionType(in, strm) == -1) { - (void) fprintf(stderr, err13b, infile); + (void) HDfprintf(stderr, err13b, infile); HDfclose(strm); return (-1); } @@ -1339,13 +1343,13 @@ static int processConfigurationFile(char *infile, struct Input *in) case 11: /* COMPRESSION-PARAM */ if (in->configOptionVector[COMPRESS_PARAM] == 1) { - (void) fprintf(stderr, err14a, infile); + (void) HDfprintf(stderr, err14a, infile); HDfclose(strm); return (-1); } if (getCompressionParameter(in, strm) == -1) { - (void) fprintf(stderr, err14b, infile); + (void) HDfprintf(stderr, err14b, infile); HDfclose(strm); return (-1); } @@ -1358,34 +1362,34 @@ static int processConfigurationFile(char *infile, struct Input *in) break; case 12: /* EXTERNAL-STORAGE */ - if (in->configOptionVector[EXTERNAL] == 1) { - (void) fprintf(stderr, err15a, infile); + if (in->configOptionVector[EXTERNALSTORE] == 1) { + (void) HDfprintf(stderr, err15a, infile); HDfclose(strm); return (-1); } if (getExternalFilename(in, strm) == -1) { - (void) fprintf(stderr, err15b, infile); + (void) HDfprintf(stderr, err15b, infile); HDfclose(strm); return (-1); } - in->configOptionVector[EXTERNAL] = 1; + in->configOptionVector[EXTERNALSTORE] = 1; break; case 13: /* MAXIMUM-DIMENSIONS */ if (in->configOptionVector[EXTEND] == 1) { - (void) fprintf(stderr, err16a, infile); + (void) HDfprintf(stderr, err16a, infile); HDfclose(strm); return (-1); } /* cant appear before dimension sizes have been provided */ if (in->configOptionVector[DIM] == 0) { - (void) fprintf(stderr, err16b, infile); + (void) HDfprintf(stderr, err16b, infile); HDfclose(strm); return (-1); } if (getMaximumDimensionSizes(in, strm) == -1) { - (void) fprintf(stderr, err16c, infile); + (void) HDfprintf(stderr, err16c, infile); HDfclose(strm); return (-1); } @@ -1402,7 +1406,7 @@ static int processConfigurationFile(char *infile, struct Input *in) */ if (validateConfigurationParameters(in) == -1) { - (void) fprintf(stderr, err17, infile); + (void) HDfprintf(stderr, err17, infile); HDfclose(strm); return (-1); } @@ -1428,20 +1432,20 @@ static int validateConfigurationParameters(struct Input *in) return (0); if ((in->configOptionVector[DIM] != 1) || (in->configOptionVector[RANK] != 1)) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } - if (in->configOptionVector[EXTERNAL] == 1) { + if (in->configOptionVector[EXTERNALSTORE] == 1) { if ((in->configOptionVector[COMPRESS] == 1) || (in->configOptionVector[CHUNK] == 1) || (in->configOptionVector[EXTEND] == 1)) { - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } } if ((in->configOptionVector[COMPRESS] == 1) || (in->configOptionVector[EXTEND] == 1)) { if (in->configOptionVector[CHUNK] != 1) { - (void) fprintf(stderr, "%s", err3); + (void) HDfprintf(stderr, "%s", err3); return (-1); } } @@ -1449,26 +1453,26 @@ static int validateConfigurationParameters(struct Input *in) /* Arch cant be STD if O/p class is FP */ if (in->outputArchitecture == 1) if (in->outputClass == 1) { - (void) fprintf(stderr, "%s", err4a); + (void) HDfprintf(stderr, "%s", err4a); return (-1); } /* Arch cant be IEEE if O/p class is IN */ if (in->outputArchitecture == 2) if (in->outputClass == 0) { - (void) fprintf(stderr, "%s", err4b); + (void) HDfprintf(stderr, "%s", err4b); return (-1); } if (in->outputClass == 1) if (in->outputSize != 32 && in->outputSize != 64) { - (void) fprintf(stderr, "%s", err5); + (void) HDfprintf(stderr, "%s", err5); return (-1); } #ifndef H5_SIZEOF_LONG_LONG if (in->inputSize == 64 && (in->inputClass == 0 || in->inputClass == 4 || in->inputClass == 6 || in->inputClass == 7) ) { - (void) fprintf(stderr, "%s", err6); + (void) HDfprintf(stderr, "%s", err6); return -1; } #endif @@ -1494,7 +1498,7 @@ static int parsePathInfo(struct path_info *path, char *temp) token = HDstrtok (temp, delimiter); if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) { - (void) fprintf(stderr, err1); + (void) HDfprintf(stderr, err1); return (-1); } HDstrcpy(path->group[i++],token); @@ -1504,7 +1508,7 @@ static int parsePathInfo(struct path_info *path, char *temp) if (token == NULL) break; if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) { - (void) fprintf(stderr, err1); + (void) HDfprintf(stderr, err1); return (-1); } HDstrcpy(path->group[i++],token); @@ -1533,7 +1537,7 @@ static int parseDimensions(struct Input *in, char *strm) } in->rank = i + 1; if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -1560,12 +1564,12 @@ static int getOutputClass(struct Input *in, FILE *strm) const char *err2 = "Invalid value for output class.\n"; if (fscanf(strm, "%s", temp) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } if ((kindex = OutputClassStrToInt(temp)) == -1) { - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } @@ -1593,7 +1597,7 @@ static int getOutputSize(struct Input *in, FILE *strm) const char *err2 = "Invalid value for output size.\n"; if (fscanf(strm, "%d", (&ival)) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -1602,7 +1606,7 @@ static int getOutputSize(struct Input *in, FILE *strm) in->outputSize = ival; return (0); } - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } @@ -1612,7 +1616,7 @@ static int getInputClass(struct Input *in, char * temp) const char *err1 = "Invalid value for input class.\n"; if ((kindex = InputClassStrToInt(temp)) == -1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -1642,7 +1646,7 @@ static int getInputSize(struct Input *in, int ival) in->inputSize = ival; return (0); } - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -1654,7 +1658,7 @@ static int getRank(struct Input *in, FILE *strm) const char *err2 = "Invalid value for rank.\n"; if (fscanf(strm, "%d", (&ival)) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } if (ival >= MIN_NUM_DIMENSION && ival <= MAX_NUM_DIMENSION) { @@ -1662,7 +1666,7 @@ static int getRank(struct Input *in, FILE *strm) return (0); } - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } @@ -1676,7 +1680,7 @@ static int getDimensionSizes(struct Input *in, FILE *strm) const char *err2 = "No. of dimensions for which dimension sizes provided is not equal to provided rank.\n"; if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -1684,7 +1688,7 @@ static int getDimensionSizes(struct Input *in, FILE *strm) in->sizeOfDimension[i++] = ival; if (in->rank != i) { - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } return (0); @@ -1700,7 +1704,7 @@ static int getChunkedDimensionSizes(struct Input *in, FILE *strm) const char *err3 = "The CHUNKED-DIMENSION-SIZES cannot exceed the sizes of DIMENSION-SIZES\n"; if ((in->sizeOfChunk = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -1708,13 +1712,13 @@ static int getChunkedDimensionSizes(struct Input *in, FILE *strm) in->sizeOfChunk[i++] = ival; if (in->rank != i) { - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } for (i = 0; i < in->rank; i++) if (in->sizeOfChunk[i] > in->sizeOfDimension[i]) { - (void) fprintf(stderr, "%s", err3); + (void) HDfprintf(stderr, "%s", err3); return (-1); } return (0); @@ -1730,7 +1734,7 @@ static int getMaximumDimensionSizes(struct Input *in, FILE *strm) const char *err3 = "The MAXIMUM-DIMENSIONS cannot be less than the sizes of DIMENSION-SIZES. Exception: can be -1 to indicate unlimited size\n"; if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -1742,14 +1746,14 @@ static int getMaximumDimensionSizes(struct Input *in, FILE *strm) } if (in->rank != i) { - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } for (i = 0; i < in->rank; i++) { if (in->maxsizeOfDimension[i] != H5S_UNLIMITED) if (in->maxsizeOfDimension[i] < in->sizeOfDimension[i]) { - (void) fprintf(stderr, "%s", err3); + (void) HDfprintf(stderr, "%s", err3); return (-1); } } @@ -1764,12 +1768,12 @@ static int getOutputArchitecture(struct Input *in, FILE *strm) const char *err2 = "Invalid value for output architecture.\n"; if (fscanf(strm, "%s", temp) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } if ((kindex = OutputArchStrToInt(temp)) == -1) { - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } @@ -1796,12 +1800,12 @@ static int getOutputByteOrder(struct Input *in, FILE *strm) const char *err2 = "Invalid value for output byte-order.\n"; if (fscanf(strm, "%s", temp) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } if ((kindex = OutputByteOrderStrToInt(temp)) == -1) { - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } @@ -1827,12 +1831,12 @@ static int getCompressionType(struct Input *in, FILE *strm) const char *err2 = "Invalid value for compression.\n"; if (fscanf(strm, "%s", temp) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } if ((kindex = CompressionTypeStrToInt(temp)) == -1) { - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } @@ -1868,19 +1872,19 @@ static int getCompressionParameter(struct Input *in, FILE *strm) switch (in->compressionType) { case 0: /* GZIP */ if (fscanf(strm, "%d", (&ival)) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } if (ival < 0 || ival > 9) { - (void) fprintf(stderr, "%s", err2); + (void) HDfprintf(stderr, "%s", err2); return (-1); } in->compressionParam = ival; return (0); default: - (void) fprintf(stderr, "%s", err3); + (void) HDfprintf(stderr, "%s", err3); return (-1); } } @@ -1891,7 +1895,7 @@ static int getExternalFilename(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; if (fscanf(strm, "%s", temp) != 1) { - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -2183,7 +2187,7 @@ hid_t createOutputDataType(struct Input *in) break; default: - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } return new_type; @@ -2255,7 +2259,7 @@ hid_t createInputDataType(struct Input *in) break; default: - (void) fprintf(stderr, "%s", err1); + (void) HDfprintf(stderr, "%s", err1); return (-1); } return new_type; @@ -2288,7 +2292,7 @@ static int process(struct Options *opt) { if ((file_id = H5Fopen(opt->outfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { if ((file_id = H5Fcreate(opt->outfile, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == FAIL) { - (void) fprintf(stderr, err1, opt->outfile); + (void) HDfprintf(stderr, err1, opt->outfile); return (-1); } } @@ -2299,13 +2303,13 @@ static int process(struct Options *opt) in = &(opt->infiles[k].in); if (opt->infiles[k].config == 1) { if (processConfigurationFile(opt->infiles[k].configfile, in) == -1) { - (void) fprintf(stderr, err2, opt->infiles[k].configfile); + (void) HDfprintf(stderr, err2, opt->infiles[k].configfile); return (-1); } } if (processDataFile(opt->infiles[k].datafile, in, file_id) == -1) { - (void) fprintf(stderr, err3, opt->infiles[k].datafile); + (void) HDfprintf(stderr, err3, opt->infiles[k].datafile); return (-1); } @@ -2357,10 +2361,10 @@ static int process(struct Options *opt) H5Pset_deflate(proplist, (unsigned) in->compressionParam); } - if (in->configOptionVector[EXTERNAL] == 1) { + if (in->configOptionVector[EXTERNALSTORE] == 1) { /* creating the external file if it doesnt exist */ if ((extfile = HDfopen(in->externFilename, "ab")) == NULL) { - (void) fprintf(stderr, "%s", err4); + (void) HDfprintf(stderr, "%s", err4); H5Pclose(proplist); H5Sclose(dataspace); H5Fclose(file_id); @@ -2381,7 +2385,7 @@ static int process(struct Options *opt) { /* create data set */ if ((dataset = H5Dcreate2(handle, in->path.group[j], outtype, dataspace, H5P_DEFAULT, proplist, H5P_DEFAULT)) < 0) { - (void) fprintf(stderr, "%s", err5); + (void) HDfprintf(stderr, "%s", err5); H5Pclose(proplist); H5Sclose(dataspace); H5Fclose(file_id); @@ -2394,7 +2398,7 @@ static int process(struct Options *opt) /* write dataset */ if (H5Dwrite(dataset, intype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (VOIDP) in->data) < 0) { - (void) fprintf(stderr, "%s", err6); + (void) HDfprintf(stderr, "%s", err6); H5Dclose(dataset); H5Pclose(proplist); H5Sclose(dataspace); @@ -2423,405 +2427,405 @@ static int process(struct Options *opt) void help(char *name) { - (void) fprintf(stdout, "Name:\n\n"); - (void) fprintf(stdout, "\t%s\n\n", name); - (void) fprintf(stdout, "\t TOOL NAME:\n"); - (void) fprintf(stdout, "\t %s\n", name); - (void) fprintf(stdout, "\t SYNTAX:\n"); - (void) fprintf(stdout, "\t %s -h[elp], OR\n", name); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "Name:\n\n"); + (void) HDfprintf(stdout, "\t%s\n\n", name); + (void) HDfprintf(stdout, "\t TOOL NAME:\n"); + (void) HDfprintf(stdout, "\t %s\n", name); + (void) HDfprintf(stdout, "\t SYNTAX:\n"); + (void) HDfprintf(stdout, "\t %s -h[elp], OR\n", name); + (void) HDfprintf(stdout, "\t %s -c[onfig] [ -c[config] ...]", name); - (void) fprintf(stdout, "\t\t\t\t -o[utfile] \n\n"); - (void) fprintf(stdout, "\t PURPOSE:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t\t\t\t -o[utfile] \n\n"); + (void) HDfprintf(stdout, "\t PURPOSE:\n"); + (void) HDfprintf(stdout, "\t To convert data stored in one or more ASCII or binary files\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t into one or more datasets (in accordance with the \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t user-specified type and storage properties) in an existing \n"); - (void) fprintf(stdout, "\t or new HDF5 file.\n\n"); - (void) fprintf(stdout, "\t DESCRIPTION:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t or new HDF5 file.\n\n"); + (void) HDfprintf(stdout, "\t DESCRIPTION:\n"); + (void) HDfprintf(stdout, "\t The primary objective of the utility is to convert floating\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t point or integer data stored in ASCII text or binary form \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t into a data-set according to the type and storage properties\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t specified by the user. The utility can also accept ASCII\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t text files and store the contents in a compact form as an\n"); - (void) fprintf(stdout, "\t array of one-dimensional strings.\n\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t array of one-dimensional strings.\n\n"); + (void) HDfprintf(stdout, "\t The input data to be written as a data-set can be provided\n"); - (void) fprintf(stdout, "\t to the utility in one of the following forms:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t to the utility in one of the following forms:\n"); + (void) HDfprintf(stdout, "\t 1. ASCII text file with numeric data (floating point or \n"); - (void) fprintf(stdout, "\t integer data). \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t integer data). \n"); + (void) HDfprintf(stdout, "\t 2. Binary file with native floating point data (32-bit or \n"); - (void) fprintf(stdout, "\t 64-bit) \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t 64-bit) \n"); + (void) HDfprintf(stdout, "\t 3. Binary file with native integer (signed or unsigned)\n"); - (void) fprintf(stdout, "\t data (8-bit or 16-bit or 32-bit or 64-bit). \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t data (8-bit or 16-bit or 32-bit or 64-bit). \n"); + (void) HDfprintf(stdout, "\t 4. ASCII text file containing strings (text data).\n"); - (void) fprintf(stdout, "\t \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t \n"); + (void) HDfprintf(stdout, "\t Every input file is associated with a configuration file \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t also provided as an input to the utility. (See Section \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t \"CONFIGURATION FILE\" to know how it is to be organized).\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t The class, size and dimensions of the input data is \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t specified in this configuration file. A point to note is\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t that the floating point data in the ASCII text file may be\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t organized in the fixed floating form (for example 323.56)\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t or in a scientific notation (for example 3.23E+02). A \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t different input-class specification is to be used for both\n"); - (void) fprintf(stdout, "\t forms.\n\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t forms.\n\n"); + (void) HDfprintf(stdout, "\t The utility extracts the input data from the input file \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t according to the specified parameters and saves it into \n"); - (void) fprintf(stdout, "\t an H5 dataset. \n\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t an H5 dataset. \n\n"); + (void) HDfprintf(stdout, "\t The user can specify output type and storage properties in \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t the configuration file. The user is requited to specify the \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t path of the dataset. If the groups in the path leading to \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t the data-set do not exist, the groups will be created by the\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t utility. If no group is specified, the dataset will be\n"); - (void) fprintf(stdout, "\t created under the root group.\n\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t created under the root group.\n\n"); + (void) HDfprintf(stdout, "\t In addition to the name, the user is also required to \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t provide the class and size of output data to be written to \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t the dataset and may optionally specify the output-architecure,\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t and the output-byte-order. If output-architecture is not \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t specified the default is NATIVE. Output-byte-orders are fixed\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t for some architectures and may be specified only if output-\n"); - (void) fprintf(stdout, "\t architecture is IEEE, UNIX or STD.\n\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t architecture is IEEE, UNIX or STD.\n\n"); + (void) HDfprintf(stdout, "\t Also, layout and other storage properties such as \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t compression, external storage and extendible data-sets may be\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t optionally specified. The layout and storage properties \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t denote how raw data is to be organized on the disk. If these \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t options are not specified the default is Contiguous layout \n"); - (void) fprintf(stdout, "\t and storage.\n\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t and storage.\n\n"); + (void) HDfprintf(stdout, "\t The dataset can be organized in any of the following ways:\n"); - (void) fprintf(stdout, "\t 1. Contiguous.\n"); - (void) fprintf(stdout, "\t 2. Chunked.\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t 1. Contiguous.\n"); + (void) HDfprintf(stdout, "\t 2. Chunked.\n"); + (void) HDfprintf(stdout, "\t 3. External Storage File (has to be contiguous)\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t 4. Extendible data sets (has to be chunked)\n"); - (void) fprintf(stdout, "\t 5. Compressed. (has to be chunked)\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t 5. Compressed. (has to be chunked)\n"); + (void) HDfprintf(stdout, "\t 6. Compressed & Extendible (has to be chunked)\n\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t If the user wants to store raw data in a non-HDF file then \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t the external storage file option is to be used and the name \n"); - (void) fprintf(stdout, "\t of the file is to be specified. \n\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t of the file is to be specified. \n\n"); + (void) HDfprintf(stdout, "\t If the user wants the dimensions of the data-set to be\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t unlimited, the extendible data set option can be chosen. \n\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t The user may also specify the type of compression and the \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t level to which the data set must be compresses by setting \n"); - (void) fprintf(stdout, "\t the compressed option.\n\n"); - (void) fprintf(stdout, "\t SYNOPSIS:\n"); - (void) fprintf(stdout, "\t h5import -h[elp], OR\n"); - (void) fprintf( stdout, + (void) HDfprintf(stdout, "\t the compressed option.\n\n"); + (void) HDfprintf(stdout, "\t SYNOPSIS:\n"); + (void) HDfprintf(stdout, "\t h5import -h[elp], OR\n"); + (void) HDfprintf( stdout, "\t h5import -c[onfig] \ [ -c[config] ...] -o[utfile] \n\n"); - (void) fprintf(stdout, "\t -h[elp]:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t -h[elp]:\n"); + (void) HDfprintf(stdout, "\t Prints this summary of usage, and exits.\n\n"); - (void) fprintf(stdout, "\t :\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t :\n"); + (void) HDfprintf(stdout, "\t Name of the Input file(s), containing a \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t single n-dimensional floating point or integer array \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t in either ASCII text, native floating point(32-bit \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t or 64-bit) or native integer(8-bit or 16-bit or \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t 32-bit or 64-bit). Data to be specified in the order\n"); - (void) fprintf(stdout, "\t of fastest changing dimensions first.\n\n"); - (void) fprintf(stdout, "\t -c[config] :\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t of fastest changing dimensions first.\n\n"); + (void) HDfprintf(stdout, "\t -c[config] :\n"); + (void) HDfprintf(stdout, "\t Every input file should be associated with a \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t configuration file and this is done by the -c option.\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t is the name of the configuration file.\n"); - (void) fprintf(stdout, "\t (See Section \"CONFIGURATION FILE\")\n\n"); - (void) fprintf(stdout, "\t -o[utfile] :\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t (See Section \"CONFIGURATION FILE\")\n\n"); + (void) HDfprintf(stdout, "\t -o[utfile] :\n"); + (void) HDfprintf(stdout, "\t Name of the HDF5 output file. Data from one or more \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t input files are stored as one or more data sets in \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t . The output file may be an existing file or \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t it maybe new in which case it will be created.\n\n\n"); - (void) fprintf(stdout, "\t CONFIGURATION FILE:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t CONFIGURATION FILE:\n"); + (void) HDfprintf(stdout, "\t The configuration file is an ASCII text file and must be \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t organized as \"CONFIG-KEYWORD VALUE\" pairs, one pair on each \n"); - (void) fprintf(stdout, "\t line.\n\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t line.\n\n"); + (void) HDfprintf(stdout, "\t The configuration file may have the following keywords each \n"); - (void) fprintf(stdout, "\t followed by an acceptable value.\n\n"); - (void) fprintf(stdout, "\t Required KEYWORDS:\n"); - (void) fprintf(stdout, "\t PATH\n"); - (void) fprintf(stdout, "\t INPUT-CLASS\n"); - (void) fprintf(stdout, "\t INPUT-SIZE\n"); - (void) fprintf(stdout, "\t RANK\n"); - (void) fprintf(stdout, "\t DIMENSION-SIZES\n"); - (void) fprintf(stdout, "\t OUTPUT-CLASS\n"); - (void) fprintf(stdout, "\t OUTPUT-SIZE\n\n"); - (void) fprintf(stdout, "\t Optional KEYWORDS:\n"); - (void) fprintf(stdout, "\t OUTPUT-ARCHITECTURE\n"); - (void) fprintf(stdout, "\t OUTPUT-BYTE-ORDER\n"); - (void) fprintf(stdout, "\t CHUNKED-DIMENSION-SIZES\n"); - (void) fprintf(stdout, "\t COMPRESSION-TYPE\n"); - (void) fprintf(stdout, "\t COMPRESSION-PARAM\n"); - (void) fprintf(stdout, "\t EXTERNAL-STORAGE\n"); - (void) fprintf(stdout, "\t MAXIMUM-DIMENSIONS\n\n\n"); - (void) fprintf(stdout, "\t Values for keywords:\n"); - (void) fprintf(stdout, "\t PATH:\n"); - (void) fprintf(stdout, "\t Strings separated by spaces to represent\n"); - (void) fprintf(stdout, "\t the path of the data-set. If the groups in\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t followed by an acceptable value.\n\n"); + (void) HDfprintf(stdout, "\t Required KEYWORDS:\n"); + (void) HDfprintf(stdout, "\t PATH\n"); + (void) HDfprintf(stdout, "\t INPUT-CLASS\n"); + (void) HDfprintf(stdout, "\t INPUT-SIZE\n"); + (void) HDfprintf(stdout, "\t RANK\n"); + (void) HDfprintf(stdout, "\t DIMENSION-SIZES\n"); + (void) HDfprintf(stdout, "\t OUTPUT-CLASS\n"); + (void) HDfprintf(stdout, "\t OUTPUT-SIZE\n\n"); + (void) HDfprintf(stdout, "\t Optional KEYWORDS:\n"); + (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE\n"); + (void) HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER\n"); + (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES\n"); + (void) HDfprintf(stdout, "\t COMPRESSION-TYPE\n"); + (void) HDfprintf(stdout, "\t COMPRESSION-PARAM\n"); + (void) HDfprintf(stdout, "\t EXTERNAL-STORAGE\n"); + (void) HDfprintf(stdout, "\t MAXIMUM-DIMENSIONS\n\n\n"); + (void) HDfprintf(stdout, "\t Values for keywords:\n"); + (void) HDfprintf(stdout, "\t PATH:\n"); + (void) HDfprintf(stdout, "\t Strings separated by spaces to represent\n"); + (void) HDfprintf(stdout, "\t the path of the data-set. If the groups in\n"); + (void) HDfprintf(stdout, "\t the path do no exist, they will be created. \n"); - (void) fprintf(stdout, "\t For example,\n"); - (void) fprintf(stdout, "\t PATH grp1/grp2/dataset1\n"); - (void) fprintf(stdout, "\t PATH: keyword\n"); - (void) fprintf(stdout, "\t grp1: group under the root. If\n"); - (void) fprintf(stdout, "\t non-existent will be created.\n"); - (void) fprintf(stdout, "\t grp2: group under grp1. If \n"); - (void) fprintf(stdout, "\t non-existent will be created \n"); - (void) fprintf(stdout, "\t under grp1.\n"); - (void) fprintf(stdout, "\t dataset1: the name of the data-set \n"); - (void) fprintf(stdout, "\t to be created.\n\n"); - (void) fprintf(stdout, "\t INPUT-CLASS:\n"); - (void) fprintf(stdout, "\t String denoting the type of input data.\n"); - (void) fprintf(stdout, "\t (\"TEXTIN\", \"TEXTFP\", \"FP\", \"IN\", \n"); - (void) fprintf(stdout, "\t \"STR\", \"TEXTUIN\", \"UIN\"). \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t For example,\n"); + (void) HDfprintf(stdout, "\t PATH grp1/grp2/dataset1\n"); + (void) HDfprintf(stdout, "\t PATH: keyword\n"); + (void) HDfprintf(stdout, "\t grp1: group under the root. If\n"); + (void) HDfprintf(stdout, "\t non-existent will be created.\n"); + (void) HDfprintf(stdout, "\t grp2: group under grp1. If \n"); + (void) HDfprintf(stdout, "\t non-existent will be created \n"); + (void) HDfprintf(stdout, "\t under grp1.\n"); + (void) HDfprintf(stdout, "\t dataset1: the name of the data-set \n"); + (void) HDfprintf(stdout, "\t to be created.\n\n"); + (void) HDfprintf(stdout, "\t INPUT-CLASS:\n"); + (void) HDfprintf(stdout, "\t String denoting the type of input data.\n"); + (void) HDfprintf(stdout, "\t (\"TEXTIN\", \"TEXTFP\", \"FP\", \"IN\", \n"); + (void) HDfprintf(stdout, "\t \"STR\", \"TEXTUIN\", \"UIN\"). \n"); + (void) HDfprintf(stdout, "\t INPUT-CLASS \"TEXTIN\" denotes an ASCII text \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t file with signed integer data in ASCII form,\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t INPUT-CLASS \"TEXTUIN\" denotes an ASCII text \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t file with unsigned integer data in ASCII form,\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t \"TEXTFP\" denotes an ASCII text file containing\n"); - (void) fprintf(stdout, "\t floating point data in the fixed notation\n"); - (void) fprintf(stdout, "\t (325.34),\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t floating point data in the fixed notation\n"); + (void) HDfprintf(stdout, "\t (325.34),\n"); + (void) HDfprintf(stdout, "\t \"FP\" denotes a floating point binary file,\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t \"IN\" denotes a signed integer binary file,\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t \"UIN\" denotes an unsigned integer binary file,\n"); - (void) fprintf(stdout, "\t & \"STR\" denotes an ASCII text file the \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t & \"STR\" denotes an ASCII text file the \n"); + (void) HDfprintf(stdout, "\t contents of which should be stored as an 1-D \n"); - (void) fprintf(stdout, "\t array of strings.\n"); - (void) fprintf(stdout, "\t If INPUT-CLASS is \"STR\", then RANK, \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t array of strings.\n"); + (void) HDfprintf(stdout, "\t If INPUT-CLASS is \"STR\", then RANK, \n"); + (void) HDfprintf(stdout, "\t DIMENSION-SIZES, OUTPUT-CLASS, OUTPUT-SIZE, \n"); - (void) fprintf(stdout, "\t OUTPUT-ARCHITECTURE and OUTPUT-BYTE-ORDER \n"); - (void) fprintf(stdout, "\t will be ignored.\n\n\n"); - (void) fprintf(stdout, "\t INPUT-SIZE:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE and OUTPUT-BYTE-ORDER \n"); + (void) HDfprintf(stdout, "\t will be ignored.\n\n\n"); + (void) HDfprintf(stdout, "\t INPUT-SIZE:\n"); + (void) HDfprintf(stdout, "\t Integer denoting the size of the input data \n"); - (void) fprintf(stdout, "\t (8, 16, 32, 64). \n\n"); - (void) fprintf(stdout, "\t For floating point,\n"); - (void) fprintf(stdout, "\t INPUT-SIZE can be 32 or 64.\n"); - (void) fprintf(stdout, "\t For integers (signed and unsigned)\n"); - (void) fprintf(stdout, "\t INPUT-SIZE can be 8, 16, 32 or 64.\n\n"); - (void) fprintf(stdout, "\t RANK:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t (8, 16, 32, 64). \n\n"); + (void) HDfprintf(stdout, "\t For floating point,\n"); + (void) HDfprintf(stdout, "\t INPUT-SIZE can be 32 or 64.\n"); + (void) HDfprintf(stdout, "\t For integers (signed and unsigned)\n"); + (void) HDfprintf(stdout, "\t INPUT-SIZE can be 8, 16, 32 or 64.\n\n"); + (void) HDfprintf(stdout, "\t RANK:\n"); + (void) HDfprintf(stdout, "\t Integer denoting the number of dimensions.\n\n"); - (void) fprintf(stdout, "\t DIMENSION-SIZES:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t DIMENSION-SIZES:\n"); + (void) HDfprintf(stdout, "\t Integers separated by spaces to denote the \n"); - (void) fprintf(stdout, "\t dimension sizes for the no. of dimensions \n"); - (void) fprintf(stdout, "\t determined by rank.\n\n"); - (void) fprintf(stdout, "\t OUTPUT-CLASS:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t dimension sizes for the no. of dimensions \n"); + (void) HDfprintf(stdout, "\t determined by rank.\n\n"); + (void) HDfprintf(stdout, "\t OUTPUT-CLASS:\n"); + (void) HDfprintf(stdout, "\t String dentoting data type of the dataset to \n"); - (void) fprintf(stdout, "\t be written (\"IN\",\"FP\", \"UIN\")\n\n"); - (void) fprintf(stdout, "\t OUTPUT-SIZE:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t be written (\"IN\",\"FP\", \"UIN\")\n\n"); + (void) HDfprintf(stdout, "\t OUTPUT-SIZE:\n"); + (void) HDfprintf(stdout, "\t Integer denoting the size of the data in the \n"); - (void) fprintf(stdout, "\t output dataset to be written.\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t output dataset to be written.\n"); + (void) HDfprintf(stdout, "\t If OUTPUT-CLASS is \"FP\", OUTPUT-SIZE can be \n"); - (void) fprintf(stdout, "\t 32 or 64.\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t 32 or 64.\n"); + (void) HDfprintf(stdout, "\t If OUTPUT-CLASS is \"IN\" or \"UIN\", OUTPUT-SIZE\n"); - (void) fprintf(stdout, "\t can be 8, 16, 32 or 64.\n\n"); - (void) fprintf(stdout, "\t OUTPUT-ARCHITECTURE:\n"); - (void) fprintf(stdout, "\t STRING denoting the type of output \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t can be 8, 16, 32 or 64.\n\n"); + (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE:\n"); + (void) HDfprintf(stdout, "\t STRING denoting the type of output \n"); + (void) HDfprintf(stdout, "\t architecture. Can accept the following values\n"); - (void) fprintf(stdout, "\t STD\n"); - (void) fprintf(stdout, "\t IEEE\n"); - (void) fprintf(stdout, "\t INTEL\n"); - (void) fprintf(stdout, "\t CRAY\n"); - (void) fprintf(stdout, "\t MIPS\n"); - (void) fprintf(stdout, "\t ALPHA\n"); - (void) fprintf(stdout, "\t NATIVE (default)\n"); - (void) fprintf(stdout, "\t UNIX\n\n"); - (void) fprintf(stdout, "\t OUTPUT-BYTE-ORDER:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t STD\n"); + (void) HDfprintf(stdout, "\t IEEE\n"); + (void) HDfprintf(stdout, "\t INTEL\n"); + (void) HDfprintf(stdout, "\t CRAY\n"); + (void) HDfprintf(stdout, "\t MIPS\n"); + (void) HDfprintf(stdout, "\t ALPHA\n"); + (void) HDfprintf(stdout, "\t NATIVE (default)\n"); + (void) HDfprintf(stdout, "\t UNIX\n\n"); + (void) HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER:\n"); + (void) HDfprintf(stdout, "\t String denoting the output-byte-order. Ignored\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t if the OUTPUT-ARCHITECTURE is not specified or\n"); - (void) fprintf(stdout, "\t if it is IEEE, UNIX or STD. Can accept the \n"); - (void) fprintf(stdout, "\t following values.\n"); - (void) fprintf(stdout, "\t BE (default)\n"); - (void) fprintf(stdout, "\t LE\n\n"); - (void) fprintf(stdout, "\t CHUNKED-DIMENSION-SIZES:\n"); - (void) fprintf(stdout, "\t Integers separated by spaces to denote the \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t if it is IEEE, UNIX or STD. Can accept the \n"); + (void) HDfprintf(stdout, "\t following values.\n"); + (void) HDfprintf(stdout, "\t BE (default)\n"); + (void) HDfprintf(stdout, "\t LE\n\n"); + (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES:\n"); + (void) HDfprintf(stdout, "\t Integers separated by spaces to denote the \n"); + (void) HDfprintf(stdout, "\t dimension sizes of the chunk for the no. of \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t dimensions determined by rank. Required field\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t to denote that the dataset will be stored with\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t chunked storage. If this field is absent the\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t dataset will be stored with contiguous storage.\n\n"); - (void) fprintf(stdout, "\t COMPRESSION-TYPE:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t COMPRESSION-TYPE:\n"); + (void) HDfprintf(stdout, "\t String denoting the type of compression to be\n"); - (void) fprintf(stdout, "\t used with the chunked storage. Requires the\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t used with the chunked storage. Requires the\n"); + (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES to be specified. The only \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t currently supported compression method is GZIP. \n"); - (void) fprintf(stdout, "\t Will accept the following value\n"); - (void) fprintf(stdout, "\t GZIP\n\n"); - (void) fprintf(stdout, "\t COMPRESSION-PARAM:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t Will accept the following value\n"); + (void) HDfprintf(stdout, "\t GZIP\n\n"); + (void) HDfprintf(stdout, "\t COMPRESSION-PARAM:\n"); + (void) HDfprintf(stdout, "\t Integer used to denote compression level and \n"); - (void) fprintf(stdout, "\t this option is to be always specified when \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t this option is to be always specified when \n"); + (void) HDfprintf(stdout, "\t the COMPRESSION-TYPE option is specified. The\n"); - (void) fprintf(stdout, "\t values are applicable only to GZIP \n"); - (void) fprintf(stdout, "\t compression.\n"); - (void) fprintf(stdout, "\t Value 1-9: The level of Compression. \n"); - (void) fprintf(stdout, "\t 1 will result in the fastest \n"); - (void) fprintf(stdout, "\t compression while 9 will result in \n"); - (void) fprintf(stdout, "\t the best compression ratio. The default\n"); - (void) fprintf(stdout, "\t level of compression is 6.\n\n"); - (void) fprintf(stdout, "\t EXTERNAL-STORAGE:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t values are applicable only to GZIP \n"); + (void) HDfprintf(stdout, "\t compression.\n"); + (void) HDfprintf(stdout, "\t Value 1-9: The level of Compression. \n"); + (void) HDfprintf(stdout, "\t 1 will result in the fastest \n"); + (void) HDfprintf(stdout, "\t compression while 9 will result in \n"); + (void) HDfprintf(stdout, "\t the best compression ratio. The default\n"); + (void) HDfprintf(stdout, "\t level of compression is 6.\n\n"); + (void) HDfprintf(stdout, "\t EXTERNAL-STORAGE:\n"); + (void) HDfprintf(stdout, "\t String to denote the name of the non-HDF5 file \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t to store data to. Cannot be used if CHUNKED-\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t DIMENSIONS or COMPRESSION-TYPE or EXTENDIBLE-\n"); - (void) fprintf(stdout, "\t DATASET is specified.\n"); - (void) fprintf(stdout, "\t Value : the name of the \n"); - (void) fprintf(stdout, "\t external file as a string to be used.\n\n"); - (void) fprintf(stdout, "\t MAXIMUM-DIMENSIONS:\n"); - (void) fprintf(stdout, "\t Integers separated by spaces to denote the \n"); - (void) fprintf(stdout, "\t maximum dimension sizes of all the \n"); - (void) fprintf(stdout, "\t dimensions determined by rank. Requires the\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t DATASET is specified.\n"); + (void) HDfprintf(stdout, "\t Value : the name of the \n"); + (void) HDfprintf(stdout, "\t external file as a string to be used.\n\n"); + (void) HDfprintf(stdout, "\t MAXIMUM-DIMENSIONS:\n"); + (void) HDfprintf(stdout, "\t Integers separated by spaces to denote the \n"); + (void) HDfprintf(stdout, "\t maximum dimension sizes of all the \n"); + (void) HDfprintf(stdout, "\t dimensions determined by rank. Requires the\n"); + (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES to be specified. A value of \n"); - (void) fprintf(stdout, "\t -1 for any dimension implies UNLIMITED \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t -1 for any dimension implies UNLIMITED \n"); + (void) HDfprintf(stdout, "\t DIMENSION size for that particular dimension.\n\n"); - (void) fprintf(stdout, "\t EXAMPLES:\n"); - (void) fprintf(stdout, "\t 1. Configuration File may look like:\n\n"); - (void) fprintf(stdout, "\t PATH work h5 pkamat First-set\n"); - (void) fprintf(stdout, "\t INPUT-CLASS TEXTFP\n"); - (void) fprintf(stdout, "\t RANK 3\n"); - (void) fprintf(stdout, "\t DIMENSION-SIZES 5 2 4\n"); - (void) fprintf(stdout, "\t OUTPUT-CLASS FP\n"); - (void) fprintf(stdout, "\t OUTPUT-SIZE 64\n"); - (void) fprintf(stdout, "\t OUTPUT-ARCHITECTURE IEEE\n"); - (void) fprintf(stdout, "\t OUTPUT-BYTE-ORDER LE\n"); - (void) fprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 \n\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t EXAMPLES:\n"); + (void) HDfprintf(stdout, "\t 1. Configuration File may look like:\n\n"); + (void) HDfprintf(stdout, "\t PATH work h5 pkamat First-set\n"); + (void) HDfprintf(stdout, "\t INPUT-CLASS TEXTFP\n"); + (void) HDfprintf(stdout, "\t RANK 3\n"); + (void) HDfprintf(stdout, "\t DIMENSION-SIZES 5 2 4\n"); + (void) HDfprintf(stdout, "\t OUTPUT-CLASS FP\n"); + (void) HDfprintf(stdout, "\t OUTPUT-SIZE 64\n"); + (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE IEEE\n"); + (void) HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER LE\n"); + (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 \n\n"); + (void) HDfprintf(stdout, "\t The above configuration will accept a floating point array \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t (5 x 2 x 4) in an ASCII file with the rank and dimension sizes \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t specified and will save it in a chunked data-set (of pattern \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t 2 X 2 X 2) of 64-bit floating point in the little-endian order \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t and IEEE architecture. The dataset will be stored at\n"); - (void) fprintf(stdout, "\t \"/work/h5/pkamat/First-set\"\n\n"); - (void) fprintf(stdout, "\t 2. Another configuration could be:\n\n"); - (void) fprintf(stdout, "\t PATH Second-set\n"); - (void) fprintf(stdout, "\t INPUT-CLASS IN \n"); - (void) fprintf(stdout, "\t RANK 5\n"); - (void) fprintf(stdout, "\t DIMENSION-SIZES 6 3 5 2 4\n"); - (void) fprintf(stdout, "\t OUTPUT-CLASS IN\n"); - (void) fprintf(stdout, "\t OUTPUT-SIZE 32\n"); - (void) fprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 2 2\n"); - (void) fprintf(stdout, "\t EXTENDIBLE-DATASET 1 3 \n"); - (void) fprintf(stdout, "\t COMPRESSION-TYPE GZIP\n"); - (void) fprintf(stdout, "\t COMPRESSION-PARAM 7\n\n\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t \"/work/h5/pkamat/First-set\"\n\n"); + (void) HDfprintf(stdout, "\t 2. Another configuration could be:\n\n"); + (void) HDfprintf(stdout, "\t PATH Second-set\n"); + (void) HDfprintf(stdout, "\t INPUT-CLASS IN \n"); + (void) HDfprintf(stdout, "\t RANK 5\n"); + (void) HDfprintf(stdout, "\t DIMENSION-SIZES 6 3 5 2 4\n"); + (void) HDfprintf(stdout, "\t OUTPUT-CLASS IN\n"); + (void) HDfprintf(stdout, "\t OUTPUT-SIZE 32\n"); + (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 2 2\n"); + (void) HDfprintf(stdout, "\t EXTENDIBLE-DATASET 1 3 \n"); + (void) HDfprintf(stdout, "\t COMPRESSION-TYPE GZIP\n"); + (void) HDfprintf(stdout, "\t COMPRESSION-PARAM 7\n\n\n"); + (void) HDfprintf(stdout, "\t The above configuration will accept an integer array \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t (6 X 3 X 5 x 2 x 4) in a binary file with the rank and \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t dimension sizes specified and will save it in a chunked data-set\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t (of pattern 2 X 2 X 2 X 2 X 2) of 32-bit floating point in \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t native format (as output-architecture is not specified). The \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t first and the third dimension will be defined as unlimited. The \n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t data-set will be compressed using GZIP and a compression level \n"); - (void) fprintf(stdout, "\t of 7.\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t of 7.\n"); + (void) HDfprintf(stdout, "\t The dataset will be stored at \"/Second-set\"\n\n"); return; } void usage(char *name) { - (void) fprintf(stdout, "\nUsage:\t%s -h[elp], OR\n", name); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\nUsage:\t%s -h[elp], OR\n", name); + (void) HDfprintf(stdout, "\t%s -c[onfig] \ [ -c[config] ...] -o[utfile] \n\n", name); return; diff --git a/tools/h5import/h5import.h b/tools/h5import/h5import.h index 05de476..dbc6844 100755 --- a/tools/h5import/h5import.h +++ b/tools/h5import/h5import.h @@ -47,7 +47,7 @@ #define CHUNK 0 #define COMPRESS 1 #define EXTEND 2 -#define EXTERNAL 3 +#define EXTERNALSTORE 3 #define DIM 4 #define RANK 5 #define PATH 6 diff --git a/tools/h5jam/CMakeLists.txt b/tools/h5jam/CMakeLists.txt index e5caa11..9a74ebc 100644 --- a/tools/h5jam/CMakeLists.txt +++ b/tools/h5jam/CMakeLists.txt @@ -50,7 +50,7 @@ IF (BUILD_TESTING) IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5jamgentest ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jamgentest.c) TARGET_NAMING (h5jamgentest ${LIB_TYPE}) - TARGET_LINK_LIBRARIES (h5jamgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + TARGET_LINK_LIBRARIES (h5jamgentest ${HDF5_LIB_TARGET}) SET_TARGET_PROPERTIES (h5jamgentest PROPERTIES FOLDER generator/tools) #ADD_TEST (NAME h5jamgentest COMMAND $) diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c index 293aa17..f536605 100644 --- a/tools/h5jam/getub.c +++ b/tools/h5jam/getub.c @@ -21,6 +21,7 @@ #endif #include "H5private.h" +#include "h5tools.h" #include "h5tools_utils.h" void parse_command_line (int argc, const char *argv[]); @@ -32,9 +33,9 @@ void parse_command_line (int argc, const char *argv[]); #define PROGRAMNAME "getub" char *nbytes = NULL; -static const char *s_opts = "c:"; /* add more later ? */ +static const char *s_opts = "c:"; /* add more later ? */ static struct long_options l_opts[] = { - {"c", require_arg, 'c'}, /* input file */ + {"c", require_arg, 'c'}, /* input file */ {NULL, 0, '\0'} }; @@ -84,15 +85,15 @@ parse_command_line (int argc, const char *argv[]) while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) { switch ((char) opt) - { - case 'c': - nbytes = HDstrdup (opt_arg); - break; - case '?': - default: - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } + { + case 'c': + nbytes = HDstrdup (opt_arg); + break; + case '?': + default: + usage (h5tools_getprogname()); + exit (EXIT_FAILURE); + } } if (argc <= opt_ind) @@ -115,6 +116,9 @@ main (int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); + /* Initialize h5tools lib */ + h5tools_init(); + parse_command_line (argc, argv); if (nbytes == NULL) @@ -161,7 +165,7 @@ main (int argc, const char *argv[]) if (res < (long)size) { if (buf) - free (buf); + free (buf); HDclose (fd); exit (EXIT_FAILURE); } diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index 5520dc7..981eead 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -15,6 +15,7 @@ #include "hdf5.h" #include "H5private.h" +#include "h5tools.h" #include "h5tools_utils.h" /* Name of tool */ @@ -139,7 +140,7 @@ leave(int ret) h5tools_close(); - exit(ret); + HDexit(ret); } /*------------------------------------------------------------------------- @@ -237,6 +238,9 @@ main (int argc, const char *argv[]) H5Eget_auto2(H5E_DEFAULT, &func, &edata); H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + /* Initialize h5tools lib */ + h5tools_init(); + parse_command_line (argc, argv); if (ub_file == NULL) { diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index ec79215..ca3d86c 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -310,18 +310,18 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) { HDassert(ub_size <= BUF_SIZE); - fd = HDopen(filename, O_RDWR, 0); + fd = HDopen(filename, O_RDWR, 0); HDassert(fd >= 0); - /* fill buf with pattern */ - HDmemset(buf, '\0', ub_size); - bp = buf; - for (u = 0; u < ub_fill; u++) + /* fill buf with pattern */ + HDmemset(buf, '\0', ub_size); + bp = buf; + for (u = 0; u < ub_fill; u++) *bp++ = pattern[u % 10]; - HDwrite(fd, buf, ub_size); + HDwrite(fd, buf, ub_size); - HDclose(fd); + HDclose(fd); } } @@ -334,9 +334,9 @@ create_textfile(const char *name, size_t size) char *bp; fd = HDcreat(name,0777); - assert(fd >= 0); - buf = calloc(size, (size_t)1); - assert(buf); + HDassert(fd >= 0); + buf = HDcalloc(size, (size_t)1); + HDassert(buf); /* fill buf with pattern */ bp = buf; @@ -345,7 +345,7 @@ create_textfile(const char *name, size_t size) HDwrite(fd, buf, size); - free(buf); + HDfree(buf); HDclose(fd); } @@ -363,7 +363,7 @@ create_binfile(char *name, off_t size) fd = creat(name,0777); HDassert(fd >= 0); - buf = calloc(size,1); + buf = HDcalloc(size,1); HDassert(buf); /* fill buf with pattern */ diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index 14ed651..4751dad 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -15,6 +15,7 @@ #include "hdf5.h" #include "H5private.h" +#include "h5tools.h" #include "h5tools_utils.h" /* Name of tool */ @@ -142,7 +143,7 @@ leave(int ret) h5tools_close(); - exit(ret); + HDexit(ret); } /*------------------------------------------------------------------------- @@ -199,7 +200,7 @@ parse_command_line(int argc, const char *argv[]) if (argc <= opt_ind+2) { error_msg("missing file name\n"); usage(h5tools_getprogname()); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } */ } diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c index f1b6756..0169d71 100644 --- a/tools/h5jam/tellub.c +++ b/tools/h5jam/tellub.c @@ -21,6 +21,7 @@ #include "hdf5.h" #include "H5private.h" +#include "h5tools.h" #include "h5tools_utils.h" #define TRUE 1 @@ -60,7 +61,7 @@ usage (const char *prog) fflush (stdout); fprintf (stdout, "usage: %s h5_file\n", prog); fprintf (stdout, - " Check that h5_fil is HDF5 file and print size of user block \n"); + " Check that h5_fil is HDF5 file and print size of user block \n"); fprintf (stdout, " %s -h\n", prog); fprintf (stdout, " Print a usage message and exit\n"); } @@ -90,15 +91,15 @@ parse_command_line (int argc, const char *argv[]) while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) { switch ((char) opt) - { - case 'h': - usage (h5tools_getprogname()); - exit (EXIT_SUCCESS); - case '?': - default: - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } + { + case 'h': + usage (h5tools_getprogname()); + exit (EXIT_SUCCESS); + case '?': + default: + usage (h5tools_getprogname()); + exit (EXIT_FAILURE); + } } /* check for file name to be processed */ @@ -139,6 +140,9 @@ main (int argc, const char *argv[]) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); + /* Initialize h5tools lib */ + h5tools_init(); + /* Disable error reporting */ H5Eget_auto2(H5E_DEFAULT, &func, &edata); H5Eset_auto2(H5E_DEFAULT, NULL, NULL); @@ -174,7 +178,7 @@ main (int argc, const char *argv[]) if (plist < 0) { error_msg("Can't get file creation plist for file \"%s\"\n", - ifname); + ifname); return (EXIT_FAILURE); } diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 66e588f..7315796 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -27,12 +27,86 @@ #include "H5private.h" #include "h5tools.h" #include "h5tools_utils.h" +#include "h5tools_dump.h" #include "h5trav.h" /* Name of tool */ #define PROGRAMNAME "h5ls" #define NAME_BUF_SIZE 2048 +/* + * Alternative formating for data dumped by H5LS + * + * This table only affects H5LS output. + */ +static h5tool_format_t ls_dataformat = { + 0, /*raw */ + + "", /*fmt_raw */ + "%d", /*fmt_int */ + "%u", /*fmt_uint */ + "%hhd", /*fmt_schar */ + "%u", /*fmt_uchar */ + "%d", /*fmt_short */ + "%u", /*fmt_ushort */ + "%ld", /*fmt_long */ + "%lu", /*fmt_ulong */ + NULL, /*fmt_llong */ + NULL, /*fmt_ullong */ + "%g", /*fmt_double */ + "%g", /*fmt_float */ + + 0, /*ascii */ + 0, /*str_locale */ + 0, /*str_repeat */ + + "[", /*arr_pre */ + ",", /*arr_sep */ + "]", /*arr_suf */ + 1, /*arr_linebreak */ + + "", /*cmpd_name */ + ",", /*cmpd_sep */ + "{", /*cmpd_pre */ + "}", /*cmpd_suf */ + "", /*cmpd_end */ + + ",", /*vlen_sep */ + "(", /*vlen_pre */ + ")", /*vlen_suf */ + "", /*vlen_end */ + + "%s", /*elmt_fmt */ + ",", /*elmt_suf1 */ + " ", /*elmt_suf2 */ + + HSIZE_T_FORMAT, /*idx_n_fmt */ + ",", /*idx_sep */ + "(%s)", /*idx_fmt */ + + 65535, /*line_ncols *//*standard default columns */ + 0, /*line_per_line */ + "", /*line_pre */ + "%s", /*line_1st */ + "%s", /*line_cont */ + "", /*line_suf */ + "", /*line_sep */ + 1, /*line_multi_new */ + "", /*line_indent */ + + 0, /*skip_first */ + + 0, /*obj_hidefileno */ + "-%lu:"H5_PRINTF_HADDR_FMT, /*obj_format */ + + 0, /*dset_hidefileno */ + "DSET-%s ", /*dset_format */ + "%sBlk%lu: ", /*dset_blockformat_pre */ + "%sPt%lu: ", /*dset_ptformat_pre */ + "%s", /*dset_ptformat */ + 1, /*array indices */ + 1 /*escape non printable characters */ +}; /* Struct to pass through to visitors */ typedef struct { @@ -74,98 +148,1165 @@ static struct dispatch_t { herr_t (*list2)(hid_t obj, const char *name); } dispatch_g[H5O_TYPE_NTYPES]; -#define DISPATCH(TYPE, NAME, LIST1, LIST2) { \ - dispatch_g[TYPE].name = (NAME); \ - dispatch_g[TYPE].list1 = (LIST1); \ - dispatch_g[TYPE].list2 = (LIST2); \ +#define DISPATCH(TYPE, NAME, LIST1, LIST2) { \ + dispatch_g[TYPE].name = (NAME); \ + dispatch_g[TYPE].list1 = (LIST1); \ + dispatch_g[TYPE].list2 = (LIST2); \ +} + +static void display_type(hid_t type, int ind); +static void print_type(h5tools_str_t *buffer, hid_t type, int ind); +static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter); + + +/*------------------------------------------------------------------------- + * Function: usage + * + * Purpose: Prints a usage message on stderr and then returns. + * + * Return: void + * + * Programmer: Robb Matzke + * Thursday, July 16, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +usage (void) +{ + HDfprintf(rawerrorstream, "\ +usage: %s [OPTIONS] [OBJECTS...]\n\ + OPTIONS\n\ + -h, -?, --help Print a usage message and exit\n\ + -a, --address Print raw data address. If dataset is contiguous, address\n\ + is offset in file of beginning of raw data. If chunked,\n\ + returned list of addresses indicates offset of each chunk.\n\ + Must be used with -v, --verbose option.\n\ + Provides no information for non-dataset objects.\n\ + -d, --data Print the values of datasets\n\ + --enable-error-stack\n\ + Prints messages from the HDF5 error stack as they occur.\n\ + --follow-symlinks\n\ + Follow symbolic links (soft links and external links)\n\ + to display target object information.\n\ + Without this option, h5ls identifies a symbolic link\n\ + as a soft link or external link and prints the value\n\ + assigned to the symbolic link; it does not provide any\n\ + information regarding the target object or determine\n\ + whether the link is a dangling link.\n\ + --no-dangling-links\n\ + Must be used with --follow-symlinks option;\n\ + otherwise, h5ls shows error message and returns an exit\n\ + code of 1. \n\ + Check for any symbolic links (soft links or external links)\n\ + that do not resolve to an existing object (dataset, group,\n\ + or named datatype).\n\ + If any dangling link is found, this situation is treated\n\ + as an error and h5ls returns an exit code of 1.\n\ + -f, --full Print full path names instead of base names\n\ + -g, --group Show information about a group, not its contents\n\ + -l, --label Label members of compound datasets\n\ + -r, --recursive List all groups recursively, avoiding cycles\n\ + -s, --string Print 1-byte integer datasets as ASCII\n\ + -S, --simple Use a machine-readable output format\n\ + -wN, --width=N Set the number of columns of output\n\ + -v, --verbose Generate more verbose output\n\ + -V, --version Print version number and exit\n\ + --vfd=DRIVER Use the specified virtual file driver\n\ + -x, --hexdump Show raw data in hexadecimal format\n\ +\n\ + OBJECTS\n\ + Each object consists of an HDF5 file name optionally followed by a\n\ + slash and an object name within the file (if no object is specified\n\ + within the file then the contents of the root group are displayed).\n\ + The file name may include a printf(3C) integer format such as\n\ + \"%%05d\" to open a file family.\n\ +\n\ + Deprecated Options\n\ + The following options have been deprecated in HDF5. While they remain\n\ + available, they have been superseded as indicated and may be removed\n\ + from HDF5 in the future. Use the indicated replacement option in all\n\ + new work; where possible, existing scripts, et cetera, should also be\n\ + updated to use the replacement option.\n\ +\n\ + -E or --external Follow external links.\n\ + Replaced by --follow-symlinks.\n\ + -e, --errors Show all HDF5 error reporting\n\ + Replaced by --enable-error-stack.\n", + h5tools_getprogname()); +} + + +/*------------------------------------------------------------------------- + * Function: display_string + * + * Purpose: Print a string value by escaping unusual characters. If + * STREAM is null then we only count how large the output would + * be. + * + * Return: Number of characters printed. + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +display_string(FILE *stream, const char *s, hbool_t escape_spaces) +{ + int nprint=0; + + for (/*void*/; s && *s; s++) { + switch (*s) { + case '"': + if (stream) HDfprintf(stream, "\\\""); + nprint += 2; + break; + case '\\': + if (stream) HDfprintf(stream, "\\\\"); + nprint += 2; + break; + case '\b': + if (stream) HDfprintf(stream, "\\b"); + nprint += 2; + break; + case '\f': + if (stream) HDfprintf(stream, "\\f"); + nprint += 2; + break; + case '\n': + if (stream) HDfprintf(stream, "\\n"); + nprint += 2; + break; + case '\r': + if (stream) HDfprintf(stream, "\\r"); + nprint += 2; + break; + case '\t': + if (stream) HDfprintf(stream, "\\t"); + nprint += 2; + break; + case ' ': + if (escape_spaces) { + if (stream) HDfprintf(stream, "\\ "); + nprint += 2; + } else { + if (stream) HDfprintf(stream, " "); + nprint++; + } + break; + default: + if (isprint((int)*s)) { + if (stream) HDfputc(*s, stream); + nprint++; + } else { + if (stream) { + HDfprintf(stream, "\\%03o", *((const unsigned char*)s)); + } + nprint += 4; + } + break; + } + } + return nprint; +} + + +/*------------------------------------------------------------------------- + * Function: display_obj_name + * + * Purpose: Print an object name and another string. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Quincey Koziol + * Tuesday, November 6, 2007 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +display_obj_name(FILE *stream, const iter_t *iter, const char *oname, + const char *s) +{ + static char fullname[NAME_BUF_SIZE]; /* Buffer for file and/or object name */ + const char *name = fullname; /* Pointer to buffer for printing */ + int n; + + if(show_file_name_g) + sprintf(fullname, "%s/%s", iter->fname, oname + iter->name_start); + else + name = oname + iter->name_start; + + /* Print the object name, either full name or base name */ + if(fullname_g) + n = display_string(stream, name, TRUE); + else { + const char *last_sep; /* The location of the last group separator */ + + /* Find the last component of the path name */ + if(NULL == (last_sep = HDstrrchr(name, '/'))) + last_sep = name; + else { + last_sep++; + } /* end else */ + n = display_string(stream, last_sep, TRUE); + } /* end else */ + HDfprintf(rawoutstream, "%*s ", MAX(0, (24 - n)), s); + + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_native_type + * + * Purpose: Prints the name of a native C data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed. + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * Robb Matzke, 1999-06-11 + * Added the C9x types, but we still prefer to display the types + * from the C language itself (like `int' vs. `int32_t'). + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_native_type(hid_t type, int UNUSED ind) +{ + if (H5Tequal(type, H5T_NATIVE_SCHAR)==TRUE) { + HDfprintf(rawoutstream, "native signed char"); + } else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) { + HDfprintf(rawoutstream, "native unsigned char"); + } else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) { + HDfprintf(rawoutstream, "native int"); + } else if (H5Tequal(type, H5T_NATIVE_UINT)==TRUE) { + HDfprintf(rawoutstream, "native unsigned int"); + } else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) { + HDfprintf(rawoutstream, "native short"); + } else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) { + HDfprintf(rawoutstream, "native unsigned short"); + } else if (H5Tequal(type, H5T_NATIVE_LONG)==TRUE) { + HDfprintf(rawoutstream, "native long"); + } else if (H5Tequal(type, H5T_NATIVE_ULONG)==TRUE) { + HDfprintf(rawoutstream, "native unsigned long"); + } else if (H5Tequal(type, H5T_NATIVE_LLONG)==TRUE) { + HDfprintf(rawoutstream, "native long long"); + } else if (H5Tequal(type, H5T_NATIVE_ULLONG)==TRUE) { + HDfprintf(rawoutstream, "native unsigned long long"); + } else if (H5Tequal(type, H5T_NATIVE_FLOAT)==TRUE) { + HDfprintf(rawoutstream, "native float"); + } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)==TRUE) { + HDfprintf(rawoutstream, "native double"); +#if H5_SIZEOF_LONG_DOUBLE !=0 + } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)==TRUE) { + HDfprintf(rawoutstream, "native long double"); +#endif + } else if (H5Tequal(type, H5T_NATIVE_INT8)==TRUE) { + HDfprintf(rawoutstream, "native int8_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT8)==TRUE) { + HDfprintf(rawoutstream, "native uint8_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT16)==TRUE) { + HDfprintf(rawoutstream, "native int16_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT16)==TRUE) { + HDfprintf(rawoutstream, "native uint16_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT32)==TRUE) { + HDfprintf(rawoutstream, "native int32_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT32)==TRUE) { + HDfprintf(rawoutstream, "native uint32_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT64)==TRUE) { + HDfprintf(rawoutstream, "native int64_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT64)==TRUE) { + HDfprintf(rawoutstream, "native uint64_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST8)==TRUE) { + HDfprintf(rawoutstream, "native int_least8_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST8)==TRUE) { + HDfprintf(rawoutstream, "native uint_least8_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST16)==TRUE) { + HDfprintf(rawoutstream, "native int_least16_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST16)==TRUE) { + HDfprintf(rawoutstream, "native uint_least16_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST32)==TRUE) { + HDfprintf(rawoutstream, "native int_least32_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST32)==TRUE) { + HDfprintf(rawoutstream, "native uint_least32_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST64)==TRUE) { + HDfprintf(rawoutstream, "native int_least64_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST64)==TRUE) { + HDfprintf(rawoutstream, "native uint_least64_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_FAST8)==TRUE) { + HDfprintf(rawoutstream, "native int_fast8_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST8)==TRUE) { + HDfprintf(rawoutstream, "native uint_fast8_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_FAST16)==TRUE) { + HDfprintf(rawoutstream, "native int_fast16_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST16)==TRUE) { + HDfprintf(rawoutstream, "native uint_fast16_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_FAST32)==TRUE) { + HDfprintf(rawoutstream, "native int_fast32_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST32)==TRUE) { + HDfprintf(rawoutstream, "native uint_fast32_t"); + } else if (H5Tequal(type, H5T_NATIVE_INT_FAST64)==TRUE) { + HDfprintf(rawoutstream, "native int_fast64_t"); + } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST64)==TRUE) { + HDfprintf(rawoutstream, "native uint_fast64_t"); + } else if (H5Tequal(type, H5T_NATIVE_B8)==TRUE) { + HDfprintf(rawoutstream, "native 8-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_B16)==TRUE) { + HDfprintf(rawoutstream, "native 16-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_B32)==TRUE) { + HDfprintf(rawoutstream, "native 32-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_B64)==TRUE) { + HDfprintf(rawoutstream, "native 64-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_HSIZE)==TRUE) { + HDfprintf(rawoutstream, "native hsize_t"); + } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)==TRUE) { + HDfprintf(rawoutstream, "native hssize_t"); + } else if (H5Tequal(type, H5T_NATIVE_HERR)==TRUE) { + HDfprintf(rawoutstream, "native herr_t"); + } else if (H5Tequal(type, H5T_NATIVE_HBOOL)==TRUE) { + HDfprintf(rawoutstream, "native hbool_t"); + } else { + return FALSE; + } + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_ieee_type + * + * Purpose: Print the name of an IEEE floating-point data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_ieee_type(hid_t type, int UNUSED ind) +{ + if (H5Tequal(type, H5T_IEEE_F32BE)==TRUE) { + HDfprintf(rawoutstream, "IEEE 32-bit big-endian float"); + } else if (H5Tequal(type, H5T_IEEE_F32LE)==TRUE) { + HDfprintf(rawoutstream, "IEEE 32-bit little-endian float"); + } else if (H5Tequal(type, H5T_IEEE_F64BE)==TRUE) { + HDfprintf(rawoutstream, "IEEE 64-bit big-endian float"); + } else if (H5Tequal(type, H5T_IEEE_F64LE)==TRUE) { + HDfprintf(rawoutstream, "IEEE 64-bit little-endian float"); + } else { + return FALSE; + } + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_precision + * + * Purpose: Prints information on the next line about precision and + * padding if the precision is less than the total data type + * size. + * + * Return: void + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +display_precision(hid_t type, int ind) +{ + size_t prec; /* precision */ + H5T_pad_t plsb, pmsb; /* lsb and msb padding */ + const char *plsb_s=NULL; /* lsb padding string */ + const char *pmsb_s=NULL; /* msb padding string */ + size_t nbits; /* number of bits */ + + /* If the precision is less than the total size then show the precision + * and offset on the following line. Also display the padding + * information. */ + if (8*H5Tget_size(type)!=(prec=H5Tget_precision(type))) { + HDfprintf(rawoutstream, "\n%*s(%lu bit%s of precision beginning at bit %lu)", + ind, "", (unsigned long)prec, 1==prec?"":"s", + (unsigned long)H5Tget_offset(type)); + + H5Tget_pad(type, &plsb, &pmsb); + if (H5Tget_offset(type)>0) { + switch (plsb) { + case H5T_PAD_ZERO: + plsb_s = "zero"; + break; + case H5T_PAD_ONE: + plsb_s = "one"; + break; + case H5T_PAD_BACKGROUND: + plsb_s = "bkg"; + break; + case H5T_PAD_ERROR: + case H5T_NPAD: + plsb_s = "unknown"; + break; + default: + ; + break; + } + } + if (H5Tget_offset(type)+prec<8*H5Tget_size(type)) { + switch (pmsb) { + case H5T_PAD_ZERO: + pmsb_s = "zero"; + break; + case H5T_PAD_ONE: + pmsb_s = "one"; + break; + case H5T_PAD_BACKGROUND: + pmsb_s = "bkg"; + break; + case H5T_PAD_ERROR: + case H5T_NPAD: + pmsb_s = "unknown"; + break; + default: + ; + break; + } + } + if (plsb_s || pmsb_s) { + HDfprintf(rawoutstream, "\n%*s(", ind, ""); + if (plsb_s) { + nbits = H5Tget_offset(type); + HDfprintf(rawoutstream, "%lu %s bit%s at bit 0", + (unsigned long)nbits, plsb_s, 1==nbits?"":"s"); + } + if (plsb_s && pmsb_s) HDfprintf(rawoutstream, ", "); + if (pmsb_s) { + nbits = 8*H5Tget_size(type)-(H5Tget_offset(type)+prec); + HDfprintf(rawoutstream, "%lu %s bit%s at bit %lu", + (unsigned long)nbits, pmsb_s, 1==nbits?"":"s", + (unsigned long)(8*H5Tget_size(type)-nbits)); + } + HDfprintf(rawoutstream, ")"); + } + } +} + + +/*------------------------------------------------------------------------- + * Function: display_int_type + * + * Purpose: Print the name of an integer data type. Common information + * like number of bits, byte order, and sign scheme appear on + * the first line. Additional information might appear in + * parentheses on the following lines. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_int_type(hid_t type, int ind) +{ + H5T_order_t order; /* byte order value */ + const char *order_s=NULL; /* byte order string */ + H5T_sign_t sign; /* sign scheme value */ + const char *sign_s=NULL; /* sign scheme string */ + + if (H5T_INTEGER!=H5Tget_class(type)) return FALSE; + + /* Byte order */ + if (H5Tget_size(type)>1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE==order) { + order_s = " little-endian"; + } else if (H5T_ORDER_BE==order) { + order_s = " big-endian"; + } else if (H5T_ORDER_VAX==order) { + order_s = " mixed-endian"; + } else { + order_s = " unknown-byte-order"; + } + } else { + order_s = ""; + } + + /* Sign */ + if ((sign=H5Tget_sign(type))>=0) { + if (H5T_SGN_NONE==sign) { + sign_s = " unsigned"; + } else if (H5T_SGN_2==sign) { + sign_s = ""; + } else { + sign_s = " unknown-sign"; + } + } else { + sign_s = " unknown-sign"; + } + + /* Print size, order, and sign on first line, precision and padding + * information on the subsequent lines */ + HDfprintf(rawoutstream, "%lu-bit%s%s integer", + (unsigned long)(8*H5Tget_size(type)), order_s, sign_s); + display_precision(type, ind); + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_float_type + * + * Purpose: Print info about a floating point data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_float_type(hid_t type, int ind) +{ + H5T_order_t order; /* byte order value */ + const char *order_s=NULL; /* byte order string */ + size_t spos; /* sign bit position */ + size_t esize, epos; /* exponent size and position */ + size_t msize, mpos; /* significand size and position */ + size_t ebias; /* exponent bias */ + H5T_norm_t norm; /* significand normalization */ + const char *norm_s=NULL; /* normalization string */ + H5T_pad_t pad; /* internal padding value */ + const char *pad_s=NULL; /* internal padding string */ + + if (H5T_FLOAT!=H5Tget_class(type)) return FALSE; + + /* Byte order */ + if (H5Tget_size(type)>1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE==order) { + order_s = " little-endian"; + } else if (H5T_ORDER_BE==order) { + order_s = " big-endian"; + } else if (H5T_ORDER_VAX==order) { + order_s = " mixed-endian"; + } else { + order_s = " unknown-byte-order"; + } + } else { + order_s = ""; + } + + /* Print size and byte order on first line, precision and padding on + * subsequent lines. */ + HDfprintf(rawoutstream, "%lu-bit%s floating-point", + (unsigned long)(8*H5Tget_size(type)), order_s); + display_precision(type, ind); + + /* Print sizes, locations, and other information about each field */ + H5Tget_fields (type, &spos, &epos, &esize, &mpos, &msize); + ebias = H5Tget_ebias(type); + norm = H5Tget_norm(type); + switch (norm) { + case H5T_NORM_IMPLIED: + norm_s = ", msb implied"; + break; + case H5T_NORM_MSBSET: + norm_s = ", msb always set"; + break; + case H5T_NORM_NONE: + norm_s = ", no normalization"; + break; + case H5T_NORM_ERROR: + norm_s = ", unknown normalization"; + break; + default: + ; + break; + } + HDfprintf(rawoutstream, "\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "", + (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos, + norm_s); + HDfprintf(rawoutstream, "\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)", + ind, "", (unsigned long)esize, 1==esize?"":"s", + (unsigned long)epos, (unsigned long)ebias); + HDfprintf(rawoutstream, "\n%*s(sign bit at %lu)", ind, "", (unsigned long)spos); + + /* Display internal padding */ + if (1+esize+msize0); + super = H5Tget_super(type); + HDfprintf(rawoutstream, "enum "); + display_type(super, ind+4); + HDfprintf(rawoutstream, " {"); + + /* Determine what data type to use for the native values. To simplify + * things we entertain three possibilities: + * 1. long long -- the largest native signed integer + * 2. unsigned long long -- the largest native unsigned integer + * 3. raw format */ + if (H5Tget_size(type)<=sizeof(long long)) { + dst_size = sizeof(long long); + if (H5T_SGN_NONE==H5Tget_sign(type)) { + native = H5T_NATIVE_ULLONG; + } else { + native = H5T_NATIVE_LLONG; + } + } else { + dst_size = H5Tget_size(type); + } + + /* Get the names and raw values of all members */ + name = HDcalloc(nmembs, sizeof(char*)); + value = (unsigned char *)HDcalloc(nmembs, MAX(H5Tget_size(type), dst_size)); + for (i=0; i0) H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT); + + /* Sort members by increasing value */ + /*not implemented yet*/ + + /* Print members */ + for (i=0; i", ind+4, ""); + HDfprintf(rawoutstream, "\n%*s}", ind, ""); + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_string_type + * + * Purpose: Print information about a string data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_string_type(hid_t type, int UNUSED ind) +{ + H5T_str_t pad; + const char *pad_s=NULL; + H5T_cset_t cset; + const char *cset_s=NULL; + + if (H5T_STRING!=H5Tget_class(type)) return FALSE; + + /* Padding */ + pad = H5Tget_strpad(type); + switch (pad) { + case H5T_STR_NULLTERM: + pad_s = "null-terminated"; + break; + case H5T_STR_NULLPAD: + pad_s = "null-padded"; + break; + case H5T_STR_SPACEPAD: + pad_s = "space-padded"; + break; + case H5T_STR_RESERVED_3: + case H5T_STR_RESERVED_4: + case H5T_STR_RESERVED_5: + case H5T_STR_RESERVED_6: + case H5T_STR_RESERVED_7: + case H5T_STR_RESERVED_8: + case H5T_STR_RESERVED_9: + case H5T_STR_RESERVED_10: + case H5T_STR_RESERVED_11: + case H5T_STR_RESERVED_12: + case H5T_STR_RESERVED_13: + case H5T_STR_RESERVED_14: + case H5T_STR_RESERVED_15: + case H5T_STR_ERROR: + pad_s = "unknown-format"; + break; + default: + ; + break; + } + + /* Character set */ + cset = H5Tget_cset(type); + switch (cset) { + case H5T_CSET_ASCII: + cset_s = "ASCII"; + break; + case H5T_CSET_UTF8: + cset_s = "UTF-8"; + break; + case H5T_CSET_RESERVED_2: + case H5T_CSET_RESERVED_3: + case H5T_CSET_RESERVED_4: + case H5T_CSET_RESERVED_5: + case H5T_CSET_RESERVED_6: + case H5T_CSET_RESERVED_7: + case H5T_CSET_RESERVED_8: + case H5T_CSET_RESERVED_9: + case H5T_CSET_RESERVED_10: + case H5T_CSET_RESERVED_11: + case H5T_CSET_RESERVED_12: + case H5T_CSET_RESERVED_13: + case H5T_CSET_RESERVED_14: + case H5T_CSET_RESERVED_15: + case H5T_CSET_ERROR: + cset_s = "unknown-character-set"; + break; + default: + ; + break; + } + + if (H5Tis_variable_str(type)) { + HDfprintf(rawoutstream, "variable-length"); + } else { + HDfprintf(rawoutstream, "%lu-byte", (unsigned long)H5Tget_size(type)); + } + HDfprintf(rawoutstream, " %s %s string", pad_s, cset_s); + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_reference_type + * + * Purpose: Prints information about a reference data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * Robb Matzke, 1999-06-04 + * Knows about object and dataset region references. + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_reference_type(hid_t type, int UNUSED ind) +{ + if (H5T_REFERENCE!=H5Tget_class(type)) return FALSE; + + if (H5Tequal(type, H5T_STD_REF_OBJ)==TRUE) { + HDfprintf(rawoutstream, "object reference"); + } else if (H5Tequal(type, H5T_STD_REF_DSETREG)==TRUE) { + HDfprintf(rawoutstream, "dataset region reference"); + } else { + HDfprintf(rawoutstream, "%lu-byte unknown reference", + (unsigned long)H5Tget_size(type)); + } + + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_opaque_type + * + * Purpose: Prints information about an opaque data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Monday, June 7, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_opaque_type(hid_t type, int ind) +{ + char *tag; + size_t size; + + if (H5T_OPAQUE!=H5Tget_class(type)) return FALSE; + + size = H5Tget_size(type); + HDfprintf(rawoutstream, "%lu-byte opaque type", (unsigned long)size); + if ((tag=H5Tget_tag(type))) { + HDfprintf(rawoutstream, "\n%*s(tag = \"", ind, ""); + display_string(rawoutstream, tag, FALSE); + HDfprintf(rawoutstream, "\")"); + HDfree(tag); + } + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_vlen_type + * + * Purpose: Print information about a variable-length type + * + * Return: Success: TRUE + * + * Failure: FALSE + * + * Programmer: Robb Matzke + * Friday, December 1, 2000 + * + * Modifications: + *------------------------------------------------------------------------- + */ +static hbool_t +display_vlen_type(hid_t type, int ind) +{ + hid_t super; + + if (H5T_VLEN!=H5Tget_class(type)) return FALSE; + + HDfprintf(rawoutstream, "variable length of\n%*s", ind+4, ""); + super = H5Tget_super(type); + display_type(super, ind+4); + H5Tclose(super); + return TRUE; +} + + +/*--------------------------------------------------------------------------- + * Purpose: Print information about an array type + * + * Return: Success: TRUE + * + * Failure: FALSE + * + * Programmer: Robb Matzke + * Thursday, January 31, 2002 + * + * Modifications: + *--------------------------------------------------------------------------- + */ +static hbool_t +display_array_type(hid_t type, int ind) +{ + hid_t super; + int ndims, i; + hsize_t *dims=NULL; + + if (H5T_ARRAY!=H5Tget_class(type)) return FALSE; + ndims = H5Tget_array_ndims(type); + if (ndims) { + dims = (hsize_t *)HDmalloc(ndims*sizeof(dims[0])); + H5Tget_array_dims2(type, dims); + + /* Print dimensions */ + for (i=0; i1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE==order) { + order_s = " little-endian"; + } else if (H5T_ORDER_BE==order) { + order_s = " big-endian"; + } else if (H5T_ORDER_VAX==order) { + order_s = " mixed-endian"; + } else { + order_s = "unknown-byte-order"; + } + } else { + order_s = ""; + } + + HDfprintf(rawoutstream, "%lu-bit%s bitfield", + (unsigned long)(8*H5Tget_size(type)), order_s); + display_precision(type, ind); + return TRUE; } -static void display_type(hid_t type, int ind); -static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter); - /*------------------------------------------------------------------------- - * Function: usage + * Function: display_type * - * Purpose: Prints a usage message on stderr and then returns. + * Purpose: Prints a data type definition. The definition is printed + * without any leading space or trailing line-feed (although + * there might be line-feeds inside the type definition). The + * first line is assumed to have IND characters before it on + * the same line (printed by the caller). * * Return: void * * Programmer: Robb Matzke - * Thursday, July 16, 1998 + * Thursday, November 5, 1998 * * Modifications: + * Robb Matzke, 1999-06-11 + * Prints the OID of shared data types. * *------------------------------------------------------------------------- */ static void -usage (void) +display_type(hid_t type, int ind) { - fprintf(stderr, "\ -usage: %s [OPTIONS] [OBJECTS...]\n\ - OPTIONS\n\ - -h, -?, --help Print a usage message and exit\n\ - -a, --address Print raw data address. If dataset is contiguous, address\n\ - is offset in file of beginning of raw data. If chunked,\n\ - returned list of addresses indicates offset of each chunk.\n\ - Must be used with -v, --verbose option.\n\ - Provides no information for non-dataset objects.\n\ - -d, --data Print the values of datasets\n\ - --enable-error-stack\n\ - Prints messages from the HDF5 error stack as they occur.\n\ - --follow-symlinks\n\ - Follow symbolic links (soft links and external links)\n\ - to display target object information.\n\ - Without this option, h5ls identifies a symbolic link\n\ - as a soft link or external link and prints the value\n\ - assigned to the symbolic link; it does not provide any\n\ - information regarding the target object or determine\n\ - whether the link is a dangling link.\n\ - --no-dangling-links\n\ - Must be used with --follow-symlinks option;\n\ - otherwise, h5ls shows error message and returns an exit\n\ - code of 1. \n\ - Check for any symbolic links (soft links or external links)\n\ - that do not resolve to an existing object (dataset, group,\n\ - or named datatype).\n\ - If any dangling link is found, this situation is treated\n\ - as an error and h5ls returns an exit code of 1.\n\ - -f, --full Print full path names instead of base names\n\ - -g, --group Show information about a group, not its contents\n\ - -l, --label Label members of compound datasets\n\ - -r, --recursive List all groups recursively, avoiding cycles\n\ - -s, --string Print 1-byte integer datasets as ASCII\n\ - -S, --simple Use a machine-readable output format\n\ - -wN, --width=N Set the number of columns of output\n\ - -v, --verbose Generate more verbose output\n\ - -V, --version Print version number and exit\n\ - --vfd=DRIVER Use the specified virtual file driver\n\ - -x, --hexdump Show raw data in hexadecimal format\n\ -\n\ - OBJECTS\n\ - Each object consists of an HDF5 file name optionally followed by a\n\ - slash and an object name within the file (if no object is specified\n\ - within the file then the contents of the root group are displayed).\n\ - The file name may include a printf(3C) integer format such as\n\ - \"%%05d\" to open a file family.\n\ -\n\ - Deprecated Options\n\ - The following options have been deprecated in HDF5. While they remain\n\ - available, they have been superseded as indicated and may be removed\n\ - from HDF5 in the future. Use the indicated replacement option in all\n\ - new work; where possible, existing scripts, et cetera, should also be\n\ - updated to use the replacement option.\n\ -\n\ - -E or --external Follow external links.\n\ - Replaced by --follow-symlinks.\n\ - -e, --errors Show all HDF5 error reporting\n\ - Replaced by --enable-error-stack.\n", - h5tools_getprogname()); + H5T_class_t data_class = H5Tget_class(type); + + /* Bad data type */ + if (type<0) { + HDfprintf(rawoutstream, ""); + return; + } + + /* Shared? If so then print the type's OID */ + if(H5Tcommitted(type)) { + H5O_info_t oi; + + if(H5Oget_info(type, &oi) >= 0) + HDfprintf(rawoutstream, "shared-%lu:"H5_PRINTF_HADDR_FMT" ", + oi.fileno, oi.addr); + else + HDfprintf(rawoutstream, "shared "); + } /* end if */ + + /* Print the type */ + if((!simple_output_g && display_native_type(type, ind)) || + display_ieee_type(type, ind) || + display_int_type(type, ind) || + display_float_type(type, ind) || + display_cmpd_type(type, ind) || + display_enum_type(type, ind) || + display_string_type(type, ind) || + display_reference_type(type, ind) || + display_vlen_type(type, ind) || + display_array_type(type, ind) || + display_opaque_type(type, ind) || + display_bitfield_type(type, ind)) + return; + + /* Unknown type */ + HDfprintf(rawoutstream, "%lu-byte class-%u unknown", + (unsigned long)H5Tget_size(type), (unsigned)data_class); } - + /*------------------------------------------------------------------------- - * Function: display_string + * Function: print_string * * Purpose: Print a string value by escaping unusual characters. If * STREAM is null then we only count how large the output would @@ -181,57 +1322,56 @@ usage: %s [OPTIONS] [OBJECTS...]\n\ *------------------------------------------------------------------------- */ static int -display_string(FILE *stream, const char *s, hbool_t escape_spaces) +print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces) { int nprint=0; for (/*void*/; s && *s; s++) { switch (*s) { case '"': - if (stream) fprintf(stream, "\\\""); + h5tools_str_append(buffer, "\\\""); nprint += 2; break; case '\\': - if (stream) fprintf(stream, "\\\\"); + h5tools_str_append(buffer, "\\\\"); nprint += 2; break; case '\b': - if (stream) fprintf(stream, "\\b"); + h5tools_str_append(buffer, "\\b"); nprint += 2; break; case '\f': - if (stream) fprintf(stream, "\\f"); + h5tools_str_append(buffer, "\\f"); nprint += 2; break; case '\n': - if (stream) fprintf(stream, "\\n"); + h5tools_str_append(buffer, "\\n"); nprint += 2; break; case '\r': - if (stream) fprintf(stream, "\\r"); + h5tools_str_append(buffer, "\\r"); nprint += 2; break; case '\t': - if (stream) fprintf(stream, "\\t"); + h5tools_str_append(buffer, "\\t"); nprint += 2; break; case ' ': if (escape_spaces) { - if (stream) fprintf(stream, "\\ "); + h5tools_str_append(buffer, "\\ "); nprint += 2; - } else { - if (stream) fprintf(stream, " "); + } + else { + h5tools_str_append(buffer, " "); nprint++; } break; default: if (isprint((int)*s)) { - if (stream) putc(*s, stream); + h5tools_str_append(buffer, "%c", *s); nprint++; } else { - if (stream) { - fprintf(stream, "\\%03o", *((const unsigned char*)s)); - } + h5tools_str_append(buffer, "\\%03o", *((const unsigned char*)s)); nprint += 4; } break; @@ -242,7 +1382,7 @@ display_string(FILE *stream, const char *s, hbool_t escape_spaces) /*------------------------------------------------------------------------- - * Function: display_obj_name + * Function: print_obj_name * * Purpose: Print an object name and another string. * @@ -258,7 +1398,7 @@ display_string(FILE *stream, const char *s, hbool_t escape_spaces) *------------------------------------------------------------------------- */ static int -display_obj_name(FILE *stream, const iter_t *iter, const char *oname, +print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, const char *s) { static char fullname[NAME_BUF_SIZE]; /* Buffer for file and/or object name */ @@ -272,7 +1412,7 @@ display_obj_name(FILE *stream, const iter_t *iter, const char *oname, /* Print the object name, either full name or base name */ if(fullname_g) - n = display_string(stream, name, TRUE); + n = print_string(buffer, name, TRUE); else { const char *last_sep; /* The location of the last group separator */ @@ -282,16 +1422,16 @@ display_obj_name(FILE *stream, const iter_t *iter, const char *oname, else { last_sep++; } /* end else */ - n = display_string(stream, last_sep, TRUE); + n = print_string(buffer, last_sep, TRUE); } /* end else */ - printf("%*s ", MAX(0, (24 - n)), s); + h5tools_str_append(buffer, "%*s ", MAX(0, (24 - n)), s); return TRUE; } /*------------------------------------------------------------------------- - * Function: display_native_type + * Function: print_native_type * * Purpose: Prints the name of a native C data type. * @@ -310,100 +1450,100 @@ display_obj_name(FILE *stream, const iter_t *iter, const char *oname, *------------------------------------------------------------------------- */ static hbool_t -display_native_type(hid_t type, int UNUSED ind) +print_native_type(h5tools_str_t *buffer, hid_t type, int UNUSED ind) { if (H5Tequal(type, H5T_NATIVE_SCHAR)==TRUE) { - printf("native signed char"); + h5tools_str_append(buffer, "native signed char"); } else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) { - printf("native unsigned char"); + h5tools_str_append(buffer, "native unsigned char"); } else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) { - printf("native int"); + h5tools_str_append(buffer, "native int"); } else if (H5Tequal(type, H5T_NATIVE_UINT)==TRUE) { - printf("native unsigned int"); + h5tools_str_append(buffer, "native unsigned int"); } else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) { - printf("native short"); + h5tools_str_append(buffer, "native short"); } else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) { - printf("native unsigned short"); + h5tools_str_append(buffer, "native unsigned short"); } else if (H5Tequal(type, H5T_NATIVE_LONG)==TRUE) { - printf("native long"); + h5tools_str_append(buffer, "native long"); } else if (H5Tequal(type, H5T_NATIVE_ULONG)==TRUE) { - printf("native unsigned long"); + h5tools_str_append(buffer, "native unsigned long"); } else if (H5Tequal(type, H5T_NATIVE_LLONG)==TRUE) { - printf("native long long"); + h5tools_str_append(buffer, "native long long"); } else if (H5Tequal(type, H5T_NATIVE_ULLONG)==TRUE) { - printf("native unsigned long long"); + h5tools_str_append(buffer, "native unsigned long long"); } else if (H5Tequal(type, H5T_NATIVE_FLOAT)==TRUE) { - printf("native float"); + h5tools_str_append(buffer, "native float"); } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)==TRUE) { - printf("native double"); + h5tools_str_append(buffer, "native double"); #if H5_SIZEOF_LONG_DOUBLE !=0 } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)==TRUE) { - printf("native long double"); + h5tools_str_append(buffer, "native long double"); #endif } else if (H5Tequal(type, H5T_NATIVE_INT8)==TRUE) { - printf("native int8_t"); + h5tools_str_append(buffer, "native int8_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT8)==TRUE) { - printf("native uint8_t"); + h5tools_str_append(buffer, "native uint8_t"); } else if (H5Tequal(type, H5T_NATIVE_INT16)==TRUE) { - printf("native int16_t"); + h5tools_str_append(buffer, "native int16_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT16)==TRUE) { - printf("native uint16_t"); + h5tools_str_append(buffer, "native uint16_t"); } else if (H5Tequal(type, H5T_NATIVE_INT32)==TRUE) { - printf("native int32_t"); + h5tools_str_append(buffer, "native int32_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT32)==TRUE) { - printf("native uint32_t"); + h5tools_str_append(buffer, "native uint32_t"); } else if (H5Tequal(type, H5T_NATIVE_INT64)==TRUE) { - printf("native int64_t"); + h5tools_str_append(buffer, "native int64_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT64)==TRUE) { - printf("native uint64_t"); + h5tools_str_append(buffer, "native uint64_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST8)==TRUE) { - printf("native int_least8_t"); + h5tools_str_append(buffer, "native int_least8_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST8)==TRUE) { - printf("native uint_least8_t"); + h5tools_str_append(buffer, "native uint_least8_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST16)==TRUE) { - printf("native int_least16_t"); + h5tools_str_append(buffer, "native int_least16_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST16)==TRUE) { - printf("native uint_least16_t"); + h5tools_str_append(buffer, "native uint_least16_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST32)==TRUE) { - printf("native int_least32_t"); + h5tools_str_append(buffer, "native int_least32_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST32)==TRUE) { - printf("native uint_least32_t"); + h5tools_str_append(buffer, "native uint_least32_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST64)==TRUE) { - printf("native int_least64_t"); + h5tools_str_append(buffer, "native int_least64_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST64)==TRUE) { - printf("native uint_least64_t"); + h5tools_str_append(buffer, "native uint_least64_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_FAST8)==TRUE) { - printf("native int_fast8_t"); + h5tools_str_append(buffer, "native int_fast8_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST8)==TRUE) { - printf("native uint_fast8_t"); + h5tools_str_append(buffer, "native uint_fast8_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_FAST16)==TRUE) { - printf("native int_fast16_t"); + h5tools_str_append(buffer, "native int_fast16_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST16)==TRUE) { - printf("native uint_fast16_t"); + h5tools_str_append(buffer, "native uint_fast16_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_FAST32)==TRUE) { - printf("native int_fast32_t"); + h5tools_str_append(buffer, "native int_fast32_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST32)==TRUE) { - printf("native uint_fast32_t"); + h5tools_str_append(buffer, "native uint_fast32_t"); } else if (H5Tequal(type, H5T_NATIVE_INT_FAST64)==TRUE) { - printf("native int_fast64_t"); + h5tools_str_append(buffer, "native int_fast64_t"); } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST64)==TRUE) { - printf("native uint_fast64_t"); + h5tools_str_append(buffer, "native uint_fast64_t"); } else if (H5Tequal(type, H5T_NATIVE_B8)==TRUE) { - printf("native 8-bit field"); + h5tools_str_append(buffer, "native 8-bit field"); } else if (H5Tequal(type, H5T_NATIVE_B16)==TRUE) { - printf("native 16-bit field"); + h5tools_str_append(buffer, "native 16-bit field"); } else if (H5Tequal(type, H5T_NATIVE_B32)==TRUE) { - printf("native 32-bit field"); + h5tools_str_append(buffer, "native 32-bit field"); } else if (H5Tequal(type, H5T_NATIVE_B64)==TRUE) { - printf("native 64-bit field"); + h5tools_str_append(buffer, "native 64-bit field"); } else if (H5Tequal(type, H5T_NATIVE_HSIZE)==TRUE) { - printf("native hsize_t"); + h5tools_str_append(buffer, "native hsize_t"); } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)==TRUE) { - printf("native hssize_t"); + h5tools_str_append(buffer, "native hssize_t"); } else if (H5Tequal(type, H5T_NATIVE_HERR)==TRUE) { - printf("native herr_t"); + h5tools_str_append(buffer, "native herr_t"); } else if (H5Tequal(type, H5T_NATIVE_HBOOL)==TRUE) { - printf("native hbool_t"); + h5tools_str_append(buffer, "native hbool_t"); } else { return FALSE; } @@ -412,7 +1552,7 @@ display_native_type(hid_t type, int UNUSED ind) /*------------------------------------------------------------------------- - * Function: display_ieee_type + * Function: print_ieee_type * * Purpose: Print the name of an IEEE floating-point data type. * @@ -428,17 +1568,21 @@ display_native_type(hid_t type, int UNUSED ind) *------------------------------------------------------------------------- */ static hbool_t -display_ieee_type(hid_t type, int UNUSED ind) +print_ieee_type(h5tools_str_t *buffer, hid_t type, int UNUSED ind) { if (H5Tequal(type, H5T_IEEE_F32BE)==TRUE) { - printf("IEEE 32-bit big-endian float"); - } else if (H5Tequal(type, H5T_IEEE_F32LE)==TRUE) { - printf("IEEE 32-bit little-endian float"); - } else if (H5Tequal(type, H5T_IEEE_F64BE)==TRUE) { - printf("IEEE 64-bit big-endian float"); - } else if (H5Tequal(type, H5T_IEEE_F64LE)==TRUE) { - printf("IEEE 64-bit little-endian float"); - } else { + h5tools_str_append(buffer, "IEEE 32-bit big-endian float"); + } + else if (H5Tequal(type, H5T_IEEE_F32LE)==TRUE) { + h5tools_str_append(buffer, "IEEE 32-bit little-endian float"); + } + else if (H5Tequal(type, H5T_IEEE_F64BE)==TRUE) { + h5tools_str_append(buffer, "IEEE 64-bit big-endian float"); + } + else if (H5Tequal(type, H5T_IEEE_F64LE)==TRUE) { + h5tools_str_append(buffer, "IEEE 64-bit little-endian float"); + } + else { return FALSE; } return TRUE; @@ -446,7 +1590,7 @@ display_ieee_type(hid_t type, int UNUSED ind) /*------------------------------------------------------------------------- - * Function: display_precision + * Function: print_precision * * Purpose: Prints information on the next line about precision and * padding if the precision is less than the total data type @@ -462,7 +1606,7 @@ display_ieee_type(hid_t type, int UNUSED ind) *------------------------------------------------------------------------- */ static void -display_precision(hid_t type, int ind) +print_precision(h5tools_str_t *buffer, hid_t type, int ind) { size_t prec; /* precision */ H5T_pad_t plsb, pmsb; /* lsb and msb padding */ @@ -474,7 +1618,7 @@ display_precision(hid_t type, int ind) * and offset on the following line. Also display the padding * information. */ if (8*H5Tget_size(type)!=(prec=H5Tget_precision(type))) { - printf("\n%*s(%lu bit%s of precision beginning at bit %lu)", + h5tools_str_append(buffer, "\n%*s(%lu bit%s of precision beginning at bit %lu)", ind, "", (unsigned long)prec, 1==prec?"":"s", (unsigned long)H5Tget_offset(type)); @@ -520,27 +1664,27 @@ display_precision(hid_t type, int ind) } } if (plsb_s || pmsb_s) { - printf("\n%*s(", ind, ""); + h5tools_str_append(buffer, "\n%*s(", ind, ""); if (plsb_s) { nbits = H5Tget_offset(type); - printf("%lu %s bit%s at bit 0", + h5tools_str_append(buffer, "%lu %s bit%s at bit 0", (unsigned long)nbits, plsb_s, 1==nbits?"":"s"); } - if (plsb_s && pmsb_s) printf(", "); + if (plsb_s && pmsb_s) h5tools_str_append(buffer, ", "); if (pmsb_s) { nbits = 8*H5Tget_size(type)-(H5Tget_offset(type)+prec); - printf("%lu %s bit%s at bit %lu", + h5tools_str_append(buffer, "%lu %s bit%s at bit %lu", (unsigned long)nbits, pmsb_s, 1==nbits?"":"s", (unsigned long)(8*H5Tget_size(type)-nbits)); } - printf(")"); + h5tools_str_append(buffer, ")"); } } } /*------------------------------------------------------------------------- - * Function: display_int_type + * Function: print_int_type * * Purpose: Print the name of an integer data type. Common information * like number of bits, byte order, and sign scheme appear on @@ -559,7 +1703,7 @@ display_precision(hid_t type, int ind) *------------------------------------------------------------------------- */ static hbool_t -display_int_type(hid_t type, int ind) +print_int_type(h5tools_str_t *buffer, hid_t type, int ind) { H5T_order_t order; /* byte order value */ const char *order_s=NULL; /* byte order string */ @@ -573,14 +1717,18 @@ display_int_type(hid_t type, int ind) order = H5Tget_order(type); if (H5T_ORDER_LE==order) { order_s = " little-endian"; - } else if (H5T_ORDER_BE==order) { + } + else if (H5T_ORDER_BE==order) { order_s = " big-endian"; - } else if (H5T_ORDER_VAX==order) { + } + else if (H5T_ORDER_VAX==order) { order_s = " mixed-endian"; - } else { + } + else { order_s = " unknown-byte-order"; } - } else { + } + else { order_s = ""; } @@ -588,26 +1736,29 @@ display_int_type(hid_t type, int ind) if ((sign=H5Tget_sign(type))>=0) { if (H5T_SGN_NONE==sign) { sign_s = " unsigned"; - } else if (H5T_SGN_2==sign) { + } + else if (H5T_SGN_2==sign) { sign_s = ""; - } else { + } + else { sign_s = " unknown-sign"; } - } else { + } + else { sign_s = " unknown-sign"; } /* Print size, order, and sign on first line, precision and padding * information on the subsequent lines */ - printf("%lu-bit%s%s integer", + h5tools_str_append(buffer, "%lu-bit%s%s integer", (unsigned long)(8*H5Tget_size(type)), order_s, sign_s); - display_precision(type, ind); + print_precision(buffer, type, ind); return TRUE; } /*------------------------------------------------------------------------- - * Function: display_float_type + * Function: print_float_type * * Purpose: Print info about a floating point data type. * @@ -623,7 +1774,7 @@ display_int_type(hid_t type, int ind) *------------------------------------------------------------------------- */ static hbool_t -display_float_type(hid_t type, int ind) +print_float_type(h5tools_str_t *buffer, hid_t type, int ind) { H5T_order_t order; /* byte order value */ const char *order_s=NULL; /* byte order string */ @@ -643,22 +1794,26 @@ display_float_type(hid_t type, int ind) order = H5Tget_order(type); if (H5T_ORDER_LE==order) { order_s = " little-endian"; - } else if (H5T_ORDER_BE==order) { + } + else if (H5T_ORDER_BE==order) { order_s = " big-endian"; - } else if (H5T_ORDER_VAX==order) { + } + else if (H5T_ORDER_VAX==order) { order_s = " mixed-endian"; - } else { + } + else { order_s = " unknown-byte-order"; } - } else { + } + else { order_s = ""; } /* Print size and byte order on first line, precision and padding on * subsequent lines. */ - printf("%lu-bit%s floating-point", + h5tools_str_append(buffer, "%lu-bit%s floating-point", (unsigned long)(8*H5Tget_size(type)), order_s); - display_precision(type, ind); + print_precision(buffer, type, ind); /* Print sizes, locations, and other information about each field */ H5Tget_fields (type, &spos, &epos, &esize, &mpos, &msize); @@ -681,13 +1836,13 @@ display_float_type(hid_t type, int ind) ; break; } - printf("\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "", + h5tools_str_append(buffer, "\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "", (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos, norm_s); - printf("\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)", + h5tools_str_append(buffer, "\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)", ind, "", (unsigned long)esize, 1==esize?"":"s", (unsigned long)epos, (unsigned long)ebias); - printf("\n%*s(sign bit at %lu)", ind, "", (unsigned long)spos); + h5tools_str_append(buffer, "\n%*s(sign bit at %lu)", ind, "", (unsigned long)spos); /* Display internal padding */ if (1+esize+msize0); + HDassert(nmembs>0); super = H5Tget_super(type); - printf("enum "); - display_type(super, ind+4); - printf(" {"); + h5tools_str_append(buffer, "enum "); + print_type(buffer, super, ind+4); + h5tools_str_append(buffer, " {"); /* Determine what data type to use for the native values. To simplify * things we entertain three possibilities: @@ -822,8 +1977,8 @@ display_enum_type(hid_t type, int ind) } /* Get the names and raw values of all members */ - name = calloc(nmembs, sizeof(char*)); - value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size)); + name = HDcalloc(nmembs, sizeof(char*)); + value = (unsigned char *)HDcalloc(nmembs, MAX(H5Tget_size(type), dst_size)); for (i=0; i", ind+4, ""); - printf("\n%*s}", ind, ""); + if (0==nmembs) h5tools_str_append(buffer, "\n%*s ", ind+4, ""); + h5tools_str_append(buffer, "\n%*s}", ind, ""); return TRUE; } /*------------------------------------------------------------------------- - * Function: display_string_type + * Function: print_string_type * * Purpose: Print information about a string data type. * @@ -889,7 +2045,7 @@ display_enum_type(hid_t type, int ind) *------------------------------------------------------------------------- */ static hbool_t -display_string_type(hid_t type, int UNUSED ind) +print_string_type(h5tools_str_t *buffer, hid_t type, int UNUSED ind) { H5T_str_t pad; const char *pad_s=NULL; @@ -963,17 +2119,18 @@ display_string_type(hid_t type, int UNUSED ind) } if (H5Tis_variable_str(type)) { - printf("variable-length"); - } else { - printf("%lu-byte", (unsigned long)H5Tget_size(type)); + h5tools_str_append(buffer, "variable-length"); + } + else { + h5tools_str_append(buffer, "%lu-byte", (unsigned long)H5Tget_size(type)); } - printf(" %s %s string", pad_s, cset_s); + h5tools_str_append(buffer, " %s %s string", pad_s, cset_s); return TRUE; } /*------------------------------------------------------------------------- - * Function: display_reference_type + * Function: print_reference_type * * Purpose: Prints information about a reference data type. * @@ -991,16 +2148,18 @@ display_string_type(hid_t type, int UNUSED ind) *------------------------------------------------------------------------- */ static hbool_t -display_reference_type(hid_t type, int UNUSED ind) +print_reference_type(h5tools_str_t *buffer, hid_t type, int UNUSED ind) { if (H5T_REFERENCE!=H5Tget_class(type)) return FALSE; if (H5Tequal(type, H5T_STD_REF_OBJ)==TRUE) { - printf("object reference"); - } else if (H5Tequal(type, H5T_STD_REF_DSETREG)==TRUE) { - printf("dataset region reference"); - } else { - printf("%lu-byte unknown reference", + h5tools_str_append(buffer, "object reference"); + } + else if (H5Tequal(type, H5T_STD_REF_DSETREG)==TRUE) { + h5tools_str_append(buffer, "dataset region reference"); + } + else { + h5tools_str_append(buffer, "%lu-byte unknown reference", (unsigned long)H5Tget_size(type)); } @@ -1009,7 +2168,7 @@ display_reference_type(hid_t type, int UNUSED ind) /*------------------------------------------------------------------------- - * Function: display_opaque_type + * Function: print_opaque_type * * Purpose: Prints information about an opaque data type. * @@ -1025,7 +2184,7 @@ display_reference_type(hid_t type, int UNUSED ind) *------------------------------------------------------------------------- */ static hbool_t -display_opaque_type(hid_t type, int ind) +print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind) { char *tag; size_t size; @@ -1033,19 +2192,19 @@ display_opaque_type(hid_t type, int ind) if (H5T_OPAQUE!=H5Tget_class(type)) return FALSE; size = H5Tget_size(type); - printf("%lu-byte opaque type", (unsigned long)size); + h5tools_str_append(buffer, "%lu-byte opaque type", (unsigned long)size); if ((tag=H5Tget_tag(type))) { - printf("\n%*s(tag = \"", ind, ""); - display_string(stdout, tag, FALSE); - printf("\")"); - free(tag); + h5tools_str_append(buffer, "\n%*s(tag = \"", ind, ""); + print_string(buffer, tag, FALSE); + h5tools_str_append(buffer, "\")"); + HDfree(tag); } return TRUE; } /*------------------------------------------------------------------------- - * Function: display_vlen_type + * Function: print_vlen_type * * Purpose: Print information about a variable-length type * @@ -1060,15 +2219,15 @@ display_opaque_type(hid_t type, int ind) *------------------------------------------------------------------------- */ static hbool_t -display_vlen_type(hid_t type, int ind) +print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind) { hid_t super; if (H5T_VLEN!=H5Tget_class(type)) return FALSE; - printf("variable length of\n%*s", ind+4, ""); + h5tools_str_append(buffer, "variable length of\n%*s", ind+4, ""); super = H5Tget_super(type); - display_type(super, ind+4); + print_type(buffer, super, ind+4); H5Tclose(super); return TRUE; } @@ -1088,7 +2247,7 @@ display_vlen_type(hid_t type, int ind) *--------------------------------------------------------------------------- */ static hbool_t -display_array_type(hid_t type, int ind) +print_array_type(h5tools_str_t *buffer, hid_t type, int ind) { hid_t super; int ndims, i; @@ -1097,31 +2256,32 @@ display_array_type(hid_t type, int ind) if (H5T_ARRAY!=H5Tget_class(type)) return FALSE; ndims = H5Tget_array_ndims(type); if (ndims) { - dims = (hsize_t *)malloc(ndims*sizeof(dims[0])); + dims = (hsize_t *)HDmalloc(ndims*sizeof(dims[0])); H5Tget_array_dims2(type, dims); /* Print dimensions */ for (i=0; i"); + h5tools_str_append(buffer,""); return; } @@ -1203,29 +2363,29 @@ display_type(hid_t type, int ind) H5O_info_t oi; if(H5Oget_info(type, &oi) >= 0) - printf("shared-%lu:"H5_PRINTF_HADDR_FMT" ", + h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr); else - printf("shared "); + h5tools_str_append(buffer,"shared "); } /* end if */ /* Print the type */ - if((!simple_output_g && display_native_type(type, ind)) || - display_ieee_type(type, ind) || - display_int_type(type, ind) || - display_float_type(type, ind) || - display_cmpd_type(type, ind) || - display_enum_type(type, ind) || - display_string_type(type, ind) || - display_reference_type(type, ind) || - display_vlen_type(type, ind) || - display_array_type(type, ind) || - display_opaque_type(type, ind) || - display_bitfield_type(type, ind)) + if((!simple_output_g && print_native_type(buffer, type, ind)) || + print_ieee_type(buffer, type, ind) || + print_int_type(buffer, type, ind) || + print_float_type(buffer, type, ind) || + print_cmpd_type(buffer, type, ind) || + print_enum_type(buffer, type, ind) || + print_string_type(buffer, type, ind) || + print_reference_type(buffer, type, ind) || + print_vlen_type(buffer, type, ind) || + print_array_type(buffer, type, ind) || + print_opaque_type(buffer, type, ind) || + print_bitfield_type(buffer, type, ind)) return; /* Unknown type */ - printf("%lu-byte class-%u unknown", + h5tools_str_append(buffer,"%lu-byte class-%u unknown", (unsigned long)H5Tget_size(type), (unsigned)data_class); } @@ -1249,98 +2409,115 @@ display_type(hid_t type, int ind) static void dump_dataset_values(hid_t dset) { + char string_prefix[64]; + static char fmt_double[16]; + static char fmt_float[16]; + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t outputformat; + h5tool_format_t *info = &ls_dataformat; + hid_t f_type = H5Dget_type(dset); size_t size = H5Tget_size(f_type); - h5tool_format_t info; - char string_prefix[64]; - static char fmt_double[16], fmt_float[16]; - /* Set to all default values and then override */ - memset(&info, 0, sizeof info); + HDmemset(&ctx, 0, sizeof(ctx)); + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + outputformat = *info; + outputformat.line_1st = NULL; if (simple_output_g) { - info.idx_fmt = ""; - info.line_ncols = 65535; /*something big*/ - info.line_per_line = 1; - info.line_multi_new = 0; - info.line_pre = " "; - info.line_cont = " "; - - info.arr_pre = ""; - info.arr_suf = ""; - info.arr_sep = " "; - - if (label_g) - { - info.cmpd_pre = "{"; - info.cmpd_suf = "}"; - } - else - { - info.cmpd_pre = ""; - info.cmpd_suf = ""; + outputformat.idx_fmt = ""; + outputformat.line_per_line = 1; + outputformat.line_multi_new = 0; + outputformat.line_pre = " "; + outputformat.line_cont = " "; + + outputformat.arr_pre = ""; + outputformat.arr_suf = ""; + outputformat.arr_sep = " "; + + if (!label_g) { + outputformat.cmpd_pre = ""; + outputformat.cmpd_suf = ""; } - info.cmpd_sep = " "; + outputformat.cmpd_sep = " "; - if (label_g) info.cmpd_name = "%s="; + if (label_g) outputformat.cmpd_name = "%s="; - info.elmt_suf1 = " "; - info.str_locale = ESCAPE_HTML; + outputformat.elmt_suf1 = " "; + outputformat.str_locale = ESCAPE_HTML; - } else { - info.idx_fmt = "(%s)"; + } + else { if (no_line_wrap_g) { - info.line_ncols = 65535; - info.line_per_line = 1; + outputformat.line_per_line = 1; } - else - info.line_ncols = width_g; - info.line_multi_new = 1; - if (label_g) info.cmpd_name = "%s="; - info.line_pre = " %s "; - info.line_cont = " %s "; - info.str_repeat = 8; + else { + outputformat.line_ncols = width_g; + } + if (label_g) outputformat.cmpd_name = "%s="; + outputformat.line_pre = " %s "; + outputformat.line_cont = " %s "; + outputformat.str_repeat = 8; + + outputformat.arr_pre = NULL; + outputformat.arr_suf = NULL; + outputformat.arr_sep = NULL; + + outputformat.cmpd_pre = NULL; + outputformat.cmpd_suf = NULL; + outputformat.cmpd_sep = NULL; + + outputformat.vlen_sep = NULL; + outputformat.vlen_pre = NULL; + outputformat.vlen_suf = NULL; + outputformat.vlen_end = NULL; } - + outputformat.arr_linebreak = 0; /* Floating point types should display full precision */ sprintf(fmt_float, "%%1.%dg", FLT_DIG); - info.fmt_float = fmt_float; + outputformat.fmt_float = fmt_float; sprintf(fmt_double, "%%1.%dg", DBL_DIG); - info.fmt_double = fmt_double; - - info.dset_format = "DSET-%s "; - info.dset_hidefileno = 0; - - info.obj_format = "-%lu:"H5_PRINTF_HADDR_FMT; - info.obj_hidefileno = 0; - - info.dset_blockformat_pre = "%sBlk%lu: "; - info.dset_ptformat_pre = "%sPt%lu: "; - - info.line_indent = ""; + outputformat.fmt_double = fmt_double; if (hexdump_g) { /* Print all data in hexadecimal format if the `-x' or `--hexdump' * command line switch was given. */ - info.raw = TRUE; - } else if (string_g && 1==size && H5T_INTEGER==H5Tget_class(f_type)) { + outputformat.raw = TRUE; + } + else if (string_g && 1==size && H5T_INTEGER==H5Tget_class(f_type)) { /* Print 1-byte integer data as an ASCI character string instead of * integers if the `-s' or `--string' command-line option was given. */ - info.ascii = TRUE; - info.elmt_suf1 = ""; - info.elmt_suf2 = ""; - strcpy(string_prefix, info.line_pre); + outputformat.ascii = TRUE; + outputformat.elmt_suf1 = ""; + outputformat.elmt_suf2 = ""; + strcpy(string_prefix, outputformat.line_pre); strcat(string_prefix, "\""); - info.line_pre = string_prefix; - info.line_suf = "\""; + outputformat.line_pre = string_prefix; + outputformat.line_suf = "\""; } + info = &outputformat; + ctx.indent_level = 2; + ctx.cur_column = curr_pos; /* Print all the values. */ - printf(" Data:\n"); - if (h5tools_dump_dset(stdout, &info, dset, -1, NULL, -1) < 0) - printf(" Unable to print data.\n"); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " Data:\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + ctx.need_prefix = TRUE; + ctx.cur_column = curr_pos; + if (h5tools_dump_dset(rawoutstream, info, &ctx, dset, -1, NULL) < 0) { + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " Unable to print data."); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + } H5Tclose(f_type); + + HDfprintf(rawoutstream, "\n"); + + h5tools_str_close(&buffer); } @@ -1364,18 +2541,32 @@ static herr_t list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, void UNUSED *op_data) { - hid_t attr, space, type, p_type; - hsize_t size[H5S_MAX_RANK], nelmts = 1; - int ndims, i, n; - size_t need; - hsize_t temp_need; - void *buf; - h5tool_format_t info; - H5S_class_t space_type; - - printf(" Attribute: "); - n = display_string(stdout, attr_name, TRUE); - printf("%*s", MAX(0, (9 - n)), ""); + hid_t attr = -1; + hid_t space = -1; + hid_t type = -1; + hid_t p_type = -1; + hsize_t size[H5S_MAX_RANK]; + hsize_t nelmts = 1; + hsize_t temp_need; + size_t need; + int ndims; + int i; + int n; + void *buf; + H5S_class_t space_type; + hsize_t curr_pos = 0; /* total data element position */ + h5tools_str_t buffer; /* string into which to render */ + h5tools_context_t ctx; /* print context */ + h5tool_format_t *info = &ls_dataformat; + h5tool_format_t outputformat; + + HDmemset(&ctx, 0, sizeof(ctx)); + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " Attribute: "); + + n = print_string(&buffer, attr_name, TRUE); if((attr = H5Aopen(obj, attr_name, H5P_DEFAULT))) { space = H5Aget_space(attr); @@ -1387,74 +2578,89 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, switch(space_type) { case H5S_SCALAR: /* scalar dataspace */ - puts(" scalar"); + h5tools_str_append(&buffer, " scalar\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); break; case H5S_SIMPLE: /* simple dataspace */ - printf(" {"); + h5tools_str_append(&buffer, " {"); for (i=0; iline_ncols, 0, 0); break; case H5S_NULL: /* null dataspace */ - puts(" null"); + h5tools_str_append(&buffer, " null\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); break; default: /* Unknown dataspace type */ - puts(" unknown"); + h5tools_str_append(&buffer, " unknown\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); break; } /* end switch */ /* Data type */ - printf(" Type: "); - display_type(type, 15); - putchar('\n'); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " Type: "); + print_type(&buffer, type, 15); + h5tools_str_append(&buffer, "\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); /* Data */ - memset(&info, 0, sizeof info); - info.line_multi_new = 1; + outputformat = *info; + if(nelmts < 5) { - info.idx_fmt = ""; - info.line_1st = " Data: "; - info.line_pre = " "; - info.line_cont = " "; - info.str_repeat = 8; + outputformat.idx_fmt = ""; + outputformat.line_1st = " Data: "; + outputformat.line_pre = " "; + outputformat.line_cont = " "; + outputformat.str_repeat = 8; - } else { - printf(" Data:\n"); - info.idx_fmt = "(%s)"; - info.line_pre = " %s "; - info.line_cont = " %s "; - info.str_repeat = 8; + } + else { + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " Data:\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + outputformat.line_1st = NULL; + outputformat.line_pre = " %s "; + outputformat.line_cont = " %s "; + outputformat.str_repeat = 8; } - info.line_ncols = width_g; + outputformat.line_ncols = width_g; if(label_g) - info.cmpd_name = "%s="; + outputformat.cmpd_name = "%s="; if(string_g && 1==H5Tget_size(type) && H5T_INTEGER==H5Tget_class(type)) { - info.ascii = TRUE; - info.elmt_suf1 = ""; - info.elmt_suf2 = ""; - info.idx_fmt = "(%s)"; - info.line_pre = " %s \""; - info.line_suf = "\""; + outputformat.ascii = TRUE; + outputformat.elmt_suf1 = ""; + outputformat.elmt_suf2 = ""; + outputformat.line_pre = " %s \""; + outputformat.line_suf = "\""; } /* end if */ - /* values of reference type formats */ - info.dset_format = "DSET-%s "; - info.dset_hidefileno = 1; - info.dset_blockformat_pre = "%sBlk%lu: "; - info.dset_ptformat_pre = "%sPt%lu: "; - info.obj_format = "-%lu:"H5_PRINTF_HADDR_FMT; - info.obj_hidefileno = 0; + outputformat.arr_pre = NULL; + outputformat.arr_suf = NULL; + outputformat.arr_sep = NULL; + + outputformat.cmpd_pre = NULL; + outputformat.cmpd_suf = NULL; + outputformat.cmpd_sep = NULL; + + outputformat.vlen_sep = NULL; + outputformat.vlen_pre = NULL; + outputformat.vlen_suf = NULL; + outputformat.vlen_end = NULL; + + info = &outputformat; if(hexdump_g) p_type = H5Tcopy(type); @@ -1470,26 +2676,35 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, vl_data = TRUE; temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); - assert(temp_need == (hsize_t)((size_t)temp_need)); + HDassert(temp_need == (hsize_t)((size_t)temp_need)); need = (size_t)temp_need; - buf = malloc(need); - assert(buf); - if(H5Aread(attr, p_type, buf) >= 0) - h5tools_dump_mem(stdout, &info, attr, p_type, space, buf, -1); + buf = HDmalloc(need); + HDassert(buf); + if(H5Aread(attr, p_type, buf) >= 0) { + ctx.need_prefix = TRUE; + ctx.indent_level = 2; + ctx.cur_column = curr_pos; + h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf); + } /* Reclaim any VL memory, if necessary */ if (vl_data) H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); - free(buf); + HDfree(buf); H5Tclose(p_type); } /* end if */ + HDfprintf(rawoutstream, "\n"); H5Sclose(space); H5Tclose(type); H5Aclose(attr); - } else - putchar('\n'); + } + else { + HDfprintf(rawoutstream, "\n"); + } + + h5tools_str_close(&buffer); return 0; } @@ -1531,16 +2746,16 @@ dataset_list1(hid_t dset) ndims = H5Sget_simple_extent_dims(space, cur_size, max_size); printf (" {"); for (i=0; i0) { - HDfprintf(stdout, "/%Hu", max_size[i]); + HDfprintf(rawoutstream, "/%Hu", max_size[i]); } } - if (space_type==H5S_SCALAR) printf("SCALAR"); - else if (space_type==H5S_NULL) printf("NULL"); - putchar('}'); + if (space_type==H5S_SCALAR) HDfprintf(rawoutstream, "SCALAR"); + else if (space_type==H5S_NULL) HDfprintf(rawoutstream, "NULL"); + HDfputc('}', rawoutstream); H5Sclose (space); return 0; @@ -1597,48 +2812,46 @@ dataset_list2(hid_t dset, const char UNUSED *name) hsize_t chsize[64]; /* chunk size in elements */ ndims = H5Pget_chunk(dcpl, NELMTS(chsize), chsize/*out*/); - printf(" %-10s {", "Chunks:"); + HDfprintf(rawoutstream, " %-10s {", "Chunks:"); total = H5Tget_size(type); for (i=0; i0) { utilization = (total*100.0)/used; - printf(", %1.2f%% utilization", utilization); + HDfprintf(rawoutstream, ", %1.2f%% utilization", utilization); } - } - - putchar('\n'); + HDfputc('\n', rawoutstream); /* Print information about external strorage */ if((nf = H5Pget_external_count(dcpl)) > 0) { @@ -1647,37 +2860,37 @@ dataset_list2(hid_t dset, const char UNUSED *name) n = display_string(NULL, f_name, TRUE); max_len = MAX(max_len, n); } /* end for */ - printf(" %-10s %d external file%s\n", + HDfprintf(rawoutstream, " %-10s %d external file%s\n", "Extern:", nf, 1==nf?"":"s"); - printf(" %4s %10s %10s %10s %s\n", + HDfprintf(rawoutstream, " %4s %10s %10s %10s %s\n", "ID", "DSet-Addr", "File-Addr", "Bytes", "File"); - printf(" %4s %10s %10s %10s ", + HDfprintf(rawoutstream, " %4s %10s %10s %10s ", "----", "----------", "----------", "----------"); - for (i=0; i0) { - printf(" %-10s ", "Type:"); + HDfprintf(rawoutstream, " %-10s ", "Type:"); display_type(type, 15); - printf("\n"); + HDfprintf(rawoutstream, "\n"); } return 0; } @@ -1771,24 +2984,24 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void /* Print the link's name, either full name or base name */ if(!iter->symlink_target) - display_obj_name(stdout, iter, name, ""); + display_obj_name(rawoutstream, iter, name, ""); /* Check object information */ if(oinfo->type < 0 || oinfo->type >= H5O_TYPE_NTYPES) { - printf("Unknown type(%d)", (int)oinfo->type); + HDfprintf(rawoutstream, "Unknown type(%d)", (int)oinfo->type); obj_type = H5O_TYPE_UNKNOWN; } if(iter->symlink_target) - fputc('{', stdout); + HDfputc('{', rawoutstream); if(obj_type >= 0 && dispatch_g[obj_type].name) - fputs(dispatch_g[obj_type].name, stdout); + HDfputs(dispatch_g[obj_type].name, rawoutstream); /* Check if we've seen this object before */ if(first_seen) { - printf(", same as "); - display_string(stdout, first_seen, TRUE); + HDfprintf(rawoutstream, ", same as "); + display_string(rawoutstream, first_seen, TRUE); if(!iter->symlink_target) - printf("\n"); + HDfprintf(rawoutstream, "\n"); } /* end if */ else { hid_t obj = (-1); /* ID of object opened */ @@ -1797,7 +3010,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void * then return right away. */ if(obj_type >= 0 && (obj = H5Oopen(iter->fid, name, H5P_DEFAULT)) < 0) { - printf(" *ERROR*\n"); + HDfprintf(rawoutstream, " *ERROR*\n"); goto done; } /* end if */ @@ -1805,7 +3018,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void if(obj_type >= 0 && dispatch_g[obj_type].list1) (dispatch_g[obj_type].list1)(obj); if(!iter->symlink_target || (verbose_g > 0)) - putchar('\n'); + HDfputc('\n', rawoutstream); /* Show detailed information about the object, beginning with information * which is common to all objects. */ @@ -1819,8 +3032,8 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void H5Aiterate2(obj, H5_INDEX_NAME, H5_ITER_INC, NULL, list_attr, NULL); /* Object location & reference count */ - printf(" %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", oinfo->fileno, oinfo->addr); - printf(" %-10s %u\n", "Links:", (unsigned)oinfo->rc); + HDfprintf(rawoutstream, " %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", oinfo->fileno, oinfo->addr); + HDfprintf(rawoutstream, " %-10s %u\n", "Links:", (unsigned)oinfo->rc); /* Modification time */ if(oinfo->mtime > 0) { @@ -1833,7 +3046,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void tm = HDlocaltime(&(oinfo->mtime)); if(tm) { HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); - printf(" %-10s %s\n", "Modified:", buf); + HDfprintf(rawoutstream, " %-10s %s\n", "Modified:", buf); } /* end if */ } /* end if */ @@ -1849,9 +3062,9 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void cmt_bufsize = H5Oget_comment(obj, comment, cmt_bufsize); if(cmt_bufsize > 0) { comment[cmt_bufsize] = 0; - printf(" %-10s \"", "Comment:"); - display_string(stdout, comment, FALSE); - puts("\""); + HDfprintf(rawoutstream, " %-10s \"", "Comment:"); + display_string(rawoutstream, comment, FALSE); + HDfputs("\"\n", rawoutstream); } /* end if */ HDfree(comment); } @@ -1869,7 +3082,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void done: if(iter->symlink_target) { - fputs("}\n", stdout); + HDfputs("}\n", rawoutstream); iter->symlink_target = FALSE; } return 0; @@ -1900,21 +3113,21 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) h5tool_link_info_t lnk_info; /* init linkinfo struct */ - memset(&lnk_info, 0, sizeof(h5tool_link_info_t)); + HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t)); /* if verbose, make H5tools_get_symlink_info() display more */ if (verbose_g) lnk_info.opt.msg_mode=1; /* Print the link's name, either full name or base name */ - display_obj_name(stdout, iter, name, ""); + display_obj_name(rawoutstream, iter, name, ""); switch(linfo->type) { case H5L_TYPE_SOFT: ret = H5tools_get_symlink_info(iter->fid, name, &lnk_info, follow_symlink_g); /* lnk_info.trg_path is malloced in H5tools_get_symlink_info() * so it will be freed via buf later */ - buf = lnk_info.trg_path; + buf = (char*)lnk_info.trg_path; /* error */ if (ret < 0) goto done; @@ -1922,18 +3135,18 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) else if (no_dangling_link_g && ret == 0) iter->symlink_list->dangle_link = TRUE; - HDfputs("Soft Link {", stdout); - HDfputs(buf, stdout); - HDfputc('}', stdout); + HDfputs("Soft Link {", rawoutstream); + HDfputs(buf, rawoutstream); + HDfputc('}', rawoutstream); if(follow_symlink_g) { hbool_t orig_grp_literal = grp_literal_g; - HDfputc(' ', stdout); + HDfputc(' ', rawoutstream); /* Check if we have already seen this softlink */ if(symlink_is_visited(iter->symlink_list, linfo->type, NULL, buf)) { - HDfputs("{Already Visited}\n", stdout); + HDfputs("{Already Visited}\n", rawoutstream); goto done; } @@ -1959,7 +3172,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) grp_literal_g = orig_grp_literal; } else - HDfputc('\n', stdout); + HDfputc('\n', rawoutstream); break; @@ -1972,7 +3185,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) ret = H5tools_get_symlink_info(iter->fid, name, &lnk_info, follow_link); /* lnk_info.trg_path is malloced in H5tools_get_symlink_info() * so it will be freed via buf later */ - buf = lnk_info.trg_path; + buf = (char*)lnk_info.trg_path; /* error */ if (ret < 0) goto done; @@ -1983,25 +3196,25 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) if(H5Lunpack_elink_val(buf, linfo->u.val_size, NULL, &filename, &path) < 0) goto done; - HDfputs("External Link {", stdout); - HDfputs(filename, stdout); - HDfputc('/', stdout); + HDfputs("External Link {", rawoutstream); + HDfputs(filename, rawoutstream); + HDfputc('/', rawoutstream); if(*path != '/') - HDfputc('/', stdout); - HDfputs(path, stdout); - HDfputc('}', stdout); + HDfputc('/', rawoutstream); + HDfputs(path, rawoutstream); + HDfputc('}', rawoutstream); /* Recurse through the external link */ /* keep the follow_elink_g for backward compatibility with -E */ if(follow_link) { hbool_t orig_grp_literal = grp_literal_g; - HDfputc(' ', stdout); + HDfputc(' ', rawoutstream); /* Check if we have already seen this elink */ if(symlink_is_visited(iter->symlink_list, linfo->type, filename, path)) { - HDfputs("{Already Visited}\n", stdout); + HDfputs("{Already Visited}\n", rawoutstream); goto done; } @@ -2029,13 +3242,13 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) grp_literal_g = orig_grp_literal; } else - HDfputc('\n', stdout); + HDfputc('\n', rawoutstream); } break; default: - HDfputs("UD Link {cannot follow UD links}\n", stdout); + HDfputs("UD Link {cannot follow UD links}\n", rawoutstream); break; } /* end switch */ @@ -2069,11 +3282,11 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) /* Retrieve info for object to list */ if(H5Oget_info_by_name(file, oname, &oi, H5P_DEFAULT) < 0) { if(iter->symlink_target) { - HDfputs("{**NOT FOUND**}\n", stdout); + HDfputs("{**NOT FOUND**}\n", rawoutstream); iter->symlink_target = FALSE; } else - display_obj_name(stdout, iter, oname, "**NOT FOUND**"); + display_obj_name(rawoutstream, iter, oname, "**NOT FOUND**"); return -1; } /* end if */ @@ -2081,7 +3294,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) if(H5O_TYPE_GROUP == oi.type && !grp_literal_g) { /* Get ID for group */ if(!iter->symlink_target && (iter->gid = H5Gopen2(file, oname, H5P_DEFAULT)) < 0) { - fprintf(stderr, "%s: unable to open '%s' as group\n", iter->fname, oname); + HDfprintf(rawerrorstream, "%s: unable to open '%s' as group\n", iter->fname, oname); return 0; /* Previously "continue", when this code was in main(). * We don't "continue" here in order to close the file * and free the file name properly. */ @@ -2137,8 +3350,8 @@ get_width(void) /* Try to get it from the COLUMNS environment variable first since it's * value is sometimes wrong. */ - if ((s=getenv("COLUMNS")) && *s && isdigit((int)*s)) - width = (int)strtol(s, NULL, 0); + if ((s=HDgetenv("COLUMNS")) && *s && isdigit((int)*s)) + width = (int)HDstrtol(s, NULL, 0); #if defined(H5_HAVE_STRUCT_VIDEOCONFIG) && defined(H5_HAVE__GETVIDEOCONFIG) { @@ -2209,14 +3422,14 @@ is_valid_args(void) if(recursive_g && grp_literal_g) { - fprintf(stderr, "Error: 'recursive' option not compatible with 'group info' option!\n\n"); + HDfprintf(rawerrorstream, "Error: 'recursive' option not compatible with 'group info' option!\n\n"); ret = FALSE; goto out; } if(no_dangling_link_g && !follow_symlink_g) { - fprintf(stderr, "Error: --no-dangling-links must be used along with --follow-symlinks option!\n\n"); + HDfprintf(rawerrorstream, "Error: --no-dangling-links must be used along with --follow-symlinks option!\n\n"); ret = FALSE; goto out; } @@ -2245,7 +3458,7 @@ leave(int ret) { h5tools_close(); - exit(ret); + HDexit(ret); } @@ -2497,7 +3710,7 @@ main(int argc, const char *argv[]) if(file >= 0) { if(verbose_g) - printf("Opened \"%s\" with %s driver.\n", fname, drivername); + HDfprintf(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername); break; /*success*/ } /* end if */ @@ -2512,7 +3725,7 @@ main(int argc, const char *argv[]) } /* end while */ if(file < 0) { - fprintf(stderr, "%s: unable to open file\n", argv[argno-1]); + HDfprintf(rawerrorstream, "%s: unable to open file\n", argv[argno-1]); HDfree(fname); err_exit = 1; continue; @@ -2525,7 +3738,7 @@ main(int argc, const char *argv[]) iter.base_len -= oname[iter.base_len-1] == '/'; x = oname; if(NULL == (oname = HDstrdup(oname))) { - fprintf(stderr, "memory allocation failed\n"); + HDfprintf(rawerrorstream, "memory allocation failed\n"); leave(EXIT_FAILURE); } *x = '\0'; @@ -2559,7 +3772,7 @@ main(int argc, const char *argv[]) if(HDstrcmp(oname, root_name)) { /* Check the type of link given */ if(H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) { - display_obj_name(stdout, &iter, oname, "**NOT FOUND**"); + display_obj_name(rawoutstream, &iter, oname, "**NOT FOUND**"); leave(EXIT_FAILURE); } /* end if */ } /* end if */ diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index a475a43..201c711 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -90,7 +90,7 @@ int h5repack_init (pack_opt_t *options, int verbose) { int k, n; - memset(options,0,sizeof(pack_opt_t)); + HDmemset(options,0,sizeof(pack_opt_t)); options->min_comp = 1024; options->verbose = verbose; @@ -154,7 +154,7 @@ int h5repack_addfilter(const char* str, if(options->n_filter_g > H5_REPACK_MAX_NFILTERS) { error_msg("maximum number of filters exceeded for <%s>\n", str); - free(obj_list); + HDfree(obj_list); return -1; } @@ -163,7 +163,7 @@ int h5repack_addfilter(const char* str, else options_add_filter(obj_list, n_objs, filter, options->op_tbl); - free(obj_list); + HDfree(obj_list); return 0; } @@ -229,7 +229,7 @@ int h5repack_addlayout(const char* str, &pack, options->op_tbl); - free(obj_list); + HDfree(obj_list); return 0; } @@ -627,20 +627,20 @@ static int check_options(pack_opt_t *options) switch (options->layout_g) { case H5D_COMPACT: - HDstrcpy(slayout,"compact"); + strcpy(slayout,"compact"); break; case H5D_CONTIGUOUS: - HDstrcpy(slayout,"contiguous"); + strcpy(slayout,"contiguous"); break; case H5D_CHUNKED: - HDstrcpy(slayout,"chunked"); + strcpy(slayout,"chunked"); break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: error_msg("invalid layout\n"); return -1; default: - HDstrcpy(slayout,"invalid layout\n"); + strcpy(slayout,"invalid layout\n"); return -1; } printf(" Apply %s layout to all\n", slayout); @@ -999,7 +999,7 @@ static const char* get_sfilter(H5Z_filter_t filtn) return "SOFF"; else { error_msg("input error in filter type\n"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 9a09b9e..62cdd6b 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -574,7 +574,7 @@ int do_copy_objects(hid_t fidin, { case H5TRAV_TYPE_UNKNOWN: - assert(0); + HDassert(0); break; /*------------------------------------------------------------------------- * H5TRAV_TYPE_GROUP @@ -877,7 +877,7 @@ int do_copy_objects(hid_t fidin, size = 1; sm_size[k - 1] = MIN(dims[k - 1], size); sm_nbytes *= sm_size[k - 1]; - assert(sm_nbytes > 0); + HDassert(sm_nbytes > 0); } sm_buf = HDmalloc((size_t)sm_nbytes); @@ -885,8 +885,8 @@ int do_copy_objects(hid_t fidin, sm_space = H5Screate_simple(1, &sm_nelmts, NULL); /* the stripmine loop */ - memset(hs_offset, 0, sizeof hs_offset); - memset(zero, 0, sizeof zero); + HDmemset(hs_offset, 0, sizeof hs_offset); + HDmemset(zero, 0, sizeof zero); for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { @@ -1301,7 +1301,7 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size) int status = 0; /* Return value */ /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */ - assert(size > 0); + HDassert(size > 0); /* Open files */ if((infid = HDopen(infile, O_RDONLY, 0)) < 0) { @@ -1343,13 +1343,13 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size) status = -1; goto done; } /* end if */ - assert(nwritten > 0); - assert(nwritten <= nbytes); + HDassert(nwritten > 0); + HDassert(nwritten <= nbytes); /* Update # of bytes left & offset in buffer */ nbytes -= nwritten; wbuf += nwritten; - assert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE)); + HDassert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE)); } /* end while */ /* Update size of userblock left to transfer */ diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 213ff65..7edeed2 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -15,6 +15,7 @@ #include "h5repack.h" #include "h5tools.h" +#include "h5tools_utils.h" /* number of members in an array */ #ifndef NELMTS @@ -329,7 +330,7 @@ int apply_filters(const char* name, /* object name from traverse list */ size = 1; sm_size[i - 1] = MIN(dims[i - 1], size); sm_nbytes *= sm_size[i - 1]; - assert(sm_nbytes > 0); + HDassert(sm_nbytes > 0); } diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 2e73721..06a4aa7 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -13,6 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include "h5tools.h" #include "h5tools_utils.h" #include "h5repack.h" @@ -104,6 +105,9 @@ int main(int argc, const char **argv) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); + /* Initialize h5tools lib */ + h5tools_init(); + /* initialize options */ h5repack_init(&options,0); @@ -122,7 +126,7 @@ int main(int argc, const char **argv) { error_msg("file names cannot be the same\n"); usage(h5tools_getprogname()); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } @@ -131,7 +135,7 @@ int main(int argc, const char **argv) { error_msg("file names missing\n"); usage(h5tools_getprogname()); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } @@ -304,10 +308,10 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) case 'h': usage(h5tools_getprogname()); - exit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); case 'V': print_version(h5tools_getprogname()); - exit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); case 'v': options->verbose = 1; break; @@ -317,7 +321,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) if (h5repack_addfilter( opt_arg, options)<0) { error_msg("in parsing filter\n"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } break; case 'l': @@ -326,7 +330,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) if (h5repack_addlayout( opt_arg, options)<0) { error_msg("in parsing layout\n"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } break; @@ -337,7 +341,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) if ((int)options->min_comp<=0) { error_msg("invalid minimum compress size <%s>\n", opt_arg ); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } break; @@ -430,7 +434,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) if ( options->alignment < 1 ) { error_msg("invalid alignment size\n", opt_arg ); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } break; @@ -446,7 +450,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) { error_msg("missing file names\n"); usage(h5tools_getprogname()); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } @@ -481,15 +485,15 @@ void read_info(const char *filename, /* compose the name of the file to open, using the srcdir, if appropriate */ if (srcdir){ - strcpy(data_file,srcdir); - strcat(data_file,"/"); + HDstrcpy(data_file,srcdir); + HDstrcat(data_file,"/"); } - strcat(data_file,filename); + HDstrcat(data_file,filename); if ((fp = fopen(data_file, "r")) == (FILE *)NULL) { error_msg("cannot open options file %s\n", filename); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } /* cycle until end of file reached */ @@ -526,7 +530,7 @@ void read_info(const char *filename, if (h5repack_addfilter(comp_info,options)==-1){ error_msg("could not add compression option\n"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -556,7 +560,7 @@ void read_info(const char *filename, if (h5repack_addlayout(comp_info,options)==-1){ error_msg("could not add chunck option\n"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -565,7 +569,7 @@ void read_info(const char *filename, */ else { error_msg("bad file format for %s", filename); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index 57b5fa7..d0fcff3 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -14,6 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" +#include "h5tools.h" #include "h5tools_utils.h" /*------------------------------------------------------------------------- @@ -120,7 +121,7 @@ static int aux_inctable(pack_opttbl_t *table, int n_objs ) unsigned int i; table->size += n_objs; - table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t)); + table->objs = (pack_info_t*)HDrealloc(table->objs, table->size * sizeof(pack_info_t)); if (table->objs==NULL) { error_msg("not enough memory for options table\n"); return -1; @@ -147,7 +148,7 @@ int options_table_init( pack_opttbl_t **tbl ) unsigned int i; pack_opttbl_t *table; - if(NULL == (table = (pack_opttbl_t *)malloc(sizeof(pack_opttbl_t)))) + if(NULL == (table = (pack_opttbl_t *)HDmalloc(sizeof(pack_opttbl_t)))) { error_msg("not enough memory for options table\n"); return -1; @@ -155,10 +156,10 @@ int options_table_init( pack_opttbl_t **tbl ) table->size = 30; table->nelems = 0; - if(NULL == (table->objs = (pack_info_t*)malloc(table->size * sizeof(pack_info_t)))) + if(NULL == (table->objs = (pack_info_t*)HDmalloc(table->size * sizeof(pack_info_t)))) { error_msg("not enough memory for options table\n"); - free(table); + HDfree(table); return -1; } @@ -182,8 +183,8 @@ int options_table_init( pack_opttbl_t **tbl ) int options_table_free( pack_opttbl_t *table ) { - free(table->objs); - free(table); + HDfree(table->objs); + HDfree(table); return 0; } @@ -229,7 +230,7 @@ int options_add_layout( obj_list_t *obj_list, if (table->objs[i].chunk.rank>0) { error_msg("chunk information already inserted for <%s>\n",obj_list[j].obj); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } /* insert the layout info */ else diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index d3c6014..70eadd2 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -14,6 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" +#include "h5tools.h" #include "h5tools_utils.h" /*------------------------------------------------------------------------- @@ -52,7 +53,7 @@ obj_list_t* parse_filter(const char *str, { unsigned i, u; char c; - size_t len=strlen(str); + size_t len=HDstrlen(str); int j, m, n, k, l, end_obj=-1, no_param=0; char sobj[MAX_NC_NAME]; char scomp[10]; @@ -63,7 +64,7 @@ obj_list_t* parse_filter(const char *str, /* initialize compression info */ - memset(filt,0,sizeof(filter_info_t)); + HDmemset(filt,0,sizeof(filter_info_t)); *is_glb = 0; /* check for the end of object list and number of objects */ @@ -88,7 +89,7 @@ obj_list_t* parse_filter(const char *str, } n++; - obj_list = (obj_list_t*) malloc(n*sizeof(obj_list_t)); + obj_list = (obj_list_t*) HDmalloc(n*sizeof(obj_list_t)); if (obj_list==NULL) { error_msg("could not allocate object list\n"); @@ -105,7 +106,7 @@ obj_list_t* parse_filter(const char *str, { if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0'; HDstrcpy(obj_list[n].obj,sobj); - memset(sobj,0,sizeof(sobj)); + HDmemset(sobj,0,sizeof(sobj)); n++; k=-1; } @@ -113,9 +114,9 @@ obj_list_t* parse_filter(const char *str, /* nothing after : */ if (end_obj+1==(int)len) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("input Error: Invalid compression type in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } @@ -151,9 +152,9 @@ obj_list_t* parse_filter(const char *str, } c = str[u]; if (!isdigit(c) && l==-1){ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("compression parameter not digit in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } if (l==-1) stype[m]=c; @@ -173,7 +174,7 @@ obj_list_t* parse_filter(const char *str, else { error_msg("szip mask must be 'NN' or 'EC' \n"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } @@ -211,9 +212,9 @@ obj_list_t* parse_filter(const char *str, } c = str[u]; if (!isdigit(c) && l==-1){ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("compression parameter is not a digit in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } if (l==-1) stype[m]=c; @@ -233,7 +234,7 @@ obj_list_t* parse_filter(const char *str, else { error_msg("scale type must be 'IN' or 'DS' \n"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } @@ -255,9 +256,9 @@ obj_list_t* parse_filter(const char *str, { c = str[u]; if (!isdigit(c)){ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("compression parameter is not a digit in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } stype[m]=c; } /* u */ @@ -301,9 +302,9 @@ obj_list_t* parse_filter(const char *str, filt->cd_nelmts = 1; if (no_param) { /*no more parameters, GZIP must have parameter */ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("missing compression parameter in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } @@ -317,9 +318,9 @@ obj_list_t* parse_filter(const char *str, filt->cd_nelmts = 2; if (no_param) { /*no more parameters, SZIP must have parameter */ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("missing compression parameter in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } @@ -333,9 +334,9 @@ obj_list_t* parse_filter(const char *str, filt->cd_nelmts = 0; if (m>0) { /*shuffle does not have parameter */ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("extra parameter in SHUF <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -348,9 +349,9 @@ obj_list_t* parse_filter(const char *str, filt->cd_nelmts = 0; if (m>0) { /*shuffle does not have parameter */ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("extra parameter in FLET <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -363,9 +364,9 @@ obj_list_t* parse_filter(const char *str, filt->cd_nelmts = 0; if (m>0) { /*nbit does not have parameter */ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("extra parameter in NBIT <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -378,15 +379,15 @@ obj_list_t* parse_filter(const char *str, filt->cd_nelmts = 2; if (no_param) { /*no more parameters, SOFF must have parameter */ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("missing compression parameter in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } else { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("invalid filter type in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } } /*i*/ @@ -407,9 +408,9 @@ obj_list_t* parse_filter(const char *str, case H5Z_FILTER_DEFLATE: if (filt->cd_values[0]>9 ) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("invalid compression parameter in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } break; @@ -422,21 +423,21 @@ obj_list_t* parse_filter(const char *str, pixels_per_block=filt->cd_values[0]; if ((pixels_per_block%2)==1) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("pixels_per_block is not even in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("pixels_per_block is too large in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } if ( (HDstrcmp(smask,"NN")!=0) && (HDstrcmp(smask,"EC")!=0) ) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("szip mask must be 'NN' or 'EC' \n"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } break; default: @@ -479,16 +480,16 @@ obj_list_t* parse_layout(const char *str, obj_list_t* obj_list=NULL; unsigned i; char c; - size_t len=strlen(str); + size_t len=HDstrlen(str); int j, n, k, end_obj=-1, c_index; char sobj[MAX_NC_NAME]; char sdim[10]; char slayout[10]; - memset(sdim, '\0', sizeof(sdim)); - memset(sobj, '\0', sizeof(sobj)); - memset(slayout, '\0', sizeof(slayout)); + HDmemset(sdim, '\0', sizeof(sdim)); + HDmemset(sobj, '\0', sizeof(sobj)); + HDmemset(slayout, '\0', sizeof(slayout)); /* check for the end of object list and number of objects */ for ( i=0, n=0; i\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } /* get layout info */ @@ -554,7 +555,7 @@ obj_list_t* parse_layout(const char *str, pack->layout=H5D_CHUNKED; else { error_msg("in parse layout, not a valid layout in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } else @@ -576,9 +577,9 @@ obj_list_t* parse_layout(const char *str, if (j>(int)len) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> Chunk dimensions missing\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } for ( i=j, c_index=0; i Not a valid character in <%s>\n", sdim,str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } if ( c=='x' || i==len-1) @@ -603,10 +604,10 @@ obj_list_t* parse_layout(const char *str, k=0; pack->chunk.chunk_lengths[c_index]=atoi(sdim); if (pack->chunk.chunk_lengths[c_index]==0) { - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim,str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } c_index++; } @@ -621,10 +622,10 @@ obj_list_t* parse_layout(const char *str, { pack->chunk.chunk_lengths[c_index]=atoi(sdim); if (pack->chunk.chunk_lengths[c_index]==0){ - if (obj_list) free(obj_list); + if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim,str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } pack->chunk.rank=c_index+1; } diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index a79326d..3b2a95b 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -327,7 +327,7 @@ int do_copy_refobjs(hid_t fidin, goto error; } /* end else */ - assert(dset_out != FAIL); + HDassert(dset_out != FAIL); /*------------------------------------------------------------------------- * copy referenced objects in attributes diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 2aabd46..986a7d0 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -14,11 +14,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" +#include "h5tools.h" #include "h5tools_utils.h" /* number of members in an array */ #ifndef NELMTS -# define NELMTS(X) (sizeof(X)/sizeof(X[0])) +# define NELMTS(X) (sizeof(X)/sizeof(X[0])) #endif static int verify_layout(hid_t pid, pack_info_t *obj); @@ -222,9 +223,9 @@ error: * * Purpose: verify which layout is present in the property list DCPL_ID * - * H5D_COMPACT = 0 - * H5D_CONTIGUOUS = 1 - * H5D_CHUNKED = 2 + * H5D_COMPACT = 0 + * H5D_CONTIGUOUS = 1 + * H5D_CHUNKED = 2 * * Return: 1 has, 0 does not, -1 error * diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index cac2654..95b90d4 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -17,6 +17,7 @@ #include "h5test.h" #include "h5diff.h" #include "h5tools.h" +#include "h5tools_utils.h" #define GOERROR {H5_FAILED(); goto error;} @@ -169,9 +170,15 @@ int main (void) int szip_can_encode = 0; #endif + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); + + /* Initialize h5tools lib */ + h5tools_init(); + /* initialize */ - memset(&diff_options, 0, sizeof (diff_opt_t)); - memset(&pack_options, 0, sizeof (pack_opt_t)); + HDmemset(&diff_options, 0, sizeof (diff_opt_t)); + HDmemset(&pack_options, 0, sizeof (pack_opt_t)); /* run tests */ puts("Testing h5repack:"); @@ -3105,7 +3112,7 @@ int make_big(hid_t loc_id) if (H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0) goto out; - free(buf); + HDfree(buf); buf=NULL; /* close */ @@ -3230,7 +3237,7 @@ make_userblock(void) /* Write userblock data */ nwritten = HDwrite(fd, ub, (size_t)USERBLOCK_SIZE); - assert(nwritten == USERBLOCK_SIZE); + HDassert(nwritten == USERBLOCK_SIZE); /* Close file */ HDclose(fd); @@ -3294,7 +3301,7 @@ verify_userblock( const char* filename) /* Read userblock data */ nread = HDread(fd, ub, (size_t)USERBLOCK_SIZE); - assert(nread == USERBLOCK_SIZE); + HDassert(nread == USERBLOCK_SIZE); /* Verify userblock data */ for(u = 0; u < USERBLOCK_SIZE; u++) @@ -3343,7 +3350,7 @@ make_userblock_file(void) /* write userblock data */ nwritten = HDwrite(fd, ub, (size_t)USERBLOCK_SIZE); - assert(nwritten == USERBLOCK_SIZE); + HDassert(nwritten == USERBLOCK_SIZE); /* close file */ HDclose(fd); @@ -3668,7 +3675,7 @@ int write_dset_in(hid_t loc_id, H5Dclose(did); H5Tclose(tid); H5Sclose(sid); - free( dbuf ); + HDfree( dbuf ); } /*------------------------------------------------------------------------- @@ -3703,7 +3710,7 @@ int write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf12, 'z', sizeof buf12); + HDmemset(buf12, 'z', sizeof buf12); } @@ -3724,7 +3731,7 @@ int write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf22,0,sizeof buf22); + HDmemset(buf22,0,sizeof buf22); } if ((tid = H5Tcopy(H5T_STD_B8LE)) < 0) @@ -3754,7 +3761,7 @@ int write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf32,0,sizeof buf32); + HDmemset(buf32,0,sizeof buf32); } if ((tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t))) < 0) @@ -3846,7 +3853,7 @@ int write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf62,0,sizeof buf62); + HDmemset(buf62,0,sizeof buf62); } @@ -3864,8 +3871,8 @@ int write_dset_in(hid_t loc_id, if(make_diffs) { - memset(buf72, 0, sizeof buf72); - memset(buf82, 0, sizeof buf82); + HDmemset(buf72, 0, sizeof buf72); + HDmemset(buf82, 0, sizeof buf82); } @@ -3905,7 +3912,7 @@ int write_dset_in(hid_t loc_id, if (make_diffs) { - memset(buf13,'z',sizeof buf13); + HDmemset(buf13,'z',sizeof buf13); } if ((tid = H5Tcopy(H5T_C_S1)) < 0) @@ -4218,9 +4225,9 @@ int make_dset_reg_ref(hid_t loc_id) out: if(wbuf) - free(wbuf); + HDfree(wbuf); if(dwbuf) - free(dwbuf); + HDfree(dwbuf); H5E_BEGIN_TRY { @@ -4625,7 +4632,7 @@ int write_attr_in(hid_t loc_id, */ if (make_diffs) { - memset(buf12, 'z', sizeof buf12); + HDmemset(buf12, 'z', sizeof buf12); } /* @@ -4665,7 +4672,7 @@ int write_attr_in(hid_t loc_id, if (make_diffs) { - memset(buf22,0,sizeof buf22); + HDmemset(buf22,0,sizeof buf22); } /* @@ -4725,7 +4732,7 @@ int write_attr_in(hid_t loc_id, */ if (make_diffs) { - memset(buf32,0,sizeof buf32); + HDmemset(buf32,0,sizeof buf32); } /* @@ -4873,7 +4880,7 @@ int write_attr_in(hid_t loc_id, if (make_diffs) { - memset(buf62,0,sizeof buf62); + HDmemset(buf62,0,sizeof buf62); } /* buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; @@ -4959,7 +4966,7 @@ int write_attr_in(hid_t loc_id, if (make_diffs) { - memset(buf13,'z',sizeof buf13); + HDmemset(buf13,'z',sizeof buf13); } /* diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c index 332fcc5..e91b2f7 100644 --- a/tools/h5repack/testh5repack_detect_szip.c +++ b/tools/h5repack/testh5repack_detect_szip.c @@ -16,6 +16,7 @@ #include #include "h5repack.h" #include "h5tools.h" +#include "h5tools_utils.h" #include "h5test.h" @@ -47,6 +48,9 @@ int main(void) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); + /* Initialize h5tools lib */ + h5tools_init(); + #ifdef H5_HAVE_FILTER_SZIP if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { printf("yes\n"); diff --git a/tools/h5stat/CMakeLists.txt b/tools/h5stat/CMakeLists.txt index 5613826..b0984a6 100644 --- a/tools/h5stat/CMakeLists.txt +++ b/tools/h5stat/CMakeLists.txt @@ -30,7 +30,7 @@ IF (BUILD_TESTING) IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5stat_gentest ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat_gentest.c) TARGET_NAMING (h5stat_gentest ${LIB_TYPE}) - TARGET_LINK_LIBRARIES (h5stat_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + TARGET_LINK_LIBRARIES (h5stat_gentest ${HDF5_LIB_TARGET}) SET_TARGET_PROPERTIES (h5stat_gentest PROPERTIES FOLDER generator/tools) #ADD_TEST (NAME h5stat_gentest COMMAND $) diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index 708821e..87cd917 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -198,27 +198,27 @@ static void leave(int ret) { h5tools_close(); - exit(ret); -} /* leave() */ + HDexit(ret); +} static void usage(const char *prog) { - fflush(stdout); - fprintf(stdout, "Usage: %s [OPTIONS] file\n", prog); - fprintf(stdout, "\n"); - fprintf(stdout, " OPTIONS\n"); - fprintf(stdout, " -h, --help Print a usage message and exit\n"); - fprintf(stdout, " -V, --version Print version number and exit\n"); - fprintf(stdout, " -f, --file Print file information\n"); - fprintf(stdout, " -F, --filemetadata Print file space information for file's metadata\n"); - fprintf(stdout, " -g, --group Print group information\n"); - fprintf(stdout, " -G, --groupmetadata Print file space information for groups' metadata\n"); - fprintf(stdout, " -d, --dset Print dataset information\n"); - fprintf(stdout, " -D, --dsetmetadata Print file space information for datasets' metadata\n"); - fprintf(stdout, " -T, --dtypemetadata Print datasets' datatype metadata\n"); - fprintf(stdout, " -A, --attribute Print attribute information\n"); - fprintf(stdout, "\n"); + HDfflush(stdout); + HDfprintf(stdout, "Usage: %s [OPTIONS] file\n", prog); + HDfprintf(stdout, "\n"); + HDfprintf(stdout, " OPTIONS\n"); + HDfprintf(stdout, " -h, --help Print a usage message and exit\n"); + HDfprintf(stdout, " -V, --version Print version number and exit\n"); + HDfprintf(stdout, " -f, --file Print file information\n"); + HDfprintf(stdout, " -F, --filemetadata Print file space information for file's metadata\n"); + HDfprintf(stdout, " -g, --group Print group information\n"); + HDfprintf(stdout, " -G, --groupmetadata Print file space information for groups' metadata\n"); + HDfprintf(stdout, " -d, --dset Print dataset information\n"); + HDfprintf(stdout, " -D, --dsetmetadata Print file space information for datasets' metadata\n"); + HDfprintf(stdout, " -T, --dtypemetadata Print datasets' datatype metadata\n"); + HDfprintf(stdout, " -A, --attribute Print attribute information\n"); + HDfprintf(stdout, "\n"); } /* usage() */ @@ -283,8 +283,8 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi) /* Add attribute count to proper bin */ bin = ceil_log10((unsigned long)oi->num_attrs); if((bin + 1) > iter->attr_nbins) { - iter->attr_bins = (unsigned long *)realloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long)); - assert(iter->attr_bins); + iter->attr_bins = (unsigned long *)HDrealloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long)); + HDassert(iter->attr_bins); /* Initialize counts for intermediate bins */ while(iter->attr_nbins < bin) @@ -343,7 +343,7 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Get group information */ ret = H5Gget_info_by_name(iter->fid, name, &ginfo, H5P_DEFAULT); - assert(ret >= 0); + HDassert(ret >= 0); /* Update link stats */ if(ginfo.nlinks < SIZE_SMALL_GROUPS) @@ -355,8 +355,8 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) bin = ceil_log10((unsigned long)ginfo.nlinks); if((bin + 1) > iter->group_nbins) { /* Allocate more storage for info about dataset's datatype */ - iter->group_bins = (unsigned long *)realloc(iter->group_bins, (bin + 1) * sizeof(unsigned long)); - assert(iter->group_bins); + iter->group_bins = (unsigned long *)HDrealloc(iter->group_bins, (bin + 1) * sizeof(unsigned long)); + HDassert(iter->group_bins); /* Initialize counts for intermediate bins */ while(iter->group_nbins < bin) @@ -375,7 +375,7 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Update attribute metadata info */ ret = attribute_stats(iter, oi); - assert(ret >= 0); + HDassert(ret >= 0); return 0; } /* end group_stats() */ @@ -427,7 +427,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) iter->dset_ohdr_info.free_size += oi->hdr.space.free; did = H5Dopen2(iter->fid, name, H5P_DEFAULT); - assert(did > 0); + HDassert(did > 0); /* Update dataset metadata info */ iter->datasets_index_storage_size += oi->meta_size.obj.index_size; @@ -435,17 +435,17 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Update attribute metadata info */ ret = attribute_stats(iter, oi); - assert(ret >= 0); + HDassert(ret >= 0); /* Get storage info */ storage = H5Dget_storage_size(did); /* Gather layout statistics */ dcpl = H5Dget_create_plist(did); - assert(dcpl > 0); + HDassert(dcpl > 0); lout = H5Pget_layout(dcpl); - assert(lout >= 0); + HDassert(lout >= 0); /* Object header's total size for H5D_COMPACT layout includes raw data size */ /* "storage" also includes H5D_COMPACT raw data size */ @@ -468,10 +468,10 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Gather dataspace statistics */ sid = H5Dget_space(did); - assert(sid > 0); + HDassert(sid > 0); ndims = H5Sget_simple_extent_dims(sid, dims, NULL); - assert(ndims >= 0); + HDassert(ndims >= 0); /* Check for larger rank of dataset */ if((unsigned)ndims > iter->max_dset_rank) @@ -490,8 +490,8 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) bin = ceil_log10((unsigned long)dims[0]); if((bin + 1) > iter->dset_dim_nbins) { /* Allocate more storage for info about dataset's datatype */ - iter->dset_dim_bins = (unsigned long *)realloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long)); - assert(iter->dset_dim_bins); + iter->dset_dim_bins = (unsigned long *)HDrealloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long)); + HDassert(iter->dset_dim_bins); /* Initialize counts for intermediate bins */ while(iter->dset_dim_nbins < bin) @@ -506,11 +506,11 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) } /* end if */ ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); /* Gather datatype statistics */ tid = H5Dget_type(did); - assert(tid > 0); + HDassert(tid > 0); type_found = FALSE; for(u = 0; u < iter->dset_ntypes; u++) @@ -527,12 +527,12 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) iter->dset_ntypes++; /* Allocate more storage for info about dataset's datatype */ - iter->dset_type_info = (dtype_info_t *)realloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t)); - assert(iter->dset_type_info); + iter->dset_type_info = (dtype_info_t *)HDrealloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t)); + HDassert(iter->dset_type_info); /* Initialize information about datatype */ iter->dset_type_info[curr_ntype].tid = H5Tcopy(tid); - assert(iter->dset_type_info[curr_ntype].tid > 0); + HDassert(iter->dset_type_info[curr_ntype].tid > 0); iter->dset_type_info[curr_ntype].count = 1; iter->dset_type_info[curr_ntype].named = 0; @@ -545,7 +545,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) (iter->dset_type_info[u].named)++; ret = H5Tclose(tid); - assert(ret >= 0); + HDassert(ret >= 0); /* Track different filters */ if((nfltr = H5Pget_nfilters(dcpl)) >= 0) { @@ -559,15 +559,14 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) else iter->dset_comptype[H5_NFILTERS_IMPL - 1]++; /*other filters*/ } /* end if */ - } /* end for */ } /* endif nfltr */ ret = H5Pclose(dcpl); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Dclose(did); - assert(ret >= 0); + HDassert(ret >= 0); return 0; } /* end dataset_stats() */ @@ -603,7 +602,7 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi) /* Update attribute metadata info */ ret = attribute_stats(iter, oi); - assert(ret >= 0); + HDassert(ret >= 0); return 0; } /* end datatype_stats() */ @@ -719,7 +718,7 @@ parse_command_line(int argc, const char *argv[]) struct handler_t *hand = NULL; /* Allocate space to hold the command line info */ - if((hand = (struct handler_t *)calloc((size_t)argc, sizeof(struct handler_t)))==NULL) { + if((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t)))==NULL) { error_msg("unable to parse command line arguments \n"); goto error; } @@ -1150,7 +1149,7 @@ print_dataset_info(const iter_t *iter) printf("Dataset storage information:\n"); HDfprintf(stdout, "\tTotal raw data size: %Hu\n", iter->dset_storage_size); - HDfprintf(stdout, "\tTotal external raw data size: %Hu\n", iter->dset_external_storage_size); + HDfprintf(stdout, "\tTotal external raw data size: %Hu\n", iter->dset_external_storage_size); printf("Dataset layout information:\n"); for(u = 0; u < H5D_NLAYOUTS; u++) @@ -1168,7 +1167,6 @@ print_dataset_info(const iter_t *iter) printf("\t\tNBIT filter: %lu\n", iter->dset_comptype[H5Z_FILTER_NBIT]); printf("\t\tSCALEOFFSET filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SCALEOFFSET]); printf("\t\tUSER-DEFINED filter: %lu\n", iter->dset_comptype[H5_NFILTERS_IMPL-1]); - } /* end if */ return 0; @@ -1418,6 +1416,7 @@ main(int argc, const char *argv[]) /* Initialize h5tools lib */ h5tools_init(); + if((hand = parse_command_line(argc, argv))==NULL) { goto done; } diff --git a/tools/h5stat/h5stat_gentest.c b/tools/h5stat/h5stat_gentest.c index d1ce106..b1f0c53 100644 --- a/tools/h5stat/h5stat_gentest.c +++ b/tools/h5stat/h5stat_gentest.c @@ -40,11 +40,17 @@ */ static void gen_file(void) { - int ret, i; - hid_t fapl, gid; - hid_t file, type_id, space_id, attr_id, dset_id; - char name[30]; - char attrname[30]; + hid_t fapl; /* File access property */ + hid_t file; /* File id */ + hid_t gid; /* Group id */ + hid_t type_id; /* Datatype id */ + hid_t space_id; /* Dataspace id */ + hid_t attr_id; /* Attribute id */ + hid_t dset_id; /* Dataset id */ + char name[30]; /* Group name */ + char attrname[30]; /* Attribute name */ + int ret; /* Return value */ + int i; /* Local index variable */ fapl = H5Pcreate(H5P_FILE_ACCESS); ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 2337985..a75596d 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -14,6 +14,7 @@ SET (H5_TOOLS_LIB_SRCS ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_dset.c ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_util.c ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools.c + ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_dump.c ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_filters.c ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_ref.c ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_str.c @@ -25,6 +26,7 @@ SET (H5_TOOLS_LIB_SRCS SET (H5_TOOLS_LIB_HDRS ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5trav.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools.h + ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_dump.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_utils.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_str.h ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_ref.h diff --git a/tools/lib/Makefile.am b/tools/lib/Makefile.am index 43ee863..e364b47 100644 --- a/tools/lib/Makefile.am +++ b/tools/lib/Makefile.am @@ -26,7 +26,7 @@ INCLUDES=-I$(top_srcdir)/src # This is our main target, the h5tools library. noinst_LTLIBRARIES=libh5tools.la -libh5tools_la_SOURCES=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c \ +libh5tools_la_SOURCES=h5tools.c h5tools_dump.c h5tools_str.c h5tools_utils.c h5diff.c \ h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c \ h5tools_filters.c h5tools_ref.c h5tools_type.c diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index 0ecf276..beeb42f 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -67,10 +67,10 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libh5tools_la_LIBADD = -am_libh5tools_la_OBJECTS = h5tools.lo h5tools_str.lo h5tools_utils.lo \ - h5diff.lo h5diff_array.lo h5diff_attr.lo h5diff_dset.lo \ - h5diff_util.lo h5trav.lo h5tools_filters.lo h5tools_ref.lo \ - h5tools_type.lo +am_libh5tools_la_OBJECTS = h5tools.lo h5tools_dump.lo h5tools_str.lo \ + h5tools_utils.lo h5diff.lo h5diff_array.lo h5diff_attr.lo \ + h5diff_dset.lo h5diff_util.lo h5trav.lo h5tools_filters.lo \ + h5tools_ref.lo h5tools_type.lo libh5tools_la_OBJECTS = $(am_libh5tools_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) @@ -396,7 +396,7 @@ INCLUDES = -I$(top_srcdir)/src # This is our main target, the h5tools library. noinst_LTLIBRARIES = libh5tools.la -libh5tools_la_SOURCES = h5tools.c h5tools_str.c h5tools_utils.c h5diff.c \ +libh5tools_la_SOURCES = h5tools.c h5tools_dump.c h5tools_str.c h5tools_utils.c h5diff.c \ h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c \ h5tools_filters.c h5tools_ref.c h5tools_type.c @@ -490,6 +490,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5diff_dset.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5diff_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5tools.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5tools_dump.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5tools_filters.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5tools_ref.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5tools_str.Plo@am__quote@ diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index be20ed4..bc8acd5 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -25,11 +25,11 @@ * Debug printf macros. The prefix allows output filtering by test scripts. */ #ifdef H5DIFF_DEBUG -#define h5diffdebug(x) fprintf(stderr, "h5diff debug: " x) -#define h5diffdebug2(x1, x2) fprintf(stderr, "h5diff debug: " x1, x2) -#define h5diffdebug3(x1, x2, x3) fprintf(stderr, "h5diff debug: " x1, x2, x3) -#define h5diffdebug4(x1, x2, x3, x4) fprintf(stderr, "h5diff debug: " x1, x2, x3, x4) -#define h5diffdebug5(x1, x2, x3, x4, x5) fprintf(stderr, "h5diff debug: " x1, x2, x3, x4, x5) +#define h5diffdebug(x) HDfprintf(stderr, "h5diff debug: " x) +#define h5diffdebug2(x1, x2) HDfprintf(stderr, "h5diff debug: " x1, x2) +#define h5diffdebug3(x1, x2, x3) HDfprintf(stderr, "h5diff debug: " x1, x2, x3) +#define h5diffdebug4(x1, x2, x3, x4) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4) +#define h5diffdebug5(x1, x2, x3, x4, x5) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4, x5) #else #define h5diffdebug(x) #define h5diffdebug2(x1, x2) @@ -153,13 +153,13 @@ void print_manager_output(void) overflow_file = NULL; } - fflush(stdout); - memset(outBuff, 0, OUTBUFF_SIZE); + HDfflush(stdout); + HDmemset(outBuff, 0, OUTBUFF_SIZE); outBuffOffset = 0; } else if( (outBuffOffset>0) && !g_Parallel) { - fprintf(stderr, "h5diff error: outBuffOffset>0, but we're not in parallel!\n"); + HDfprintf(stderr, "h5diff error: outBuffOffset>0, but we're not in parallel!\n"); } } @@ -189,7 +189,7 @@ static void print_incoming_data(void) MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &incomingMessage, &Status); if(incomingMessage) { - memset(data, 0, PRINT_DATA_MAX_SIZE+1); + HDmemset(data, 0, PRINT_DATA_MAX_SIZE+1); MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status); printf("%s", data); @@ -274,7 +274,7 @@ static int is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *options if (exclude_path_ptr->obj_type == H5TRAV_TYPE_GROUP) { ret_cmp = HDstrncmp(exclude_path_ptr->obj_path, path, - strlen(exclude_path_ptr->obj_path)); + HDstrlen(exclude_path_ptr->obj_path)); if (ret_cmp == 0) { /* check if given path belong to an excluding group, if so @@ -531,7 +531,7 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, const char *ext_path; /* init linkinfo struct */ - memset(&lnk_info, 0, sizeof(h5tool_link_info_t)); + HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t)); if (!opts->follow_links) { @@ -614,7 +614,7 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, done: if (lnk_info.trg_path) - HDfree(lnk_info.trg_path); + HDfree((char *)lnk_info.trg_path); return 0; } @@ -728,25 +728,25 @@ hsize_t h5diff(const char *fname1, /* make the given object1 fullpath, start with "/" */ if (HDstrncmp(objname1, "/", 1)) { - HDstrcpy(obj1fullname, "/"); - HDstrcat(obj1fullname, objname1); + HDstrcpy((char *)obj1fullname, "/"); + HDstrcat((char *)obj1fullname, objname1); } else - HDstrcpy(obj1fullname, objname1); + HDstrcpy((char *)obj1fullname, objname1); /* make the given object2 fullpath, start with "/" */ if (HDstrncmp(objname2, "/", 1)) { - HDstrcpy(obj2fullname, "/"); - HDstrcat(obj2fullname, objname2); + HDstrcpy((char *)obj2fullname, "/"); + HDstrcat((char *)obj2fullname, objname2); } else - HDstrcpy(obj2fullname, objname2); + HDstrcpy((char *)obj2fullname, objname2); /*---------------------------------------------------------- * check if obj1 is root, group, single object or symlink */ - if(!HDstrcmp(obj1fullname, "/")) + if(!HDstrcmp((char *)obj1fullname, "/")) { obj1type = H5TRAV_TYPE_GROUP; } @@ -856,9 +856,9 @@ hsize_t h5diff(const char *fname1, { /* set root group */ obj1fullname = (char*)HDcalloc(2, sizeof(char)); - HDstrcat(obj1fullname, "/"); + HDstrcat((char *)obj1fullname, "/"); obj2fullname = (char*)HDcalloc(2, sizeof(char)); - HDstrcat(obj2fullname, "/"); + HDstrcat((char *)obj2fullname, "/"); } @@ -995,7 +995,7 @@ hsize_t h5diff(const char *fname1, if((HDstrlen(fname1) > MAX_FILENAME) || (HDstrlen(fname2) > MAX_FILENAME)) { - fprintf(stderr, "The parallel diff only supports path names up to %d characters\n", MAX_FILENAME); + HDfprintf(stderr, "The parallel diff only supports path names up to %d characters\n", MAX_FILENAME); MPI_Abort(MPI_COMM_WORLD, 0); } /* end if */ @@ -1045,15 +1045,15 @@ out: /* free buffers */ if (obj1fullname) - HDfree(obj1fullname); + HDfree((char *)obj1fullname); if (obj2fullname) - HDfree(obj2fullname); + HDfree((char *)obj2fullname); /* free link info buffer */ if (trg_linfo1.trg_path) - HDfree(trg_linfo1.trg_path); + HDfree((char *)trg_linfo1.trg_path); if (trg_linfo2.trg_path) - HDfree(trg_linfo2.trg_path); + HDfree((char *)trg_linfo2.trg_path); /* close */ H5E_BEGIN_TRY @@ -1112,9 +1112,9 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, * make full path */ if (HDstrcmp (grp1, "/")) - grp1_path = grp1; + grp1_path = (char *)grp1; if (HDstrcmp (grp2, "/")) - grp2_path = grp2; + grp2_path = (char *)grp2; /*------------------------------------------------------------------------- * regarding the return value of h5diff (0, no difference in files, 1 difference ) @@ -1180,12 +1180,12 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, { objtype = table->objs[i].type; /* make full path for obj1 */ - obj1_fullpath = (char*)HDcalloc (strlen(grp1_path) + strlen (table->objs[i].name) + 1, sizeof (char)); + obj1_fullpath = (char*)HDcalloc (HDstrlen(grp1_path) + strlen (table->objs[i].name) + 1, sizeof (char)); HDstrcpy(obj1_fullpath, grp1_path); HDstrcat(obj1_fullpath, table->objs[i].name); /* make full path for obj2 */ - obj2_fullpath = (char*)HDcalloc (strlen(grp2_path) + strlen (table->objs[i].name) + 1, sizeof (char)); + obj2_fullpath = (char*)HDcalloc (HDstrlen(grp2_path) + strlen (table->objs[i].name) + 1, sizeof (char)); HDstrcpy(obj2_fullpath, grp2_path); HDstrcat(obj2_fullpath, table->objs[i].name); @@ -1474,7 +1474,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } /* end if */ h5diffdebug("done with if block\n"); - free(workerTasks); + HDfree(workerTasks); } #endif /* H5_HAVE_PARALLEL */ @@ -1769,9 +1769,9 @@ out: /* free link info buffer */ if (linkinfo1.trg_path) - HDfree(linkinfo1.trg_path); + HDfree((char *)linkinfo1.trg_path); if (linkinfo2.trg_path) - HDfree(linkinfo2.trg_path); + HDfree((char *)linkinfo2.trg_path); return nfound; } @@ -1938,7 +1938,7 @@ hsize_t diff(hid_t file1_id, *---------------------------------------------------------------------- */ case H5TRAV_TYPE_DATASET: - /* verbose (-v) and report (-r) mode */ + /* verbose (-v) and report (-r) mode */ if(options->m_verbose || options->m_report) { do_print_objname("dataset", path1, path2, options); @@ -1950,7 +1950,7 @@ hsize_t diff(hid_t file1_id, { nfound = diff_dataset(file1_id, file2_id, path1, path2, options); } - /* the rest (-c, none, ...) */ + /* the rest (-c, none, ...) */ else { nfound = diff_dataset(file1_id, file2_id, path1, path2, options); @@ -1958,7 +1958,7 @@ hsize_t diff(hid_t file1_id, if (nfound) { do_print_objname("dataset", path1, path2, options); - print_found(nfound); + print_found(nfound); } } break; @@ -2163,9 +2163,9 @@ hsize_t diff(hid_t file1_id, /* free link info buffer */ if (linkinfo1.trg_path) - HDfree(linkinfo1.trg_path); + HDfree((char *)linkinfo1.trg_path); if (linkinfo2.trg_path) - HDfree(linkinfo2.trg_path); + HDfree((char *)linkinfo2.trg_path); return nfound; @@ -2206,9 +2206,9 @@ out2: /* free link info buffer */ if (linkinfo1.trg_path) - HDfree(linkinfo1.trg_path); + HDfree((char *)linkinfo1.trg_path); if (linkinfo2.trg_path) - HDfree(linkinfo2.trg_path); + HDfree((char *)linkinfo2.trg_path); /* close */ /* disable error reporting */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index e6a9d05..57a5599 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -137,7 +137,7 @@ static int not_comparable; is_zero=1; \ } -# define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b)) +# define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b)) /*------------------------------------------------------------------------- * local prototypes @@ -260,7 +260,7 @@ hsize_t diff_array( void *_mem1, switch (type_class) { default: - assert(0); + HDassert(0); break; /*------------------------------------------------------------------------- @@ -440,10 +440,10 @@ hsize_t diff_datum(void *_mem1, switch (H5Tget_class(m_type)) { default: - assert(0); + HDassert(0); break; case H5T_TIME: - assert(0); + HDassert(0); break; /*------------------------------------------------------------------------- @@ -705,7 +705,7 @@ hsize_t diff_datum(void *_mem1, size = H5Tget_size(memb_type); ndims = H5Tget_array_ndims(m_type); H5Tget_array_dims2(m_type, adims); - assert(ndims >= 1 && ndims <= H5S_MAX_RANK); + HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK); /* calculate the number of array elements */ for (u = 0, nelmts = 1; u d && !options->p) { @@ -993,10 +993,10 @@ hsize_t diff_datum(void *_mem1, { unsigned char temp1_uchar; unsigned char temp2_uchar; - assert(type_size==sizeof(unsigned char)); + HDassert(type_size==sizeof(unsigned char)); - memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); /* -d and !-p */ if (options->d && !options->p) { @@ -1092,10 +1092,10 @@ hsize_t diff_datum(void *_mem1, { short temp1_short; short temp2_short; - assert(type_size==sizeof(short)); + HDassert(type_size==sizeof(short)); - memcpy(&temp1_short, mem1, sizeof(short)); - memcpy(&temp2_short, mem2, sizeof(short)); + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); /* -d and !-p */ if (options->d && !options->p) { @@ -1191,10 +1191,10 @@ hsize_t diff_datum(void *_mem1, { unsigned short temp1_ushort; unsigned short temp2_ushort; - assert(type_size==sizeof(short)); + HDassert(type_size==sizeof(short)); - memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); /* -d and !-p */ if (options->d && !options->p) { @@ -1291,10 +1291,10 @@ hsize_t diff_datum(void *_mem1, { int temp1_int; int temp2_int; - assert(type_size==sizeof(int)); + HDassert(type_size==sizeof(int)); - memcpy(&temp1_int, mem1, sizeof(int)); - memcpy(&temp2_int, mem2, sizeof(int)); + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); /* -d and !-p */ if (options->d && !options->p) { @@ -1389,10 +1389,10 @@ hsize_t diff_datum(void *_mem1, { unsigned int temp1_uint; unsigned int temp2_uint; - assert(type_size==sizeof(int)); + HDassert(type_size==sizeof(int)); - memcpy(&temp1_uint, mem1, sizeof(unsigned int)); - memcpy(&temp2_uint, mem2, sizeof(unsigned int)); + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); /* -d and !-p */ if (options->d && !options->p) { @@ -1487,10 +1487,10 @@ hsize_t diff_datum(void *_mem1, { long temp1_long; long temp2_long; - assert(type_size==sizeof(long)); + HDassert(type_size==sizeof(long)); - memcpy(&temp1_long, mem1, sizeof(long)); - memcpy(&temp2_long, mem2, sizeof(long)); + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); /* -d and !-p */ if (options->d && !options->p) { @@ -1587,10 +1587,10 @@ hsize_t diff_datum(void *_mem1, { unsigned long temp1_ulong; unsigned long temp2_ulong; - assert(type_size==sizeof(unsigned long)); + HDassert(type_size==sizeof(unsigned long)); - memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); /* -d and !-p */ if (options->d && !options->p) { @@ -1686,10 +1686,10 @@ hsize_t diff_datum(void *_mem1, { long long temp1_llong; long long temp2_llong; - assert(type_size==sizeof(long long)); + HDassert(type_size==sizeof(long long)); - memcpy(&temp1_llong, mem1, sizeof(long long)); - memcpy(&temp2_llong, mem2, sizeof(long long)); + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); /* -d and !-p */ if (options->d && !options->p) { @@ -1784,10 +1784,10 @@ hsize_t diff_datum(void *_mem1, { unsigned long long temp1_ullong; unsigned long long temp2_ullong; - assert(type_size==sizeof(unsigned long long)); + HDassert(type_size==sizeof(unsigned long long)); - memcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - memcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); /* -d and !-p */ if (options->d && !options->p) { @@ -1904,10 +1904,10 @@ hsize_t diff_datum(void *_mem1, int isnan1=0; int isnan2=0; - assert(type_size==sizeof(float)); + HDassert(type_size==sizeof(float)); - memcpy(&temp1_float, mem1, sizeof(float)); - memcpy(&temp2_float, mem2, sizeof(float)); + HDmemcpy(&temp1_float, mem1, sizeof(float)); + HDmemcpy(&temp2_float, mem2, sizeof(float)); /* logic for detecting NaNs is different with options -d, -p and no options */ @@ -2117,10 +2117,10 @@ hsize_t diff_datum(void *_mem1, int isnan1=0; int isnan2=0; - assert(type_size==sizeof(double)); + HDassert(type_size==sizeof(double)); - memcpy(&temp1_double, mem1, sizeof(double)); - memcpy(&temp2_double, mem2, sizeof(double)); + HDmemcpy(&temp1_double, mem1, sizeof(double)); + HDmemcpy(&temp2_double, mem2, sizeof(double)); /* logic for detecting NaNs is different with options -d, -p and no options */ @@ -2332,10 +2332,10 @@ hsize_t diff_datum(void *_mem1, int isnan2=0; - assert(type_size==sizeof(long double)); + HDassert(type_size==sizeof(long double)); - memcpy(&temp1_double, mem1, sizeof(long double)); - memcpy(&temp2_double, mem2, sizeof(long double)); + HDmemcpy(&temp1_double, mem1, sizeof(long double)); + HDmemcpy(&temp2_double, mem2, sizeof(long double)); /* logic for detecting NaNs is different with options -d, -p and no options */ @@ -2668,13 +2668,13 @@ hsize_t diff_region(hid_t obj1_id, */ if(nblocks1 > 0) { alloc_size = nblocks1 * ndims1 * 2 * sizeof(ptdata1[0]); - assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - ptdata1 = malloc((size_t)alloc_size); + ptdata1 = HDmalloc((size_t)alloc_size); H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t); H5Sget_select_hyper_blocklist(region1_id, (hsize_t)0, (hsize_t)nblocks1, ptdata1); - ptdata2 = malloc((size_t)alloc_size); + ptdata2 = HDmalloc((size_t)alloc_size); H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t); H5Sget_select_hyper_blocklist(region2_id, (hsize_t)0, (hsize_t)nblocks2, ptdata2); @@ -2723,13 +2723,13 @@ hsize_t diff_region(hid_t obj1_id, */ if(npoints1 > 0) { alloc_size = npoints1 * ndims1 * sizeof(ptdata1[0]); - assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - ptdata1 = malloc((size_t)alloc_size); + ptdata1 = HDmalloc((size_t)alloc_size); H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t); H5Sget_select_elem_pointlist(region1_id, (hsize_t)0, (hsize_t)npoints1, ptdata1); - ptdata2 = malloc((size_t)alloc_size); + ptdata2 = HDmalloc((size_t)alloc_size); H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t); H5Sget_select_elem_pointlist(region2_id, (hsize_t)0, (hsize_t)npoints2, ptdata2); @@ -2820,8 +2820,8 @@ hsize_t character_compare(unsigned char *mem1, unsigned char temp1_uchar; unsigned char temp2_uchar; - memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); if (temp1_uchar != temp2_uchar) { @@ -2869,8 +2869,8 @@ hsize_t character_compare_opt(unsigned char *mem1, double per; int both_zero; - memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); /* -d and !-p */ @@ -2975,8 +2975,8 @@ hsize_t diff_float(unsigned char *mem1, { for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_float, mem1, sizeof(float)); - memcpy(&temp2_float, mem2, sizeof(float)); + HDmemcpy(&temp1_float, mem1, sizeof(float)); + HDmemcpy(&temp2_float, mem2, sizeof(float)); /*------------------------------------------------------------------------- * detect NaNs @@ -3029,8 +3029,8 @@ hsize_t diff_float(unsigned char *mem1, { for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_float, mem1, sizeof(float)); - memcpy(&temp2_float, mem2, sizeof(float)); + HDmemcpy(&temp1_float, mem1, sizeof(float)); + HDmemcpy(&temp2_float, mem2, sizeof(float)); /*------------------------------------------------------------------------- * detect NaNs @@ -3102,8 +3102,8 @@ hsize_t diff_float(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_float, mem1, sizeof(float)); - memcpy(&temp2_float, mem2, sizeof(float)); + HDmemcpy(&temp1_float, mem1, sizeof(float)); + HDmemcpy(&temp2_float, mem2, sizeof(float)); /*------------------------------------------------------------------------- * detect NaNs @@ -3176,8 +3176,8 @@ hsize_t diff_float(unsigned char *mem1, { for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_float, mem1, sizeof(float)); - memcpy(&temp2_float, mem2, sizeof(float)); + HDmemcpy(&temp1_float, mem1, sizeof(float)); + HDmemcpy(&temp2_float, mem2, sizeof(float)); if (equal_float(temp1_float,temp2_float,options)==FALSE) { @@ -3248,8 +3248,8 @@ hsize_t diff_double(unsigned char *mem1, { for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_double, mem1, sizeof(double)); - memcpy(&temp2_double, mem2, sizeof(double)); + HDmemcpy(&temp1_double, mem1, sizeof(double)); + HDmemcpy(&temp2_double, mem2, sizeof(double)); /*------------------------------------------------------------------------- * detect NaNs @@ -3302,8 +3302,8 @@ hsize_t diff_double(unsigned char *mem1, { for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_double, mem1, sizeof(double)); - memcpy(&temp2_double, mem2, sizeof(double)); + HDmemcpy(&temp1_double, mem1, sizeof(double)); + HDmemcpy(&temp2_double, mem2, sizeof(double)); /*------------------------------------------------------------------------- * detect NaNs @@ -3375,8 +3375,8 @@ hsize_t diff_double(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_double, mem1, sizeof(double)); - memcpy(&temp2_double, mem2, sizeof(double)); + HDmemcpy(&temp1_double, mem1, sizeof(double)); + HDmemcpy(&temp2_double, mem2, sizeof(double)); /*------------------------------------------------------------------------- * detect NaNs @@ -3452,8 +3452,8 @@ hsize_t diff_double(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_double, mem1, sizeof(double)); - memcpy(&temp2_double, mem2, sizeof(double)); + HDmemcpy(&temp1_double, mem1, sizeof(double)); + HDmemcpy(&temp2_double, mem2, sizeof(double)); if (equal_double(temp1_double,temp2_double,options)==FALSE) @@ -3531,8 +3531,8 @@ hsize_t diff_ldouble(unsigned char *mem1, { for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_double, mem1, sizeof(long double)); - memcpy(&temp2_double, mem2, sizeof(long double)); + HDmemcpy(&temp1_double, mem1, sizeof(long double)); + HDmemcpy(&temp2_double, mem2, sizeof(long double)); /*------------------------------------------------------------------------- * detect NaNs @@ -3585,8 +3585,8 @@ hsize_t diff_ldouble(unsigned char *mem1, { for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_double, mem1, sizeof(long double)); - memcpy(&temp2_double, mem2, sizeof(long double)); + HDmemcpy(&temp1_double, mem1, sizeof(long double)); + HDmemcpy(&temp2_double, mem2, sizeof(long double)); /*------------------------------------------------------------------------- * detect NaNs @@ -3658,8 +3658,8 @@ hsize_t diff_ldouble(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_double, mem1, sizeof(long double)); - memcpy(&temp2_double, mem2, sizeof(long double)); + HDmemcpy(&temp1_double, mem1, sizeof(long double)); + HDmemcpy(&temp2_double, mem2, sizeof(long double)); /*------------------------------------------------------------------------- * detect NaNs @@ -3735,8 +3735,8 @@ hsize_t diff_ldouble(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_double, mem1, sizeof(long double)); - memcpy(&temp2_double, mem2, sizeof(long double)); + HDmemcpy(&temp1_double, mem1, sizeof(long double)); + HDmemcpy(&temp2_double, mem2, sizeof(long double)); if (equal_ldouble(temp1_double,temp2_double,options)==FALSE) @@ -3809,8 +3809,8 @@ hsize_t diff_schar(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_char, mem1, sizeof(char)); - memcpy(&temp2_char, mem2, sizeof(char)); + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); if (ABS(temp1_char-temp2_char) > options->delta) { @@ -3835,8 +3835,8 @@ hsize_t diff_schar(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_char, mem1, sizeof(char)); - memcpy(&temp2_char, mem2, sizeof(char)); + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); PER(temp1_char,temp2_char); @@ -3879,8 +3879,8 @@ hsize_t diff_schar(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_char, mem1, sizeof(char)); - memcpy(&temp2_char, mem2, sizeof(char)); + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); PER(temp1_char,temp2_char); @@ -3922,8 +3922,8 @@ hsize_t diff_schar(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_char, mem1, sizeof(char)); - memcpy(&temp2_char, mem2, sizeof(char)); + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); if (temp1_char != temp2_char) { @@ -3986,8 +3986,8 @@ hsize_t diff_uchar(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) { @@ -4013,8 +4013,8 @@ hsize_t diff_uchar(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); @@ -4057,8 +4057,8 @@ hsize_t diff_uchar(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); @@ -4100,8 +4100,8 @@ hsize_t diff_uchar(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); if (temp1_uchar != temp2_uchar) { @@ -4161,8 +4161,8 @@ hsize_t diff_short(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_short, mem1, sizeof(short)); - memcpy(&temp2_short, mem2, sizeof(short)); + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); if (ABS(temp1_short-temp2_short) > options->delta) { @@ -4188,8 +4188,8 @@ hsize_t diff_short(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_short, mem1, sizeof(short)); - memcpy(&temp2_short, mem2, sizeof(short)); + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); PER(temp1_short,temp2_short); @@ -4234,8 +4234,8 @@ hsize_t diff_short(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_short, mem1, sizeof(short)); - memcpy(&temp2_short, mem2, sizeof(short)); + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); PER(temp1_short,temp2_short); @@ -4277,8 +4277,8 @@ hsize_t diff_short(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_short, mem1, sizeof(short)); - memcpy(&temp2_short, mem2, sizeof(short)); + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); if (temp1_short != temp2_short) { @@ -4339,8 +4339,8 @@ hsize_t diff_ushort(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta) { @@ -4366,8 +4366,8 @@ hsize_t diff_ushort(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); @@ -4412,8 +4412,8 @@ hsize_t diff_ushort(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); @@ -4455,8 +4455,8 @@ hsize_t diff_ushort(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); if (temp1_ushort != temp2_ushort) { @@ -4518,8 +4518,8 @@ hsize_t diff_int(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_int, mem1, sizeof(int)); - memcpy(&temp2_int, mem2, sizeof(int)); + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); if (ABS(temp1_int-temp2_int) > options->delta) { @@ -4545,8 +4545,8 @@ hsize_t diff_int(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_int, mem1, sizeof(int)); - memcpy(&temp2_int, mem2, sizeof(int)); + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); PER(temp1_int,temp2_int); @@ -4591,8 +4591,8 @@ hsize_t diff_int(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_int, mem1, sizeof(int)); - memcpy(&temp2_int, mem2, sizeof(int)); + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); PER(temp1_int,temp2_int); @@ -4634,8 +4634,8 @@ hsize_t diff_int(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_int, mem1, sizeof(int)); - memcpy(&temp2_int, mem2, sizeof(int)); + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); if (temp1_int != temp2_int) { @@ -4697,8 +4697,8 @@ hsize_t diff_uint(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_uint, mem1, sizeof(unsigned int)); - memcpy(&temp2_uint, mem2, sizeof(unsigned int)); + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); if ( PDIFF(temp1_uint,temp2_uint) > options->delta) { @@ -4724,8 +4724,8 @@ hsize_t diff_uint(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_uint, mem1, sizeof(unsigned int)); - memcpy(&temp2_uint, mem2, sizeof(unsigned int)); + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); PER_UNSIGN(signed int,temp1_uint,temp2_uint); @@ -4769,8 +4769,8 @@ hsize_t diff_uint(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_uint, mem1, sizeof(unsigned int)); - memcpy(&temp2_uint, mem2, sizeof(unsigned int)); + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); PER_UNSIGN(signed int,temp1_uint,temp2_uint); @@ -4811,8 +4811,8 @@ hsize_t diff_uint(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_uint, mem1, sizeof(unsigned int)); - memcpy(&temp2_uint, mem2, sizeof(unsigned int)); + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); if (temp1_uint != temp2_uint) { @@ -4877,8 +4877,8 @@ hsize_t diff_long(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_long, mem1, sizeof(long)); - memcpy(&temp2_long, mem2, sizeof(long)); + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); if (ABS(temp1_long-temp2_long) > options->delta) { @@ -4904,8 +4904,8 @@ hsize_t diff_long(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_long, mem1, sizeof(long)); - memcpy(&temp2_long, mem2, sizeof(long)); + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); PER(temp1_long,temp2_long); @@ -4950,8 +4950,8 @@ hsize_t diff_long(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_long, mem1, sizeof(long)); - memcpy(&temp2_long, mem2, sizeof(long)); + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); PER(temp1_long,temp2_long); @@ -4993,8 +4993,8 @@ hsize_t diff_long(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_long, mem1, sizeof(long)); - memcpy(&temp2_long, mem2, sizeof(long)); + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); if (temp1_long != temp2_long) { @@ -5061,8 +5061,8 @@ hsize_t diff_ulong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); if ( PDIFF(temp1_ulong,temp2_ulong) > options->delta) { @@ -5090,8 +5090,8 @@ hsize_t diff_ulong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); @@ -5135,8 +5135,8 @@ hsize_t diff_ulong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); @@ -5177,8 +5177,8 @@ hsize_t diff_ulong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); if (temp1_ulong != temp2_ulong) { @@ -5240,8 +5240,8 @@ hsize_t diff_llong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_llong, mem1, sizeof(long long)); - memcpy(&temp2_llong, mem2, sizeof(long long)); + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); if (ABS( temp1_llong-temp2_llong) > options->delta) { @@ -5267,8 +5267,8 @@ hsize_t diff_llong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_llong, mem1, sizeof(long long)); - memcpy(&temp2_llong, mem2, sizeof(long long)); + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); PER(temp1_llong,temp2_llong); @@ -5310,8 +5310,8 @@ hsize_t diff_llong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_llong, mem1, sizeof(long long)); - memcpy(&temp2_llong, mem2, sizeof(long long)); + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); PER(temp1_llong,temp2_llong); @@ -5350,8 +5350,8 @@ hsize_t diff_llong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_llong, mem1, sizeof(long long)); - memcpy(&temp2_llong, mem2, sizeof(long long)); + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); if (temp1_llong != temp2_llong) { @@ -5414,8 +5414,8 @@ hsize_t diff_ullong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - memcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta) { @@ -5441,8 +5441,8 @@ hsize_t diff_ullong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - memcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); @@ -5486,8 +5486,8 @@ hsize_t diff_ullong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - memcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); @@ -5528,8 +5528,8 @@ hsize_t diff_ullong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - memcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - memcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); if (temp1_ullong != temp2_ullong) { @@ -5580,18 +5580,18 @@ int ull2float(unsigned long long ull_value, float *f_value) src_size = H5Tget_size(H5T_NATIVE_ULLONG); dst_size = H5Tget_size(H5T_NATIVE_FLOAT); - buf = (unsigned char*)calloc(1, MAX(src_size, dst_size)); + buf = (unsigned char*)HDcalloc(1, MAX(src_size, dst_size)); - memcpy(buf, &ull_value, src_size); + HDmemcpy(buf, &ull_value, src_size); /* do conversion */ if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, 1, buf, NULL, dxpl_id)<0) goto error; - memcpy(f_value, buf, dst_size); + HDmemcpy(f_value, buf, dst_size); if(buf) - free(buf); + HDfree(buf); return 0; @@ -5600,7 +5600,7 @@ error: H5Pclose(dxpl_id); } H5E_END_TRY; if(buf) - free(buf); + HDfree(buf); return -1; } @@ -5774,13 +5774,13 @@ hbool_t equal_float(float value, float expected, diff_opt_t *options) /*------------------------------------------------------------------------- - * Function: my_isnan + * Function: my_isnan * - * Purpose: Determines whether VAL points to NaN. + * Purpose: Determines whether VAL points to NaN. * - * Return: TRUE or FALSE + * Return: TRUE or FALSE * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, July 6, 1998 * * Modifications: @@ -5995,7 +5995,7 @@ void print_pos( int *ph, /* print header */ pos[i] = curr_pos/acc[i]; curr_pos -= acc[i]*pos[i]; } - assert( curr_pos == 0 ); + HDassert( curr_pos == 0 ); if ( rank > 0 ) { @@ -6048,7 +6048,7 @@ void print_char_pos( int *ph, /* print header */ pos[i] = curr_pos/acc[i]; curr_pos -= acc[i]*pos[i]; } - assert( curr_pos == 0 ); + HDassert( curr_pos == 0 ); parallel_print("[ " ); if ( rank > 0 ) diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 03ec067..c1ed429 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -409,7 +409,7 @@ hsize_t diff_datasetid( hid_t did1, options, name1, name2, m_tid1, did1, did2); /* reclaim any VL memory, if necessary */ - if(vl_data) { + if(vl_data) { H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1); H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2); } /* end if */ @@ -445,27 +445,27 @@ hsize_t diff_datasetid( hid_t did1, size = 1; sm_size[i - 1] = MIN(dims1[i - 1], size); sm_nbytes *= sm_size[i - 1]; - assert(sm_nbytes > 0); + HDassert(sm_nbytes > 0); } /* end for */ - /* malloc return code should be verified. + /* malloc return code should be verified. * If fail, need to handle the error. * This else branch should be recoded as a separate function. * Note that there are many "goto error" within this branch * that fails to address freeing other objects created here. - * E.g., sm_space. - */ - sm_buf1 = malloc((size_t)sm_nbytes); - assert(sm_buf1); - sm_buf2 = malloc((size_t)sm_nbytes); - assert(sm_buf2); + * E.g., sm_space. + */ + sm_buf1 = HDmalloc((size_t)sm_nbytes); + HDassert(sm_buf1); + sm_buf2 = HDmalloc((size_t)sm_nbytes); + HDassert(sm_buf2); sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); /* the stripmine loop */ - memset(hs_offset, 0, sizeof hs_offset); - memset(zero, 0, sizeof zero); + HDmemset(hs_offset, 0, sizeof hs_offset); + HDmemset(zero, 0, sizeof zero); for(elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { /* calculate the hyperslab size */ @@ -529,19 +529,19 @@ hsize_t diff_datasetid( hid_t did1, /* free */ if(buf1 != NULL) { - free(buf1); + HDfree(buf1); buf1 = NULL; } /* end if */ if(buf2 != NULL) { - free(buf2); + HDfree(buf2); buf2 = NULL; } /* end if */ if(sm_buf1 != NULL) { - free(sm_buf1); + HDfree(sm_buf1); sm_buf1 = NULL; } /* end if */ if(sm_buf2 != NULL) { - free(sm_buf2); + HDfree(sm_buf2); sm_buf2 = NULL; } /* end if */ @@ -565,7 +565,7 @@ error: /* reclaim any VL memory, if necessary */ if(vl_data) H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1); - free(buf1); + HDfree(buf1); buf1=NULL; } if (buf2!=NULL) @@ -573,7 +573,7 @@ error: /* reclaim any VL memory, if necessary */ if(vl_data) H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2); - free(buf2); + HDfree(buf2); buf2=NULL; } if (sm_buf1!=NULL) @@ -581,7 +581,7 @@ error: /* reclaim any VL memory, if necessary */ if(vl_data) H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); - free(sm_buf1); + HDfree(sm_buf1); sm_buf1=NULL; } if (sm_buf2!=NULL) @@ -589,7 +589,7 @@ error: /* reclaim any VL memory, if necessary */ if(vl_data) H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2); - free(sm_buf2); + HDfree(sm_buf2); sm_buf2=NULL; } @@ -695,7 +695,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ *------------------------------------------------------------------------- */ - assert(tclass1==tclass2); + HDassert(tclass1==tclass2); switch (tclass1) { case H5T_INTEGER: @@ -784,7 +784,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ *------------------------------------------------------------------------- */ - assert(rank1==rank2); + HDassert(rank1==rank2); for ( i=0; i0 && '/'==name[i-1]) --i; diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index db81496..0d29686 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -25,6 +25,7 @@ #include #include "h5tools.h" +#include "h5tools_dump.h" #include "h5tools_ref.h" #include "h5tools_utils.h" #include "H5private.h" @@ -38,223 +39,20 @@ hid_t H5tools_ERR_CLS_g = -1; hid_t H5E_tools_g = -1; hid_t H5E_tools_min_id_g = -1; int compound_data; -FILE *rawdatastream; /* should initialize to stdout but gcc moans about it */ -int bin_output; /* binary output */ -int bin_form; /* binary form */ -int region_output; /* region output */ -int packed_bits_num; /* number of packed bits to display */ +FILE *rawdatastream; /* should initialize to stdout but gcc moans about it */ +FILE *rawoutstream; /* should initialize to stdout but gcc moans about it */ +FILE *rawerrorstream; /* should initialize to stderr but gcc moans about it */ +int bin_output; /* binary output */ +int bin_form; /* binary form */ +int region_output; /* region output */ +int oid_output; /* oid output */ +int data_output; /* data output */ +int attr_data_output; /* attribute data output */ +int packed_bits_num; /* number of packed bits to display */ int packed_data_offset; /* offset of packed bits to display */ +int packed_data_length; /* lengtht of packed bits to display */ unsigned long long packed_data_mask; /* mask in which packed bits to display */ -static h5tool_format_t h5tools_dataformat = { -0, /*raw */ - -"", /*fmt_raw */ -"%d", /*fmt_int */ -"%u", /*fmt_uint */ -#ifdef H5_VMS -"%hd",/*fmt_schar */ -#else -"%hhd",/*fmt_schar */ -#endif -"%u", /*fmt_uchar */ -"%d", /*fmt_short */ -"%u", /*fmt_ushort */ -"%ld", /*fmt_long */ -"%lu", /*fmt_ulong */ -NULL, /*fmt_llong */ -NULL, /*fmt_ullong */ -"%g", /*fmt_double */ -"%g", /*fmt_float */ - -0, /*ascii */ -0, /*str_locale */ -0, /*str_repeat */ - -"[ ", /*arr_pre */ -",", /*arr_sep */ -" ]", /*arr_suf */ -1, /*arr_linebreak */ - -"", /*cmpd_name */ -",\n", /*cmpd_sep */ -"{\n", /*cmpd_pre */ -"}", /*cmpd_suf */ -"\n", /*cmpd_end */ - -", ", /*vlen_sep */ -"(", /*vlen_pre */ -")", /*vlen_suf */ -"", /*vlen_end */ - -"%s", /*elmt_fmt */ -",", /*elmt_suf1 */ -" ", /*elmt_suf2 */ - -"", /*idx_n_fmt */ -"", /*idx_sep */ -"", /*idx_fmt */ - -80, /*line_ncols *//*standard default columns */ -0, /*line_per_line */ -"", /*line_pre */ -"%s", /*line_1st */ -"%s", /*line_cont */ -"", /*line_suf */ -"", /*line_sep */ -1, /*line_multi_new */ -" ", /*line_indent */ - -1, /*skip_first */ - -1, /*obj_hidefileno */ -" "H5_PRINTF_HADDR_FMT, /*obj_format */ - -1, /*dset_hidefileno */ -"DATASET %s ", /*dset_format */ -"%s", /*dset_blockformat_pre */ -"%s", /*dset_ptformat_pre */ -"%s", /*dset_ptformat */ -1, /*array indices */ -1 /*escape non printable characters */ -}; - -static const h5tools_dump_header_t h5tools_standardformat = { -"standardformat", /*name */ -"HDF5", /*fileebgin */ -"", /*fileend */ -SUPER_BLOCK, /*bootblockbegin */ -"", /*bootblockend */ -H5_TOOLS_GROUP, /*groupbegin */ -"", /*groupend */ -H5_TOOLS_DATASET, /*datasetbegin */ -"", /*datasetend */ -ATTRIBUTE, /*attributebegin */ -"", /*attributeend */ -H5_TOOLS_DATATYPE, /*datatypebegin */ -"", /*datatypeend */ -DATASPACE, /*dataspacebegin */ -"", /*dataspaceend */ -DATA, /*databegin */ -"", /*dataend */ -SOFTLINK, /*softlinkbegin */ -"", /*softlinkend */ -EXTLINK, /*extlinkbegin */ -"", /*extlinkend */ -UDLINK, /*udlinkbegin */ -"", /*udlinkend */ -SUBSET, /*subsettingbegin */ -"", /*subsettingend */ -START, /*startbegin */ -"", /*startend */ -STRIDE, /*stridebegin */ -"", /*strideend */ -COUNT, /*countbegin */ -"", /*countend */ -BLOCK, /*blockbegin */ -"", /*blockend */ - -"{", /*fileblockbegin */ -"}", /*fileblockend */ -"{", /*bootblockblockbegin */ -"}", /*bootblockblockend */ -"{", /*groupblockbegin */ -"}", /*groupblockend */ -"{", /*datasetblockbegin */ -"}", /*datasetblockend */ -"{", /*attributeblockbegin */ -"}", /*attributeblockend */ -"", /*datatypeblockbegin */ -"", /*datatypeblockend */ -"", /*dataspaceblockbegin */ -"", /*dataspaceblockend */ -"{", /*datablockbegin */ -"}", /*datablockend */ -"{", /*softlinkblockbegin */ -"}", /*softlinkblockend */ -"{", /*extlinkblockbegin */ -"}", /*extlinkblockend */ -"{", /*udlinkblockbegin */ -"}", /*udlinkblockend */ -"{", /*strblockbegin */ -"}", /*strblockend */ -"{", /*enumblockbegin */ -"}", /*enumblockend */ -"{", /*structblockbegin */ -"}", /*structblockend */ -"{", /*vlenblockbegin */ -"}", /*vlenblockend */ -"{", /*subsettingblockbegin */ -"}", /*subsettingblockend */ -"(", /*startblockbegin */ -");", /*startblockend */ -"(", /*strideblockbegin */ -");", /*strideblockend */ -"(", /*countblockbegin */ -");", /*countblockend */ -"(", /*blockblockbegin */ -");", /*blockblockend */ - -"", /*dataspacedescriptionbegin */ -"", /*dataspacedescriptionend */ -"(", /*dataspacedimbegin */ -")", /*dataspacedimend */ -}; - -static const h5tools_dump_header_t * h5tools_dump_header_format; - -/* local prototypes */ -static int do_bin_output(FILE *stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem); -static int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem); -static int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, - hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); -static hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, - FILE *stream, hid_t container); -static hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, - FILE *stream, hid_t container); -static hbool_t h5tools_is_zero(const void *_mem, size_t size); - -hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, - h5tools_str_t *buffer/*string into which to render */, - hsize_t *curr_pos/*total data element position*/, - size_t ncols, hsize_t local_elmt_counter/*element counter*/, - hsize_t elmt_counter); - -hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, - h5tools_str_t *buffer/*string into which to render */, - hsize_t *curr_pos/*total data element position*/, - size_t ncols, hsize_t *ptdata, - hsize_t local_elmt_counter/*element counter*/, - hsize_t elmt_counter); - -static int h5tools_print_region_data_blocks(hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, - h5tools_str_t *buffer/*string into which to render */, size_t ncols, - int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); - -hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, - h5tools_str_t *buffer/*string into which to render */, - hsize_t *curr_pos/*total data element position*/, - size_t ncols, hsize_t region_elmt_counter/*element counter*/, - hsize_t elmt_counter); - -int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, - h5tools_str_t *buffer, size_t ncols, - int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata); - -hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, - h5tools_str_t *buffer/*string into which to render */, - hsize_t *curr_pos/*total data element position*/, - size_t ncols, hsize_t region_elmt_counter/*element counter*/, - hsize_t elmt_counter); - /* module-scoped variables */ static int h5tools_init_g; /* if h5tools lib has been initialized */ #ifdef H5_HAVE_PARALLEL @@ -321,8 +119,12 @@ h5tools_init(void) if (!rawdatastream) rawdatastream = stdout; + if (!rawoutstream) + rawoutstream = stdout; + if (!rawerrorstream) + rawerrorstream = stderr; - h5tools_dump_header_format = &h5tools_standardformat; + h5tools_dump_init(); h5tools_init_g++; } @@ -354,6 +156,18 @@ h5tools_close(void) else rawdatastream = NULL; } + if (rawoutstream && rawoutstream != stdout) { + if (fclose(rawoutstream)) + perror("closing rawoutstream"); + else + rawoutstream = NULL; + } + if (rawerrorstream && rawerrorstream != stderr) { + if (fclose(rawerrorstream)) + perror("closing rawerrorstream"); + else + rawerrorstream = NULL; + } /* Clean up the reference path table, if it's been used */ term_ref_path_table(); @@ -399,7 +213,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) /* Determine which driver the user wants to open the file with. Try * that driver. If it can't open it, then fail. */ - if (!strcmp(driver, drivernames[SEC2_IDX])) { + if (!HDstrcmp(driver, drivernames[SEC2_IDX])) { /* SEC2 driver */ if (H5Pset_fapl_sec2(new_fapl) < 0) goto error; @@ -407,7 +221,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) if (drivernum) *drivernum = SEC2_IDX; } - else if (!strcmp(driver, drivernames[FAMILY_IDX])) { + else if (!HDstrcmp(driver, drivernames[FAMILY_IDX])) { /* FAMILY Driver */ /* Set member size to be 0 to indicate the current first member size @@ -419,7 +233,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) if (drivernum) *drivernum = FAMILY_IDX; } - else if (!strcmp(driver, drivernames[SPLIT_IDX])) { + else if (!HDstrcmp(driver, drivernames[SPLIT_IDX])) { /* SPLIT Driver */ if (H5Pset_fapl_split(new_fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) goto error; @@ -427,7 +241,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) if (drivernum) *drivernum = SPLIT_IDX; } - else if (!strcmp(driver, drivernames[MULTI_IDX])) { + else if (!HDstrcmp(driver, drivernames[MULTI_IDX])) { /* MULTI Driver */ if (H5Pset_fapl_multi(new_fapl, NULL, NULL, NULL, NULL, TRUE) < 0) goto error; @@ -436,7 +250,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) *drivernum = MULTI_IDX; #ifdef H5_HAVE_STREAM } - else if(!strcmp(driver, drivernames[STREAM_IDX])) { + else if(!HDstrcmp(driver, drivernames[STREAM_IDX])) { /* STREAM Driver */ if(H5Pset_fapl_stream(new_fapl, NULL) < 0) goto error; @@ -446,7 +260,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) #endif /* H5_HAVE_STREAM */ #ifdef H5_HAVE_PARALLEL } - else if(!strcmp(driver, drivernames[MPIO_IDX])) { + else if(!HDstrcmp(driver, drivernames[MPIO_IDX])) { /* MPI-I/O Driver */ /* check if MPI has been initialized. */ if(!h5tools_mpi_init_g) @@ -459,7 +273,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) *drivernum = MPIO_IDX; } /* end if */ } - else if (!strcmp(driver, drivernames[MPIPOSIX_IDX])) { + else if (!HDstrcmp(driver, drivernames[MPIPOSIX_IDX])) { /* MPI-I/O Driver */ /* check if MPI has been initialized. */ if(!h5tools_mpi_init_g) @@ -585,7 +399,7 @@ h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, const char *driver, /* Save the driver name */ if (drivername && drivername_size) { if (fid != FAIL) { - strncpy(drivername, drivernames[drivernum], drivername_size); + HDstrncpy(drivername, drivernames[drivernum], drivername_size); drivername[drivername_size - 1] = '\0'; } else { @@ -617,7 +431,7 @@ done: *------------------------------------------------------------------------- */ static size_t -h5tools_ncols(const char *s) +h5tools_count_ncols(const char *s) { register size_t i; @@ -743,7 +557,7 @@ done: * level before) *------------------------------------------------------------------------- */ -static void +void h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hsize_t elmtno, int secnum) { @@ -755,14 +569,14 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, if (!ctx->need_prefix) return; - memset(&prefix, 0, sizeof(h5tools_str_t)); - memset(&str, 0, sizeof(h5tools_str_t)); + HDmemset(&prefix, 0, sizeof(h5tools_str_t)); + HDmemset(&str, 0, sizeof(h5tools_str_t)); /* Terminate previous line, if any */ if (ctx->cur_column) { - fputs(OPT(info->line_suf, ""), stream); - putc('\n', stream); - fputs(OPT(info->line_sep, ""), stream); + HDfputs(OPT(info->line_suf, ""), stream); + HDputc('\n', stream); + HDfputs(OPT(info->line_sep, ""), stream); } /* Calculate new prefix */ @@ -786,23 +600,23 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, the prefix is printed one indentation level before */ if (info->pindex) { for (i = 0; i < indentlevel - 1; i++) { - fputs(h5tools_str_fmt(&str, 0, info->line_indent), stream); + HDfputs(h5tools_str_fmt(&str, 0, info->line_indent), stream); } } if (elmtno == 0 && secnum == 0 && info->line_1st) - fputs(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); + HDfputs(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); else if (secnum && info->line_cont) - fputs(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); + HDfputs(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); else - fputs(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + HDfputs(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); templength = h5tools_str_len(&prefix); for (i = 0; i < indentlevel; i++) { /*we already made the indent for the array indices case */ if (!info->pindex) { - fputs(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); + HDfputs(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); templength += h5tools_str_len(&prefix); } else { @@ -832,7 +646,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, * None *------------------------------------------------------------------------- */ -static void +void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum) { @@ -844,14 +658,14 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, if (!ctx->need_prefix) return; - memset(&prefix, 0, sizeof(h5tools_str_t)); - memset(&str, 0, sizeof(h5tools_str_t)); + HDmemset(&prefix, 0, sizeof(h5tools_str_t)); + HDmemset(&str, 0, sizeof(h5tools_str_t)); /* Terminate previous line, if any */ if (ctx->cur_column) { - fputs(OPT(info->line_suf, ""), stream); - putc('\n', stream); - fputs(OPT(info->line_sep, ""), stream); + HDfputs(OPT(info->line_suf, ""), stream); + HDputc('\n', stream); + HDfputs(OPT(info->line_sep, ""), stream); } /* Calculate new prefix */ @@ -875,23 +689,23 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, the prefix is printed one indentation level before */ if (info->pindex) { for (i = 0; i < indentlevel - 1; i++) { - fputs(h5tools_str_fmt(&str, 0, info->line_indent), stream); + HDfputs(h5tools_str_fmt(&str, 0, info->line_indent), stream); } } if (elmtno == 0 && secnum == 0 && info->line_1st) - fputs(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); + HDfputs(h5tools_str_fmt(&prefix, 0, info->line_1st), stream); else if (secnum && info->line_cont) - fputs(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); + HDfputs(h5tools_str_fmt(&prefix, 0, info->line_cont), stream); else - fputs(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); + HDfputs(h5tools_str_fmt(&prefix, 0, info->line_pre), stream); templength = h5tools_str_len(&prefix); for (i = 0; i < indentlevel; i++) { /*we already made the indent for the array indices case */ if (!info->pindex) { - fputs(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); + HDfputs(h5tools_str_fmt(&prefix, 0, info->line_indent), stream); templength += h5tools_str_len(&prefix); } else { @@ -912,159 +726,6 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, /*------------------------------------------------------------------------- * Audience: Public * Chapter: H5Tools Library - * Purpose: Prints NELMTS data elements to output STREAM. - * Description: - * Prints some (NELMTS) data elements to output STREAM. The elements are - * stored in _MEM as type TYPE and are printed according to the format - * described in INFO. The CTX struct contains context information shared - * between calls to this function. The FLAGS is a bit field that - * indicates whether the data supplied in this call falls at the - * beginning or end of the total data to be printed (START_OF_DATA and - * END_OF_DATA). - * Return: - * None - * Programmer: - * Robb Matzke, Monday, April 26, 1999 - * Modifications: - * Robb Matzke, 1999-06-04 - * The `container' argument is the optional dataset for reference types. - * - * Robb Matzke, 1999-09-29 - * Understands the `per_line' property which indicates that every Nth - * element should begin a new line. - * - * Robb Matzke, LLNL, 2003-06-05 - * Do not dereference the memory for a variable-length string here. - * Deref in h5tools_str_sprint() instead so recursive types are - * handled correctly. - * - * Pedro Vicente Nunes, The HDF Group, 2005-10-19 - * pass to the prefix in h5tools_simple_prefix the total position - * instead of the current stripmine position i; this is necessary - * to print the array indices - * new field sm_pos in h5tools_context_t, the current stripmine element position - *------------------------------------------------------------------------- - */ -void -h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, - h5tools_context_t *ctx/*in,out*/, unsigned flags, - hsize_t nelmts, hid_t type, void *_mem) -{ - unsigned char *mem = (unsigned char*) _mem; - hsize_t i; /*element counter */ - size_t size; /*size of each datum */ - hid_t region_space; - hid_t region_id; - hbool_t dimension_break = TRUE; - H5S_sel_type region_type; - size_t ncols = 80; /*available output width */ - h5tools_str_t buffer; /*string into which to render */ - hsize_t curr_pos; /* total data element position */ - hsize_t elmt_counter = 0;/*counts the # elements printed. - *I (ptl?) needed something that - *isn't going to get reset when a new - *line is formed. I'm going to use - *this var to count elements and - *break after we see a number equal - *to the ctx->size_last_dim. */ - - /* binary dump */ - if (bin_output) { - do_bin_output(rawdatastream, container, nelmts, type, _mem); - } /* end if */ - else { - /* setup */ - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - size = H5Tget_size(type); - - if (info->line_ncols > 0) - ncols = info->line_ncols; - - /* pass to the prefix in h5tools_simple_prefix the total position - * instead of the current stripmine position i; this is necessary - * to print the array indices - */ - curr_pos = ctx->sm_pos; - - for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) { - void* memref = mem + i * size; - if (region_output && H5Tequal(type, H5T_STD_REF_DSETREG)) { - char ref_name[1024]; - - /* region data */ - region_id = H5Rdereference(container, H5R_DATASET_REGION, memref); - if (region_id >= 0) { - region_space = H5Rget_region(container, H5R_DATASET_REGION, memref); - if (region_space >= 0) { - if (h5tools_is_zero(memref, H5Tget_size(type))) { - h5tools_str_append(&buffer, "NULL"); - } - else { - if(H5Rget_name(region_id, H5R_DATASET_REGION, memref, (char*) ref_name, 1024)<0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_name failed"); - - /* Render the region element begin */ - h5tools_str_reset(&buffer); - - h5tools_str_append(&buffer, info->dset_format, ref_name); - - dimension_break = h5tools_render_element(stdout, info, - ctx, &buffer, &curr_pos, ncols, i, elmt_counter); - - region_type = H5Sget_select_type(region_space); - if(region_type==H5S_SEL_POINTS) - /* Print point information */ - dimension_break = h5tools_dump_region_data_points( - region_space, region_id, stdout, info, ctx, - &buffer, &curr_pos, ncols, i, elmt_counter); - else if(region_type==H5S_SEL_HYPERSLABS) - /* Print block information */ - dimension_break = h5tools_dump_region_data_blocks( - region_space, region_id, stdout, info, ctx, - &buffer, &curr_pos, ncols, i, elmt_counter); - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "invalid region type"); - /* Render the region element end */ - - } /* end else to if (h5tools_is_zero(... */ - if(H5Sclose(region_space) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - } /* end if (region_space >= 0) */ - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_region failed"); - if(H5Dclose(region_id) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); - - } /* if (region_id >= 0) */ - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference failed"); - - ctx->need_prefix = TRUE; - } /* end if (region_output... */ - else { - /* Render the data element begin*/ - h5tools_str_reset(&buffer); - h5tools_str_sprint(&buffer, info, container, type, memref, ctx); - - if (i + 1 < nelmts || (flags & END_OF_DATA) == 0) - h5tools_str_append(&buffer, "%s", OPT(info->elmt_suf1, ",")); - - dimension_break = h5tools_render_element(stream, info, ctx, &buffer, - &curr_pos, ncols, i, elmt_counter); - /* Render the data element end*/ - - } - if(FALSE==dimension_break) - elmt_counter = 0; - } /* end for (i = 0; i < nelmts... */ - - h5tools_str_close(&buffer); - }/* else bin */ -} - -/*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library * Purpose: Render an element to output STREAM. * Description: * Prints the string buffer to the output STREAM. The string is @@ -1105,9 +766,9 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * current location... */ if (info->line_multi_new == 1 && - (ctx->cur_column + h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + - strlen(OPT(info->line_suf, ""))) > ncols) { + (ctx->cur_column + h5tools_count_ncols(s) + + HDstrlen(OPT(info->elmt_suf2, " ")) + + HDstrlen(OPT(info->line_suf, ""))) > ncols) { if (ctx->prev_multiline) { /* * ... and the previous element also occupied more than one @@ -1115,9 +776,9 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, */ ctx->need_prefix = TRUE; } - else if ((ctx->prev_prefix_len + h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + - strlen(OPT(info->line_suf, ""))) <= ncols) { + else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) + + HDstrlen(OPT(info->elmt_suf2, " ")) + + HDstrlen(OPT(info->line_suf, ""))) <= ncols) { /* * ...but *could* fit on one line otherwise, then we * should end the current line and start this element on its @@ -1150,9 +811,9 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, if (info->line_multi_new == 1 && ctx->prev_multiline && (ctx->cur_column + - h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + - strlen(OPT(info->line_suf, ""))) > ncols) + h5tools_count_ncols(s) + + HDstrlen(OPT(info->elmt_suf2, " ")) + + HDstrlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = TRUE; /* @@ -1169,7 +830,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, */ multiline = 0; for (secnum = 0, multiline = 0; - (section = strtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK)); + (section = HDstrtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK)); secnum++) { /* * If the current section plus possible suffix and end-of-line @@ -1180,9 +841,9 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, /* * check for displaying prefix for each section */ - if ( (ctx->cur_column + strlen(section) + - strlen(OPT(info->elmt_suf2, " ")) + - strlen(OPT(info->line_suf, ""))) > ncols) + if ( (ctx->cur_column + HDstrlen(section) + + HDstrlen(OPT(info->elmt_suf2, " ")) + + HDstrlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = 1; /* @@ -1202,13 +863,13 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_simple_prefix(stream, info, ctx, *curr_pos, secnum); } else if ((local_elmt_counter || ctx->continuation) && secnum == 0) { - fputs(OPT(info->elmt_suf2, " "), stream); - ctx->cur_column += strlen(OPT(info->elmt_suf2, " ")); + HDfputs(OPT(info->elmt_suf2, " "), stream); + ctx->cur_column += HDstrlen(OPT(info->elmt_suf2, " ")); } /* Print the section */ - fputs(section, stream); - ctx->cur_column += strlen(section); + HDfputs(section, stream); + ctx->cur_column += HDstrlen(section); } ctx->prev_multiline = multiline; @@ -1259,9 +920,9 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * current location... */ if (info->line_multi_new == 1 && - (ctx->cur_column + h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + - strlen(OPT(info->line_suf, ""))) > ncols) { + (ctx->cur_column + h5tools_count_ncols(s) + + HDstrlen(OPT(info->elmt_suf2, " ")) + + HDstrlen(OPT(info->line_suf, ""))) > ncols) { if (ctx->prev_multiline) { /* * ... and the previous element also occupied more than one @@ -1269,9 +930,9 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, */ ctx->need_prefix = TRUE; } - else if ((ctx->prev_prefix_len + h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + - strlen(OPT(info->line_suf, ""))) <= ncols) { + else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) + + HDstrlen(OPT(info->elmt_suf2, " ")) + + HDstrlen(OPT(info->line_suf, ""))) <= ncols) { /* * ...but *could* fit on one line otherwise, then we * should end the current line and start this element on its @@ -1304,9 +965,9 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, if (info->line_multi_new == 1 && ctx->prev_multiline && (ctx->cur_column + - h5tools_ncols(s) + - strlen(OPT(info->elmt_suf2, " ")) + - strlen(OPT(info->line_suf, ""))) > ncols) + h5tools_count_ncols(s) + + HDstrlen(OPT(info->elmt_suf2, " ")) + + HDstrlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = TRUE; /* @@ -1322,7 +983,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * one-at a time. */ multiline = 0; - for (secnum = 0, multiline = 0; (section = strtok(secnum ? NULL : s, + for (secnum = 0, multiline = 0; (section = HDstrtok(secnum ? NULL : s, OPTIONAL_LINE_BREAK)); secnum++) { /* * If the current section plus possible suffix and end-of-line @@ -1336,9 +997,9 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, */ if ((!info->skip_first || local_elmt_counter) && (ctx->cur_column + - strlen(section) + - strlen(OPT(info->elmt_suf2, " ")) + - strlen(OPT(info->line_suf, ""))) > ncols) + HDstrlen(section) + + HDstrlen(OPT(info->elmt_suf2, " ")) + + HDstrlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = 1; /* @@ -1358,13 +1019,13 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools_region_simple_prefix(stream, info, ctx, local_elmt_counter, ptdata, secnum); } else if ((local_elmt_counter || ctx->continuation) && secnum == 0) { - fputs(OPT(info->elmt_suf2, " "), stream); - ctx->cur_column += strlen(OPT(info->elmt_suf2, " ")); + HDfputs(OPT(info->elmt_suf2, " "), stream); + ctx->cur_column += HDstrlen(OPT(info->elmt_suf2, " ")); } /* Print the section */ - fputs(section, stream); - ctx->cur_column += strlen(section); + HDfputs(section, stream); + ctx->cur_column += HDstrlen(section); } ctx->prev_multiline = multiline; @@ -1372,2319 +1033,69 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, } /*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: Print the data values from a dataset referenced by region blocks. - * - * Description: - * This is a special case subfunction to print the data in a region reference of type blocks. + * Function: init_acc_pos * - * Return: - * The function returns FAIL if there was an error, otherwise SUCEED + * Purpose: initialize accumulator and matrix position * - * Parameters Description: - * h5tools_str_t *buffer is the string into which to render - * size_t ncols - * int ndims is the number of dimensions of the region element - * hssize_t nblocks is the number of blocks in the region + * Return: void *------------------------------------------------------------------------- */ -static int -h5tools_print_region_data_blocks(hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, - h5tools_str_t *buffer/*string into which to render */, size_t ncols, - int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) +void +init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) { - hbool_t dimension_break = TRUE; - hsize_t *dims1 = NULL; - hsize_t *start = NULL; - hsize_t *count = NULL; - size_t numelem; - hsize_t total_size[H5S_MAX_RANK]; - hsize_t elmtno; /* elemnt index */ - unsigned int region_flags; /* buffer extent flags */ - hsize_t curr_pos; - size_t jndx; - int indx; - int type_size; - hid_t mem_space = -1; - void *region_buf = NULL; - hsize_t blkndx; - hid_t sid1 = -1; - int ret_value = SUCCEED; - h5tools_context_t ctx; - - assert(info); - assert(cur_ctx); - assert(buffer); - assert(ptdata); - - memset(&ctx, 0, sizeof(ctx)); - /* Get the dataspace of the dataset */ - if((sid1 = H5Dget_space(region_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + int i; - /* Allocate space for the dimension array */ - if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + HDassert(ctx->ndims); - /* find the dimensions of each data space from the block coordinates */ - numelem = 1; - for (jndx = 0; jndx < ndims; jndx++) { - dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1; - numelem = dims1[jndx] * numelem; + ctx->acc[ctx->ndims - 1] = 1; + for (i = (ctx->ndims - 2); i >= 0; i--) { + ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1]; } - - /* Create dataspace for reading buffer */ - if((mem_space = H5Screate_simple(ndims, dims1, NULL)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); - - if((type_size = H5Tget_size(type_id)) == 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - if((region_buf = HDmalloc(type_size * numelem)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer"); - - /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ - /* 1 2 n 1 2 n */ - if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for start"); - - if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for count"); - - curr_pos = 0; - ctx.indent_level = cur_ctx->indent_level; - ctx.cur_column = cur_ctx->cur_column; - ctx.prev_multiline = cur_ctx->prev_multiline; - ctx.ndims = ndims; - for (blkndx = 0; blkndx < nblocks; blkndx++) { - ctx.need_prefix = TRUE; - ctx.cur_elmt = 0; - for (indx = 0; indx < ndims; indx++) { - start[indx] = ptdata[indx + blkndx * ndims * 2]; - count[indx] = dims1[indx]; - } - - if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - - if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed"); - - ctx.indent_level++; - if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - - /* assume entire data space to be printed */ - for (indx = 0; indx < (size_t) ctx.ndims; indx++) - ctx.p_min_idx[indx] = start[indx]; - init_acc_pos(&ctx, total_size); - - /* print the data */ - region_flags = START_OF_DATA; - if (blkndx == nblocks - 1) - region_flags |= END_OF_DATA; - - for (indx = 0; indx < (size_t)ctx.ndims; indx++) - ctx.p_max_idx[indx] = dims1[indx]; - - curr_pos = 0; - ctx.sm_pos = blkndx*2*ndims; - ctx.size_last_dim = dims1[ndims-1]; - - h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0); - - elmtno = 0; - for (jndx = 0; jndx < numelem; jndx++, elmtno++, ctx.cur_elmt++) { - /* Render the region data element begin */ - h5tools_str_reset(buffer); - - h5tools_str_append(buffer, "%s", jndx ? OPTIONAL_LINE_BREAK "" : ""); - h5tools_str_sprint(buffer, info, region_id, type_id, - ((char*)region_buf + jndx * type_size), &ctx); - - if (jndx + 1 < numelem || (region_flags & END_OF_DATA) == 0) - h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ",")); - - dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, - ncols, ptdata, jndx, elmtno); - /* Render the region data element end */ - - if(FALSE == dimension_break) - elmtno = 0; - } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */ - - ctx.indent_level--; - } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ - - done: - HDfree(start); - HDfree(count); - HDfree(region_buf); - HDfree(dims1); - - if(H5Sclose(mem_space) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - if(H5Sclose(sid1) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - - return ret_value; + for (i = 0; i < ctx->ndims; i++) + ctx->pos[i] = 0; } /*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: Print some values from a dataset referenced by region blocks. - * - * Description: - * This is a special case subfunction to dump a region reference using blocks. - * - * Return: - * The function returns False if the last dimension has been reached, otherwise True + * Function: do_bin_output * - * In/Out: - * h5tools_context_t *ctx - * hsize_t *curr_pos + * Purpose: Dump memory buffer to a binary file stream * - * Parameters Description: - * h5tools_str_t *buffer is the string into which to render - * hsize_t curr_pos is the total data element position - * size_t ncols - * hsize_t region_elmt_counter is the region element loop counter - * hsize_t elmt_count is the data element loop counter + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ -hbool_t -h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, - h5tools_str_t *buffer/*string into which to render */, - hsize_t *curr_pos/*total data element position*/, - size_t ncols, hsize_t region_elmt_counter/*element counter*/, - hsize_t elmt_counter) +int +do_bin_output(FILE *stream, FILE *err_stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem) { - HERR_INIT(hbool_t, TRUE) - hbool_t dimension_break = TRUE; - hssize_t nblocks; - hsize_t alloc_size; - hsize_t *ptdata = NULL; - int ndims; - hid_t dtype; - hid_t type_id; - int i; - - assert(info); - assert(ctx); - assert(buffer); - - if((nblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); - - /* Print block information */ - if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); - - /* Render the region { element begin */ - h5tools_str_reset(buffer); - - h5tools_str_append(buffer, "{"); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the region { element end */ - - /* Render the region datatype info and indices element begin */ - h5tools_str_reset(buffer); - - ctx->indent_level++; - ctx->need_prefix = TRUE; - h5tools_str_append(buffer, "REGION_TYPE BLOCK "); - - alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); - assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ - if((ptdata = (hsize_t*) malloc((size_t) alloc_size)) == NULL) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); - - H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t); - if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed"); - - for (i = 0; i < nblocks; i++) { - int j; - - h5tools_str_append(buffer, info->dset_blockformat_pre, - i ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long) i); - - /* Start coordinates and opposite corner */ - for (j = 0; j < ndims; j++) - h5tools_str_append(buffer, "%s%lu", j ? "," : "(", - (unsigned long) ptdata[i * 2 * ndims + j]); - - for (j = 0; j < ndims; j++) - h5tools_str_append(buffer, "%s%lu", j ? "," : ")-(", - (unsigned long) ptdata[i * 2 * ndims + j + ndims]); - - h5tools_str_append(buffer, ")"); - } /* end for (i = 0; i < nblocks; i++) */ - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the region datatype info and indices element end */ - - ctx->need_prefix = TRUE; - - if((dtype = H5Dget_type(region_id)) < 0) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); - if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); - - /* Render the datatype element begin */ - h5tools_str_reset(buffer); - h5tools_str_append(buffer, "%s %s ", - h5tools_dump_header_format->datatypebegin, - h5tools_dump_header_format->datatypeblockbegin); - - h5tools_print_datatype(buffer, info, ctx, dtype); - - if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeblockend); - if (HDstrlen(h5tools_dump_header_format->datatypeend)) - h5tools_str_append(buffer, " "); - } - if (HDstrlen(h5tools_dump_header_format->datatypeend)) - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend); - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the datatype element end */ - - ctx->need_prefix = TRUE; - - /* Render the dataspace element begin */ - h5tools_str_reset(buffer); - - ctx->need_prefix = TRUE; - h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin); + HERR_INIT(int, SUCCEED) + unsigned char *mem = (unsigned char*)_mem; + size_t size; /* datum size */ + hsize_t i; /* element counter */ - h5tools_print_dataspace(buffer, region_space); + if((size = H5Tget_size(tid)) == 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) - h5tools_str_append(buffer, " "); + for (i = 0; i < nelmts; i++) { + if (render_bin_output(stream, container, tid, mem + i * size) < 0) { + HDfprintf(err_stream,"\nError in writing binary stream\n"); + return FAIL; + } } - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the dataspace element end */ - - ctx->need_prefix = TRUE; - - /* Render the databegin element begin */ - h5tools_str_reset(buffer); - - h5tools_str_append(buffer, "%s %s ", - h5tools_dump_header_format->databegin, - h5tools_dump_header_format->datablockbegin); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the databegin element end */ - - ctx->need_prefix = TRUE; - - h5tools_print_region_data_blocks(region_id, rawdatastream, info, ctx, - buffer, ncols, ndims, type_id, nblocks, ptdata); - - done: - free(ptdata); - - if(H5Tclose(type_id) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - if(H5Tclose(dtype) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - ctx->need_prefix = TRUE; - - /* Render the dataend element begin */ - h5tools_str_reset(buffer); - h5tools_str_append(buffer, "%s %s ", - h5tools_dump_header_format->dataend, - h5tools_dump_header_format->datablockend); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, - ncols, region_elmt_counter, elmt_counter); - /* Render the dataend element end */ - - ctx->indent_level--; - ctx->need_prefix = TRUE; - - /* Render the region } element begin */ - h5tools_str_reset(buffer); - h5tools_str_append(buffer, "}"); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, - ncols, region_elmt_counter, elmt_counter); - /* Render the region } element end */ - - H5_LEAVE(dimension_break) - - CATCH +CATCH return ret_value; } /*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: Print the data values from a dataset referenced by region points. - * - * Description: - * This is a special case subfunction to print the data in a region reference of type points. + * Function: render_bin_output * - * Return: - * The function returns FAIL on error, otherwise SUCCEED - * - * Parameters Description: - * h5tools_str_t *buffer is the string into which to render - * size_t ncols - * int ndims is the number of dimensions of the region element - * hssize_t npoints is the number of points in the region - *------------------------------------------------------------------------- - */ -int -h5tools_print_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, - h5tools_str_t *buffer, size_t ncols, - int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) -{ - hbool_t dimension_break = TRUE; - hsize_t *dims1 = NULL; - hsize_t elmtno; /* elemnt index */ - unsigned int region_flags; /* buffer extent flags */ - hsize_t curr_pos; - hsize_t total_size[H5S_MAX_RANK]; - int indx; - size_t jndx; - int type_size; - hid_t mem_space = -1; - void *region_buf = NULL; - int ret_value = SUCCEED; - h5tools_context_t ctx; - - assert(info); - assert(cur_ctx); - assert(buffer); - assert(ptdata); - - memset(&ctx, 0, sizeof(ctx)); - /* Allocate space for the dimension array */ - if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); - - dims1[0] = npoints; - - /* Create dataspace for reading buffer */ - if((mem_space = H5Screate_simple(1, dims1, NULL)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); - - if((type_size = H5Tget_size(type_id)) == 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - if((region_buf = HDmalloc(type_size * npoints)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region"); - - curr_pos = 0; - ctx.indent_level = cur_ctx->indent_level; - ctx.cur_column = cur_ctx->cur_column; - ctx.prev_multiline = cur_ctx->prev_multiline; - ctx.ndims = ndims; - - if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); - - elmtno = 0; - for (jndx = 0; jndx < npoints; jndx++, elmtno++) { - ctx.need_prefix = TRUE; - ctx.cur_elmt = 0; /* points are always 0 */ - - ctx.indent_level++; - if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - - /* assume entire data space to be printed */ - for (indx = 0; indx < (size_t) ctx.ndims; indx++) - ctx.p_min_idx[indx] = 0; - init_acc_pos(&ctx, total_size); - - /* print the data */ - region_flags = START_OF_DATA; - if (jndx == npoints - 1) - region_flags |= END_OF_DATA; - - for (indx = 0; indx < (size_t)ctx.ndims; indx++) - ctx.p_max_idx[indx] = cur_ctx->p_max_idx[indx]; - - ctx.sm_pos = jndx * ndims; - if (ctx.ndims > 0) { - ctx.size_last_dim = (int) (ctx.p_max_idx[ctx.ndims - 1]); - } - else - ctx.size_last_dim = 0; - - curr_pos = 0; /* points requires constant 0 */ - h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0); - - /* Render the point element begin */ - h5tools_str_reset(buffer); - - h5tools_str_append(buffer, "%s", jndx ? OPTIONAL_LINE_BREAK "" : ""); - h5tools_str_sprint(buffer, info, region_id, type_id, - ((char*)region_buf + jndx * type_size), &ctx); - - if (jndx + 1 < npoints || (region_flags & END_OF_DATA) == 0) - h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ",")); - - dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, - ncols, ptdata, (hsize_t)0, elmtno); - /* Render the point element end */ - if(FALSE == dimension_break) - elmtno = 0; - - ctx.indent_level--; - } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */ - - done: - HDfree(region_buf); - HDfree(dims1); - - if(H5Sclose(mem_space) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: Print some values from a dataset referenced by region points. - * - * Description: - * This is a special case subfunction to dump a region reference using points. - * - * Return: - * The function returns False if the last dimension has been reached, otherwise True - * - * In/Out: - * h5tools_context_t *ctx - * hsize_t *curr_pos - * - * Parameters Description: - * h5tools_str_t *buffer is the string into which to render - * hsize_t curr_pos is the total data element position - * size_t ncols - * hsize_t region_elmt_counter is the region element loop counter - * hsize_t elmt_count is the data element loop counter - *------------------------------------------------------------------------- - */ -hbool_t -h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, - FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, - h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, - hsize_t elmt_counter) { - HERR_INIT(hbool_t, TRUE) - hbool_t dimension_break = TRUE; - hssize_t npoints; - hsize_t alloc_size; - hsize_t *ptdata; - int ndims; - hssize_t indx; - hid_t dtype; - hid_t type_id; - - assert(info); - assert(ctx); - assert(buffer); - - if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); - - /* Allocate space for the dimension array */ - if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); - - /* Render the region { element begin */ - h5tools_str_reset(buffer); - - h5tools_str_append(buffer, "{"); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the region { element end */ - - /* Render the region datatype info and indices element begin */ - h5tools_str_reset(buffer); - - ctx->indent_level++; - ctx->need_prefix = TRUE; - h5tools_str_append(buffer, "REGION_TYPE POINT "); - - alloc_size = npoints * ndims * sizeof(ptdata[0]); - assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ - if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); - - H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t); - if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_pointlist failed"); - - for (indx = 0; indx < npoints; indx++) { - int loop_indx; - - h5tools_str_append(buffer, info->dset_ptformat_pre, - indx ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long) indx); - - for (loop_indx = 0; loop_indx < ndims; loop_indx++) - h5tools_str_append(buffer, "%s%lu", loop_indx ? "," : "(", - (unsigned long) (ptdata[indx * ndims + loop_indx])); - - h5tools_str_append(buffer, ")"); - } /* end for (indx = 0; indx < npoints; indx++) */ - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the region datatype info and indices element end */ - - ctx->need_prefix = TRUE; - - if((dtype = H5Dget_type(region_id)) < 0) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); - - if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); - - /* Render the datatype element begin */ - h5tools_str_reset(buffer); - h5tools_str_append(buffer, "%s %s ", - h5tools_dump_header_format->datatypebegin, - h5tools_dump_header_format->datatypeblockbegin); - - h5tools_print_datatype(buffer, info, ctx, dtype); - - if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeblockend); - if (HDstrlen(h5tools_dump_header_format->datatypeend)) - h5tools_str_append(buffer, " "); - } - if (HDstrlen(h5tools_dump_header_format->datatypeend)) - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend); - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the datatype element end */ - - ctx->need_prefix = TRUE; - - /* Render the dataspace element begin */ - h5tools_str_reset(buffer); - - ctx->need_prefix = TRUE; - h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin); - - h5tools_print_dataspace(buffer, region_space); - - if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) - h5tools_str_append(buffer, " "); - } - if (HDstrlen(h5tools_dump_header_format->dataspaceend)) - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the dataspace element end */ - - ctx->need_prefix = TRUE; - - /* Render the databegin element begin */ - h5tools_str_reset(buffer); - - h5tools_str_append(buffer, "%s %s ", - h5tools_dump_header_format->databegin, - h5tools_dump_header_format->datablockbegin); - - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); - /* Render the databegin element end */ - - ctx->need_prefix = TRUE; - - h5tools_print_region_data_points(region_space, region_id, - rawdatastream, info, ctx, buffer, ncols, ndims, type_id, npoints, ptdata); - - done: - free(ptdata); - - if(H5Tclose(type_id) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - if(H5Tclose(dtype) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - ctx->need_prefix = TRUE; - - /* Render the dataend element begin */ - h5tools_str_reset(buffer); - h5tools_str_append(buffer, "%s %s ", - h5tools_dump_header_format->dataend, - h5tools_dump_header_format->datablockend); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, - ncols, region_elmt_counter, elmt_counter); - /* Render the dataend element end*/ - - ctx->indent_level--; - ctx->need_prefix = TRUE; - - /* Render the region } element begin */ - h5tools_str_reset(buffer); - h5tools_str_append(buffer, "}"); - dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, - ncols, region_elmt_counter, elmt_counter); - /* Render the region } element end */ - - H5_LEAVE(dimension_break) -CATCH - return ret_value; -} - -/*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: print out the data for a subset of a dataset. - * Description: - * - * Select a hyperslab from the dataset DSET using the parameters - * specified in SSET. Dump this out to STREAM. - * - * Hyperslabs select "count" blocks of size "block", spaced "stride" elements - * from each other, starting at coordinate "start". - * - * Return: - * On success, return SUCCEED. Otherwise, the function returns FAIL. - * - * Algorithm - * - * The parameters from SSET are translated into temporary - * variables so that 1 row is printed at a time (getting the coordinate indices - * at each row). - * We define the stride, count and block to be 1 in the row dimension to achieve - * this and advance until all points are printed. - * - * The element position is obtained from the matrix according to: - * Given an index I(z,y,x) its position from the beginning of an array - * of sizes A(size_z, size_y,size_x) is given by - * Position of I(z,y,x) = index_z * size_y * size_x - * + index_y * size_x - * + index_x - * - *------------------------------------------------------------------------- - */ -static herr_t -h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, - hid_t dset, hid_t p_type, struct subset_t *sset, - hid_t f_space, hsize_t hyperslab_count, - hsize_t *temp_start,/* start inside offset count loop */ - hsize_t *temp_count,/* count inside offset count loop */ - hsize_t *temp_block,/* block size used in loop */ - hsize_t *temp_stride,/* stride size used in loop */ - hsize_t *total_size,/* total size of dataset */ - unsigned int row_dim/* index of row_counter dimension */) -{ - HERR_INIT(herr_t, SUCCEED) - size_t i; /* counters */ - size_t j; /* counters */ - hsize_t zero[1] = {0}; /* vector of zeros */ - unsigned int flags; /* buffer extent flags */ - hsize_t elmtno; /* elemnt index */ - hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */ - hsize_t high[H5S_MAX_RANK]; /* higher bound of hyperslab */ - size_t p_type_nbytes; /* size of memory type */ - hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ - hsize_t sm_nbytes; /* bytes per stripmine */ - hssize_t ssm_nelmts; /* elements per stripmine*/ - hsize_t sm_nelmts; /* elements per stripmine*/ - unsigned char *sm_buf = NULL; /* buffer for raw data */ - hid_t sm_space = -1; /* stripmine data space */ - hsize_t size_row_block; /* size for blocks along rows */ - hsize_t row_counter = 0; - - /* VL data special information */ - unsigned int vl_data = 0; /* contains VL datatypes */ - - if ((size_t) ctx->ndims > NELMTS(sm_size)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed"); - - if (ctx->ndims > 0) - init_acc_pos(ctx, total_size); - - size_row_block = sset->block.data[row_dim]; - - /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) - vl_data = TRUE; - - /* display loop */ - for (; hyperslab_count > 0; temp_start[row_dim] += temp_stride[row_dim], hyperslab_count--) { - /* jump rows if size of block exceeded - cases where block > 1 only and stride > block */ - if (size_row_block > 1 - && row_counter == size_row_block - && sset->stride.data[row_dim] > sset->block.data[row_dim]) { - - hsize_t increase_rows = sset->stride.data[row_dim] - sset->block.data[row_dim]; - temp_start[row_dim] += increase_rows; - row_counter = 0; - } - - row_counter++; - - /* calculate the potential number of elements we're going to print */ - if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - - if((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); - sm_nelmts = (hsize_t)ssm_nelmts; - - if (sm_nelmts > 0) { - /* - * determine the strip mine size and allocate a buffer. the strip mine is - * a hyperslab whose size is manageable. - */ - if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - if (ctx->ndims > 0) - for (i = ctx->ndims; i > 0; --i) { - hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; - if (size == 0) /* datum size > H5TOOLS_BUFSIZE */ - size = 1; - sm_size[i - 1] = MIN(total_size[i - 1], size); - sm_nbytes *= sm_size[i - 1]; - assert(sm_nbytes > 0); - } - - assert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ - if(NULL == (sm_buf = (unsigned char *)HDmalloc((size_t) sm_nelmts * p_type_nbytes))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); - - if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); - - if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - - /* read the data */ - if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); - - /* print the data */ - flags = START_OF_DATA; - - if (hyperslab_count == 1) - flags |= END_OF_DATA; - - for (i = 0; i < ctx->ndims; i++) - ctx->p_max_idx[i] = ctx->p_min_idx[i] + MIN(total_size[i], sm_size[i]); - - /* print array indices. get the lower bound of the hyperslab and calulate - the element position at the start of hyperslab */ - if(H5Sget_select_bounds(f_space, low, high) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); - - elmtno = 0; - for (i = 0; i < (size_t) ctx->ndims - 1; i++) { - hsize_t offset = 1; /* accumulation of the previous dimensions */ - for (j = i + 1; j < (size_t) ctx->ndims; j++) - offset *= total_size[j]; - elmtno += low[i] * offset; - } - elmtno += low[ctx->ndims - 1]; - - /* initialize the current stripmine position; this is necessary to print the array - indices */ - ctx->sm_pos = elmtno; - - h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf); - - /* Reclaim any VL memory, if necessary */ - if (vl_data) - H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); - - if(H5Sclose(sm_space) < 0) - H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - if(sm_buf) - HDfree(sm_buf); - sm_buf = NULL; - } - else - H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print"); - /* we need to jump to next line and update the index */ - ctx->need_prefix = 1; - - ctx->continuation++; - - } /* hyperslab_count loop */ - -CATCH - if(sm_buf) - HDfree(sm_buf); - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: print out the data for a subset of a dataset. - * Description: - * - * Select a hyperslab from the dataset DSET using the parameters - * specified in SSET. Dump this out to STREAM. - * - * Hyperslabs select "count" blocks of size "block", spaced "stride" elements - * from each other, starting at coordinate "start". - * - * Return: - * On success, return SUCCEED. Otherwise, the function returns FAIL. - * - * Algorithm - * - * The parameters from SSET are translated into temporary - * variables so that 1 row is printed at a time (getting the coordinate indices - * at each row). - * We define the stride, count and block to be 1 in the row dimension to achieve - * this and advance until all points are printed. - * - * The element position is obtained from the matrix according to: - * Given an index I(z,y,x) its position from the beginning of an array - * of sizes A(size_z, size_y,size_x) is given by - * Position of I(z,y,x) = index_z * size_y * size_x - * + index_y * size_x - * + index_x - * - *------------------------------------------------------------------------- - */ -static herr_t -h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, - hid_t dset, hid_t p_type, struct subset_t *sset, - hid_t f_space, hsize_t *total_size) -{ - size_t i; /* counters */ - hsize_t n; /* counters */ - hsize_t count; /* hyperslab count */ - hsize_t outer_count; /* offset count */ - unsigned int row_dim; /* index of row_counter dimension */ - int current_outer_dim; /* dimension for start */ - hsize_t temp_start[H5S_MAX_RANK];/* temporary start inside offset count loop */ - hsize_t max_start[H5S_MAX_RANK]; /* maximum start inside offset count loop */ - hsize_t temp_count[H5S_MAX_RANK];/* temporary count inside offset count loop */ - hsize_t temp_block[H5S_MAX_RANK];/* temporary block size used in loop */ - hsize_t temp_stride[H5S_MAX_RANK];/* temporary stride size used in loop */ - int reset_dim; - herr_t ret_value = SUCCEED; - - if (ctx->ndims == 1) - row_dim = 0; - else - row_dim = ctx->ndims - 2; - - /* get the offset count */ - outer_count = 1; - if (ctx->ndims > 2) - for (i = 0; i < (size_t) ctx->ndims - 2; i++) { - /* consider block size */ - outer_count = outer_count * sset->count.data[i] * sset->block.data[i]; - - } - - /* initialize temporary start, count and maximum start */ - for (i = 0; i < (size_t) ctx->ndims; i++) { - temp_start[i] = sset->start.data[i]; - temp_count[i] = sset->count.data[i]; - temp_block[i] = sset->block.data[i]; - temp_stride[i] = sset->stride.data[i]; - max_start[i] = 0; - } - - if (ctx->ndims > 2) { - for (i = 0; i < (size_t) ctx->ndims - 2; i++) { - max_start[i] = temp_start[i] + sset->count.data[i]; - temp_count[i] = 1; - - } - } - - /* offset loop */ - for (n = 0; n < outer_count; n++) { - /* number of read iterations in inner loop, read by rows, to match 2D display */ - if (ctx->ndims > 1) { - - /* count is the number of iterations to display all the rows, - the block size count times */ - count = sset->count.data[row_dim] * sset->block.data[row_dim]; - - /* always 1 row_counter at a time, that is a block of size 1, 1 time */ - temp_count[row_dim] = 1; - temp_block[row_dim] = 1; - - /* advance 1 row_counter at a time */ - if (sset->block.data[row_dim] > 1) - temp_stride[row_dim] = 1; - - } - /* for the 1D case */ - else { - count = 1; - } - - h5tools_print_simple_subset(stream, info, ctx, dset, p_type, sset, - f_space, count, temp_start, temp_count, - temp_block, temp_stride, total_size, row_dim); - - if (ctx->ndims > 2) { - /* dimension for start */ - current_outer_dim = (ctx->ndims - 2) - 1; - - /* set start to original from current_outer_dim up */ - for (i = current_outer_dim + 1; i < ctx->ndims; i++) { - temp_start[i] = sset->start.data[i]; - } - - /* increment start dimension */ - do { - reset_dim = 0; - temp_start[current_outer_dim]++; - if (temp_start[current_outer_dim] >= max_start[current_outer_dim]) { - temp_start[current_outer_dim] = sset->start.data[current_outer_dim]; - - /* consider block */ - if (sset->block.data[current_outer_dim] > 1) - temp_start[current_outer_dim]++; - - current_outer_dim--; - reset_dim = 1; - } - } while (current_outer_dim >= 0 && reset_dim); - - } /* ctx.ndims > 1 */ - - } /* outer_count */ - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: Dump out a subset of a dataset. - * Description: - * - * Select a hyperslab from the dataset DSET using the parameters - * specified in SSET. Dump this out to STREAM. - * - * Hyperslabs select "count" blocks of size "block", spaced "stride" elements - * from each other, starting at coordinate "start". - * - * Return: - * On success, return SUCCEED. Otherwise, the function returns FAIL. - * - * Original programmer: - * Bill Wendling, Wednesday, March 07, 2001 - * - * Rewritten with modified algorithm by: - * Pedro Vicente, Wednesday, January 16, 2008, contributions from Quincey Koziol - * - * Algorithm - * - * In a inner loop, the parameters from SSET are translated into temporary - * variables so that 1 row is printed at a time (getting the coordinate indices - * at each row). - * We define the stride, count and block to be 1 in the row dimension to achieve - * this and advance until all points are printed. - * An outer loop for cases where dimensionality is greater than 2D is made. - * In each iteration, the 2D block is displayed in the inner loop. The remaining - * slower dimensions above the first 2 are incremented one at a time in the outer loop - * - * The element position is obtained from the matrix according to: - * Given an index I(z,y,x) its position from the beginning of an array - * of sizes A(size_z, size_y,size_x) is given by - * Position of I(z,y,x) = index_z * size_y * size_x - * + index_y * size_x - * + index_x - * - *------------------------------------------------------------------------- - */ -static herr_t -h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset, - hid_t p_type, struct subset_t *sset, int indentlevel) -{ - HERR_INIT(herr_t, SUCCEED) - int sndims; - hid_t f_space = -1; /* file data space */ - size_t i; /* counters */ - hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ - h5tools_context_t ctx; /* print context */ - - if((f_space = H5Dget_space(dset)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); - - /* - * check that everything looks okay. the dimensionality must not be too - * great and the dimensionality of the items selected for printing must - * match the dimensionality of the dataset. - */ - memset(&ctx, 0, sizeof(ctx)); - ctx.indent_level = indentlevel; - ctx.need_prefix = 1; - if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); - ctx.ndims = (unsigned)sndims; - - /* assume entire data space to be printed */ - if (ctx.ndims > 0) - for (i = 0; i < (size_t) ctx.ndims; i++) - ctx.p_min_idx[i] = 0; - - if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - ctx.size_last_dim = total_size[ctx.ndims - 1]; - - h5tools_display_simple_subset(stream, info, &ctx, dset, p_type, sset, f_space, total_size); - - /* Terminate the output */ - if (ctx.cur_column) { - fputs(OPT(info->line_suf, ""), stdout); - putc('\n', stdout); - fputs(OPT(info->line_sep, ""), stdout); - } - -CATCH - if(f_space >= 0 && H5Sclose(f_space) < 0) - H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Audience: Public - * Chapter: H5Tools Library - * Purpose: Print some values from a dataset with a simple data space. - * Description: - * This is a special case of h5tools_dump_dset(). This function only - * intended for dumping datasets -- it does strip mining and some other - * things which are unnecessary for smaller objects such as attributes - * (to print small objects like attributes simply read the attribute and - * call h5tools_dump_simple_mem()). - * Return: - * On success, the function returns SUCCEED. Otherwise, the function - * returns FAIL. - *------------------------------------------------------------------------- - */ -static int -h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, - hid_t dset, hid_t p_type, int indentlevel) -{ - hid_t f_space; /* file data space */ - hsize_t elmtno; /* counter */ - size_t i; /* counter */ - int carry; /* counter carry value */ - hsize_t zero[8]; /* vector of zeros */ - unsigned int flags; /* buffer extent flags */ - hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ - - /* Print info */ - h5tools_context_t ctx; /* print context */ - size_t p_type_nbytes; /* size of memory type */ - hsize_t p_nelmts; /* total selected elmts */ - - /* Stripmine info */ - hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ - hsize_t sm_nbytes; /* bytes per stripmine */ - hsize_t sm_nelmts; /* elements per stripmine*/ - unsigned char *sm_buf = NULL; /* buffer for raw data */ - hid_t sm_space; /* stripmine data space */ - - /* Hyperslab info */ - hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */ - hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */ - hsize_t hs_nelmts; /* elements in request */ - - /* VL data special information */ - unsigned int vl_data = 0; /* contains VL datatypes */ - - f_space = H5Dget_space(dset); - - if (f_space == FAIL) - return FAIL; - - /* - * Check that everything looks okay. The dimensionality must not be too - * great and the dimensionality of the items selected for printing must - * match the dimensionality of the dataset. - */ - memset(&ctx, 0, sizeof(ctx)); - ctx.ndims = H5Sget_simple_extent_ndims(f_space); - - if ((size_t)ctx.ndims > NELMTS(sm_size)) { - H5Sclose(f_space); - return FAIL; - } - - ctx.indent_level = indentlevel; - ctx.need_prefix = 1; - - /* Assume entire data space to be printed */ - if (ctx.ndims > 0) - for (i = 0; i < (size_t)ctx.ndims; i++) - ctx.p_min_idx[i] = 0; - - H5Sget_simple_extent_dims(f_space, total_size, NULL); - - /* calculate the number of elements we're going to print */ - p_nelmts = 1; - - if (ctx.ndims > 0) { - for (i = 0; i < ctx.ndims; i++) - p_nelmts *= total_size[i]; - ctx.size_last_dim = (total_size[ctx.ndims - 1]); - } /* end if */ - else - ctx.size_last_dim = 0; - - if (p_nelmts == 0) { - /* nothing to print */ - H5Sclose(f_space); - return SUCCEED; - } - - /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) - vl_data = TRUE; - - /* - * Determine the strip mine size and allocate a buffer. The strip mine is - * a hyperslab whose size is manageable. - */ - sm_nbytes = p_type_nbytes = H5Tget_size(p_type); - - if (ctx.ndims > 0) { - for (i = ctx.ndims; i > 0; --i) { - hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; - if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ - size = 1; - sm_size[i - 1] = MIN(total_size[i - 1], size); - sm_nbytes *= sm_size[i - 1]; - assert(sm_nbytes > 0); - } - } - - if(!sm_nbytes) - goto done; - - assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ - sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes); - - sm_nelmts = sm_nbytes / p_type_nbytes; - sm_space = H5Screate_simple(1, &sm_nelmts, NULL); - - if (ctx.ndims > 0) - init_acc_pos(&ctx, total_size); - - /* The stripmine loop */ - memset(hs_offset, 0, sizeof hs_offset); - memset(zero, 0, sizeof zero); - - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { - /* Calculate the hyperslab size */ - if (ctx.ndims > 0) { - for (i = 0, hs_nelmts = 1; i < ctx.ndims; i++) { - hs_size[i] = MIN(total_size[i] - hs_offset[i], sm_size[i]); - ctx.p_max_idx[i] = ctx.p_min_idx[i] + hs_size[i]; - hs_nelmts *= hs_size[i]; - } - - H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL); - H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL); - } - else { - H5Sselect_all(f_space); - H5Sselect_all(sm_space); - hs_nelmts = 1; - } - - /* Read the data */ - if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) { - H5Sclose(f_space); - H5Sclose(sm_space); - free(sm_buf); - return FAIL; - } - - /* Print the data */ - flags = (elmtno == 0) ? START_OF_DATA : 0; - flags |= ((elmtno + hs_nelmts) >= p_nelmts) ? END_OF_DATA : 0; - - /* initialize the current stripmine position; this is necessary to print the array - indices */ - ctx.sm_pos = elmtno; - - h5tools_dump_simple_data(stream, info, dset, &ctx, flags, hs_nelmts, p_type, sm_buf); - - /* Reclaim any VL memory, if necessary */ - if (vl_data) - H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); - - /* Calculate the next hyperslab offset */ - for (i = ctx.ndims, carry = 1; i > 0 && carry; --i) { - ctx.p_min_idx[i - 1] = ctx.p_max_idx[i - 1]; - hs_offset[i - 1] += hs_size[i - 1]; - - if (hs_offset[i - 1] == total_size[i - 1]) - hs_offset[i - 1] = 0; - else - carry = 0; - } - - ctx.continuation++; - } - - /* Terminate the output */ - if (ctx.cur_column) { - fputs(OPT(info->line_suf, ""), stream); - putc('\n', stream); - fputs(OPT(info->line_sep, ""), stream); - } - - HDfree(sm_buf); - -done: - H5Sclose(sm_space); - H5Sclose(f_space); - - return SUCCEED; -} - -/*------------------------------------------------------------------------- - * Function: h5tools_dump_simple_mem - * - * Purpose: Print some values from memory with a simple data space. - * This is a special case of h5tools_dump_mem(). - * - * Return: Success: SUCCEED - * Failure: FAIL - * - *------------------------------------------------------------------------- - */ -static int -h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, - hid_t type, hid_t space, void *mem, int indentlevel) -{ - int i; /*counters */ - hsize_t nelmts; /*total selected elmts */ - h5tools_context_t ctx; /*printing context */ - - /* - * Check that everything looks okay. The dimensionality must not be too - * great and the dimensionality of the items selected for printing must - * match the dimensionality of the dataset. - */ - memset(&ctx, 0, sizeof(ctx)); - ctx.ndims = H5Sget_simple_extent_ndims(space); - - if ((size_t) ctx.ndims > NELMTS(ctx.p_min_idx)) - return FAIL; - - ctx.indent_level = indentlevel; - ctx.need_prefix = 1; - - /* Assume entire data space to be printed */ - for (i = 0; i < ctx.ndims; i++) - ctx.p_min_idx[i] = 0; - - H5Sget_simple_extent_dims(space, ctx.p_max_idx, NULL); - - for (i = 0, nelmts = 1; ctx.ndims != 0 && i < ctx.ndims; i++) - nelmts *= ctx.p_max_idx[i] - ctx.p_min_idx[i]; - - if (nelmts == 0) - return SUCCEED; /*nothing to print*/ - if (ctx.ndims > 0) { - assert(ctx.p_max_idx[ctx.ndims - 1] == (hsize_t) ((int) ctx.p_max_idx[ctx.ndims - 1])); - ctx.size_last_dim = (int) (ctx.p_max_idx[ctx.ndims - 1]); - } /* end if */ - else - ctx.size_last_dim = 0; - - if (ctx.ndims > 0) - init_acc_pos(&ctx, ctx.p_max_idx); - - /* Print it */ - h5tools_dump_simple_data(stream, info, obj_id, &ctx, START_OF_DATA | END_OF_DATA, nelmts, type, mem); - - /* Terminate the output */ - if (ctx.cur_column) { - fputs(OPT(info->line_suf, ""), stream); - putc('\n', stream); - fputs(OPT(info->line_sep, ""), stream); - } - - return SUCCEED; -} - -/*------------------------------------------------------------------------- - * Function: h5tools_dump_dset - * - * Purpose: Print some values from a dataset DSET to the file STREAM - * after converting all types to P_TYPE (which should be a - * native type). If P_TYPE is a negative value then it will be - * computed from the dataset type using only native types. - * - * Note: This function is intended only for datasets since it does - * some things like strip mining which are unnecessary for - * smaller objects such as attributes. The easiest way to print - * small objects is to read the object into memory and call - * h5tools_dump_mem(). - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Modifications: - * Robb Matzke, 1999-06-07 - * If info->raw is set then the memory datatype will be the same - * as the file datatype. - * - * Bill Wendling, 2001-02-27 - * Renamed to ``h5tools_dump_dset'' and added the subsetting - * parameter. - * - *------------------------------------------------------------------------- - */ -int -h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, - hid_t _p_type, struct subset_t *sset, int indentlevel) -{ - hid_t f_space; - hid_t p_type = _p_type; - hid_t f_type; - H5S_class_t space_type; - int status = FAIL; - h5tool_format_t info_dflt; - /* Use default values */ - if (!stream) - stream = stdout; - - if (!info) { - memset(&info_dflt, 0, sizeof info_dflt); - info = &info_dflt; - } - - if (p_type < 0) { - f_type = H5Dget_type(dset); - - if (info->raw || bin_form == 1) - p_type = H5Tcopy(f_type); - else if (bin_form == 2) - p_type = h5tools_get_little_endian_type(f_type); - else if (bin_form == 3) - p_type = h5tools_get_big_endian_type(f_type); - else - p_type = h5tools_get_native_type(f_type); - - H5Tclose(f_type); - - if (p_type < 0) - goto done; - } - - /* Check the data space */ - f_space = H5Dget_space(dset); - - space_type = H5Sget_simple_extent_type(f_space); - - /* Print the data */ - if (space_type == H5S_SIMPLE || space_type == H5S_SCALAR) { - if(!sset) - status = h5tools_dump_simple_dset(rawdatastream, info, dset, p_type, indentlevel); - else - status = h5tools_dump_simple_subset(rawdatastream, info, dset, p_type, sset, indentlevel); - } - else - /* space is H5S_NULL */ - status = SUCCEED; - - /* Close the dataspace */ - H5Sclose(f_space); - -done: - if (p_type != _p_type) - H5Tclose(p_type); - - return status; -} - -/*------------------------------------------------------------------------- - * Function: h5tools_dump_mem - * - * Purpose: Displays the data contained in MEM. MEM must have the - * specified data TYPE and SPACE. Currently only simple data - * spaces are allowed and only the `all' selection. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - *------------------------------------------------------------------------- - */ -int -h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, hid_t type, - hid_t space, void *mem, int indentlevel) -{ - HERR_INIT(int, SUCCEED) - h5tool_format_t info_dflt; - - /* Use default values */ - if (!stream) - stream = stdout; - - if (!info) { - memset(&info_dflt, 0, sizeof(info_dflt)); - info = &info_dflt; - } - - /* Check the data space */ - if (H5Sis_simple(space) <= 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sis_simple failed") - - H5_LEAVE(h5tools_dump_simple_mem(stream, info, obj_id, type, space, mem, indentlevel)) - -CATCH - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: print_datatype - * - * Purpose: print the datatype. - * - * Return: void - * - * In/Out: h5tools_str_t *buffer - * h5tools_context_t *ctx - * - *------------------------------------------------------------------------- - */ -int -h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info, - h5tools_context_t *ctx, hid_t type) -{ - HERR_INIT(int, SUCCEED) - char *mname; - hid_t mtype, str_type; - int snmembers; - unsigned nmembers; - int sndims; - unsigned i; - size_t size = 0; - hsize_t dims[H5TOOLS_DUMP_MAX_RANK]; - H5T_str_t str_pad; - H5T_cset_t cset; - H5T_order_t order; - H5T_class_t type_class; - hid_t super; - hid_t tmp_type; - htri_t is_vlstr = FALSE; - const char *order_s = NULL; /* byte order string */ - H5T_sign_t sign; /* sign scheme value */ - const char *sign_s = NULL; /* sign scheme string */ - - if((type_class = H5Tget_class(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed"); - switch (type_class) { - case H5T_INTEGER: - if (H5Tequal(type, H5T_STD_I8BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I8BE"); - } - else if (H5Tequal(type, H5T_STD_I8LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I8LE"); - } - else if (H5Tequal(type, H5T_STD_I16BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I16BE"); - } - else if (H5Tequal(type, H5T_STD_I16LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I16LE"); - } - else if (H5Tequal(type, H5T_STD_I32BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I32BE"); - } - else if (H5Tequal(type, H5T_STD_I32LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I32LE"); - } - else if (H5Tequal(type, H5T_STD_I64BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I64BE"); - } - else if (H5Tequal(type, H5T_STD_I64LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_I64LE"); - } - else if (H5Tequal(type, H5T_STD_U8BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U8BE"); - } - else if (H5Tequal(type, H5T_STD_U8LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U8LE"); - } - else if (H5Tequal(type, H5T_STD_U16BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U16BE"); - } - else if (H5Tequal(type, H5T_STD_U16LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U16LE"); - } - else if (H5Tequal(type, H5T_STD_U32BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U32BE"); - } - else if (H5Tequal(type, H5T_STD_U32LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U32LE"); - } - else if (H5Tequal(type, H5T_STD_U64BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U64BE"); - } - else if (H5Tequal(type, H5T_STD_U64LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_U64LE"); - } - else if (H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_SCHAR"); - } - else if (H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_UCHAR"); - } - else if (H5Tequal(type, H5T_NATIVE_SHORT) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_SHORT"); - } - else if (H5Tequal(type, H5T_NATIVE_USHORT) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_USHORT"); - } - else if (H5Tequal(type, H5T_NATIVE_INT) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_INT"); - } - else if (H5Tequal(type, H5T_NATIVE_UINT) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_UINT"); - } - else if (H5Tequal(type, H5T_NATIVE_LONG) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_LONG"); - } - else if (H5Tequal(type, H5T_NATIVE_ULONG) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_ULONG"); - } - else if (H5Tequal(type, H5T_NATIVE_LLONG) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_LLONG"); - } - else if (H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_ULLONG"); - } - else { - - /* byte order */ - if (H5Tget_size(type) > 1) { - order = H5Tget_order(type); - if (H5T_ORDER_LE == order) { - order_s = " little-endian"; - } - else if (H5T_ORDER_BE == order) { - order_s = " big-endian"; - } - else if (H5T_ORDER_VAX == order) { - order_s = " mixed-endian"; - } - else { - order_s = " unknown-byte-order"; - } - } - else { - order_s = ""; - } - - /* sign */ - if ((sign = H5Tget_sign(type)) >= 0) { - if (H5T_SGN_NONE == sign) { - sign_s = " unsigned"; - } - else if (H5T_SGN_2 == sign) { - sign_s = ""; - } - else { - sign_s = " unknown-sign"; - } - } - else { - sign_s = " unknown-sign"; - } - - /* print size, order, and sign */ - h5tools_str_append(buffer, "%lu-bit%s%s integer", - (unsigned long) (8 * H5Tget_size(type)), order_s, sign_s); - } - break; - - case H5T_FLOAT: - if (H5Tequal(type, H5T_IEEE_F32BE) == TRUE) { - h5tools_str_append(buffer, "H5T_IEEE_F32BE"); - } - else if (H5Tequal(type, H5T_IEEE_F32LE) == TRUE) { - h5tools_str_append(buffer, "H5T_IEEE_F32LE"); - } - else if (H5Tequal(type, H5T_IEEE_F64BE) == TRUE) { - h5tools_str_append(buffer, "H5T_IEEE_F64BE"); - } - else if (H5Tequal(type, H5T_IEEE_F64LE) == TRUE) { - h5tools_str_append(buffer, "H5T_IEEE_F64LE"); - } - else if (H5Tequal(type, H5T_VAX_F32) == TRUE) { - h5tools_str_append(buffer, "H5T_VAX_F32"); - } - else if (H5Tequal(type, H5T_VAX_F64) == TRUE) { - h5tools_str_append(buffer, "H5T_VAX_F64"); - } - else if (H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_FLOAT"); - } - else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_DOUBLE"); -#if H5_SIZEOF_LONG_DOUBLE !=0 - } - else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) { - h5tools_str_append(buffer, "H5T_NATIVE_LDOUBLE"); -#endif - } - else { - - /* byte order */ - if (H5Tget_size(type) > 1) { - order = H5Tget_order(type); - if (H5T_ORDER_LE == order) { - order_s = " little-endian"; - } - else if (H5T_ORDER_BE == order) { - order_s = " big-endian"; - } - else if (H5T_ORDER_VAX == order) { - order_s = " mixed-endian"; - } - else { - order_s = " unknown-byte-order"; - } - } - else { - order_s = ""; - } - - /* print size and byte order */ - h5tools_str_append(buffer, "%lu-bit%s floating-point", - (unsigned long) (8 * H5Tget_size(type)), order_s); - - } - break; - - case H5T_TIME: - h5tools_str_append(buffer, "H5T_TIME: not yet implemented"); - break; - - case H5T_STRING: - /* Make a copy of type in memory in case when TYPE is on disk, the size - * will be bigger than in memory. This makes it easier to compare - * types in memory. */ - tmp_type = H5Tcopy(type); - size = H5Tget_size(tmp_type); - str_pad = H5Tget_strpad(tmp_type); - cset = H5Tget_cset(tmp_type); - is_vlstr = H5Tis_variable_str(tmp_type); - - h5tools_str_append(buffer, "H5T_STRING %s\n", h5tools_dump_header_format->strblockbegin); - ctx->indent_level++; - - if (is_vlstr) - h5tools_str_append(buffer, "%s H5T_VARIABLE;\n", STRSIZE); - else - h5tools_str_append(buffer, "%s %d;\n", STRSIZE, (int) size); - - h5tools_str_append(buffer, "%s ", STRPAD); - if (str_pad == H5T_STR_NULLTERM) - h5tools_str_append(buffer, "H5T_STR_NULLTERM;\n"); - else if (str_pad == H5T_STR_NULLPAD) - h5tools_str_append(buffer, "H5T_STR_NULLPAD;\n"); - else if (str_pad == H5T_STR_SPACEPAD) - h5tools_str_append(buffer, "H5T_STR_SPACEPAD;\n"); - else - h5tools_str_append(buffer, "H5T_STR_ERROR;\n"); - - h5tools_str_append(buffer, "%s ", CSET); - - if (cset == H5T_CSET_ASCII) - h5tools_str_append(buffer, "H5T_CSET_ASCII;\n"); - else - h5tools_str_append(buffer, "unknown_cset;\n"); - - str_type = H5Tcopy(H5T_C_S1); - if (is_vlstr) - H5Tset_size(str_type, H5T_VARIABLE); - else - H5Tset_size(str_type, size); - H5Tset_cset(str_type, cset); - H5Tset_strpad(str_type, str_pad); - - h5tools_str_append(buffer, "%s ", CTYPE); - - /* Check C variable-length string first. Are the two types equal? */ - if (H5Tequal(tmp_type, str_type)) { - h5tools_str_append(buffer, "H5T_C_S1;\n"); - goto done; - } - - /* Change the endianness and see if they're equal. */ - order = H5Tget_order(tmp_type); - if (order == H5T_ORDER_LE) - H5Tset_order(str_type, H5T_ORDER_LE); - else if (order == H5T_ORDER_BE) - H5Tset_order(str_type, H5T_ORDER_BE); - - if (H5Tequal(tmp_type, str_type)) { - h5tools_str_append(buffer, "H5T_C_S1;\n"); - goto done; - } - - /* If not equal to C variable-length string, check Fortran type. */ - if(H5Tclose(str_type) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - str_type = H5Tcopy(H5T_FORTRAN_S1); - - H5Tset_cset(str_type, cset); - H5Tset_size(str_type, size); - H5Tset_strpad(str_type, str_pad); - - /* Are the two types equal? */ - if (H5Tequal(tmp_type, str_type)) { - h5tools_str_append(buffer, "H5T_FORTRAN_S1;\n"); - goto done; - } - - /* Change the endianness and see if they're equal. */ - order = H5Tget_order(tmp_type); - if (order == H5T_ORDER_LE) - H5Tset_order(str_type, H5T_ORDER_LE); - else if (order == H5T_ORDER_BE) - H5Tset_order(str_type, H5T_ORDER_BE); - - if (H5Tequal(tmp_type, str_type)) { - h5tools_str_append(buffer, "H5T_FORTRAN_S1;\n"); - goto done; - } - - /* Type doesn't match any of above. */ - h5tools_str_append(buffer, "unknown_one_character_type;\n "); - - done: - if(H5Tclose(str_type) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - if(H5Tclose(tmp_type) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - ctx->indent_level--; - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->strblockend); - break; - - case H5T_BITFIELD: - if (H5Tequal(type, H5T_STD_B8BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B8BE"); - } - else if (H5Tequal(type, H5T_STD_B8LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B8LE"); - } - else if (H5Tequal(type, H5T_STD_B16BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B16BE"); - } - else if (H5Tequal(type, H5T_STD_B16LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B16LE"); - } - else if (H5Tequal(type, H5T_STD_B32BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B32BE"); - } - else if (H5Tequal(type, H5T_STD_B32LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B32LE"); - } - else if (H5Tequal(type, H5T_STD_B64BE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B64BE"); - } - else if (H5Tequal(type, H5T_STD_B64LE) == TRUE) { - h5tools_str_append(buffer, "H5T_STD_B64LE"); - } - else { - h5tools_str_append(buffer, "undefined bitfield"); - } - break; - - case H5T_OPAQUE: - h5tools_str_append(buffer, "\n"); - h5tools_str_append(buffer, "H5T_OPAQUE;\n"); - { - char *ttag = H5Tget_tag(type); - h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";\n", ttag); - if (ttag) - HDfree(ttag); - } - break; - - case H5T_COMPOUND: - if((snmembers = H5Tget_nmembers(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); - nmembers = (unsigned)snmembers; - - h5tools_str_append(buffer, "H5T_COMPOUND %s\n", h5tools_dump_header_format->structblockbegin); - - for (i = 0; i < nmembers; i++) { - mname = H5Tget_member_name(type, i); - if((mtype = H5Tget_member_type(type, i))>=0) { - if (H5Tget_class(mtype) == H5T_COMPOUND) - ctx->indent_level++; - - h5tools_print_datatype(buffer, info, ctx, mtype); - - if (H5Tget_class(mtype) == H5T_COMPOUND) - ctx->indent_level--; - - h5tools_str_append(buffer, " \"%s\";\n", mname); - if(H5Tclose(mtype) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - } - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_member_type failed"); - free(mname); - } - - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); - break; - - case H5T_REFERENCE: - h5tools_str_append(buffer, "H5T_REFERENCE"); - if(region_output) { - if (H5Tequal(type, H5T_STD_REF_DSETREG) == TRUE) { - h5tools_str_append(buffer, " { H5T_STD_REF_DSETREG }"); - } - else { - h5tools_str_append(buffer, " { H5T_STD_REF_OBJECT }"); - } - } - break; - - case H5T_ENUM: - if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); - - h5tools_str_append(buffer, "H5T_ENUM %s\n", h5tools_dump_header_format->enumblockbegin); - ctx->indent_level++; - - h5tools_print_datatype(buffer, info, ctx, super); - if(H5Tclose(super) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - h5tools_str_append(buffer, ";\n"); - h5tools_print_enum(buffer, type); - - ctx->indent_level--; - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->enumblockend); - - break; - - case H5T_VLEN: - if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); - - h5tools_str_append(buffer, "H5T_VLEN %s ", h5tools_dump_header_format->vlenblockbegin); - - h5tools_print_datatype(buffer, info, ctx, super); - if(H5Tclose(super) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - - h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend); - - break; - - case H5T_ARRAY: - h5tools_str_append(buffer, "H5T_ARRAY { "); - - /* Get array information */ - if((sndims = H5Tget_array_ndims(type)) >= 0) { - unsigned ndims = (unsigned)sndims; - - if(H5Tget_array_dims2(type, dims) >= 0) { - /* Print array dimensions */ - for (i = 0; i < ndims; i++) - h5tools_str_append(buffer, "[%d]", (int) dims[i]); - - h5tools_str_append(buffer, " "); - } - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_array_dims2 failed"); - } - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_array_ndims failed"); - - /* Get array base type */ - if((super = H5Tget_super(type)) >= 0) { - /* Print base type */ - h5tools_print_datatype(buffer, info, ctx, super); - /* Close array base type */ - if(H5Tclose(super) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); - } - else - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_super failed"); - - h5tools_str_append(buffer, " }"); - - break; - - default: - h5tools_str_append(buffer, "unknown datatype"); - break; - } - -CATCH - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: print_dataspace - * - * Purpose: print the dataspace. - * - * Return: void - * - * In/Out: h5tools_str_t *buffer - * h5tools_context_t *ctx - * - *------------------------------------------------------------------------- - */ -int -h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) -{ - HERR_INIT(int, SUCCEED) - hsize_t size[H5TOOLS_DUMP_MAX_RANK]; - hsize_t maxsize[H5TOOLS_DUMP_MAX_RANK]; - int ndims = -1; - H5S_class_t space_type = -1; - int i; - - if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - - if((space_type = H5Sget_simple_extent_type(space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed"); - - switch(space_type) { - case H5S_SCALAR: - /* scalar dataspace */ - h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedescriptionbegin, S_SCALAR); - break; - - case H5S_SIMPLE: - /* simple dataspace */ - h5tools_str_append(buffer, "%s %s { %s %" H5_PRINTF_LL_WIDTH "u", - h5tools_dump_header_format->dataspacedescriptionbegin, S_SIMPLE, - h5tools_dump_header_format->dataspacedimbegin, size[0]); - - for(i = 1; i < ndims; i++) - h5tools_str_append(buffer, ", %" H5_PRINTF_LL_WIDTH "u", size[i]); - - h5tools_str_append(buffer, " %s / ", h5tools_dump_header_format->dataspacedimend); - - if(maxsize[0] == H5S_UNLIMITED) - h5tools_str_append(buffer, "%s %s", - h5tools_dump_header_format->dataspacedimbegin, "H5S_UNLIMITED"); - else - h5tools_str_append(buffer, "%s %" H5_PRINTF_LL_WIDTH "u", - h5tools_dump_header_format->dataspacedimbegin, maxsize[0]); - - for(i = 1; i < ndims; i++) - if(maxsize[i] == H5S_UNLIMITED) - h5tools_str_append(buffer, ", %s", "H5S_UNLIMITED"); - else - h5tools_str_append(buffer, ", %" H5_PRINTF_LL_WIDTH "u", maxsize[i]); - - h5tools_str_append(buffer, " %s }", h5tools_dump_header_format->dataspacedimend); - break; - - case H5S_NULL: - /* null dataspace */ - h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedescriptionbegin, S_NULL); - break; - - case H5S_NO_CLASS: - default: - h5tools_str_append(buffer, "%s unknown dataspace %s\n", BEGIN, END); - break; - } /* end switch */ - -CATCH - return ret_value; -} - - -/*------------------------------------------------------------------------- - * Function: print_enum - * - * Purpose: prints the enum data - * - * Return: void - * - * In/Out: h5tools_str_t *buffer - * h5tools_context_t *ctx - * - *-----------------------------------------------------------------------*/ -int -h5tools_print_enum(h5tools_str_t *buffer, hid_t type) -{ - HERR_INIT(int, SUCCEED) - char **name = NULL; /*member names */ - unsigned char *value = NULL; /*value array */ - unsigned char *copy = NULL; /*a pointer to value array */ - unsigned nmembs = 0; /*number of members */ - int nchars; /*number of output characters */ - hid_t super = -1; /*enum base integer type */ - hid_t native = -1; /*native integer datatype */ - H5T_sign_t sign_type; /*sign of value type */ - size_t type_size; /*value type size */ - size_t dst_size; /*destination value type size */ - int snmembs; - unsigned i; - - if((snmembs = H5Tget_nmembers(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); - nmembs = (unsigned)snmembs; - assert(nmembs > 0); - - if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); - - if((type_size = H5Tget_size(type)) <= 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed"); - - /* - * Determine what datatype to use for the native values. To simplify - * things we entertain three possibilities: - * 1. long long -- the largest native signed integer - * 2. unsigned long long -- the largest native unsigned integer - * 3. raw format - */ - if(type_size <= sizeof(long long)) { - dst_size = sizeof(long long); - - if((sign_type = H5Tget_sign(type))<0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed"); - if(H5T_SGN_NONE == sign_type) - native = H5T_NATIVE_ULLONG; - else - native = H5T_NATIVE_LLONG; - } /* end if */ - else - dst_size = type_size; - - /* Get the names and raw values of all members */ - if(NULL == (name = (char **)HDcalloc(nmembs, sizeof(char *)))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name"); - if(NULL == (value = (unsigned char *)HDcalloc(nmembs, MAX(type_size, dst_size)))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value"); - - for (i = 0; i < nmembs; i++) { - name[i] = H5Tget_member_name(type, i); - if(H5Tget_member_value(type, i, value + i * type_size) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed"); - } - - /* Convert values to native datatype */ - if (native > 0) - if(H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed"); - - /* - * Sort members by increasing value - * ***not implemented yet*** - */ - - /* Print members */ - for (i = 0; i < nmembs; i++) { - h5tools_str_append(buffer, "\"%s\"", name[i]); - nchars = strlen(name[i]); - h5tools_str_append(buffer, "%*s ", MAX(0, 16 - nchars), ""); - - if (native < 0) { - size_t j; - - h5tools_str_append(buffer, "0x"); - - for (j = 0; j < dst_size; j++) - h5tools_str_append(buffer, "%02x", value[i * dst_size + j]); - } - else if (H5T_SGN_NONE == H5Tget_sign(native)) { - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value + i * dst_size; - h5tools_str_append(buffer, "%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *) ((void *) copy))); - } - else { - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value + i * dst_size; - h5tools_str_append(buffer, "%" H5_PRINTF_LL_WIDTH "d", *((long long *) ((void *) copy))); - } - - h5tools_str_append(buffer, ";\n"); - } - -CATCH - if(name) { - /* Release resources */ - for(i = 0; i < nmembs; i++) - if(name[i]) - free(name[i]); - free(name); - } /* end if */ - - if(value) - free(value); - - if(super >= 0 && H5Tclose(super) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class"); - - if(0 == nmembs) - h5tools_str_append(buffer, "\n"); - - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: dump_datatype - * - * Purpose: Dump the datatype. Datatype can be HDF5 predefined - * atomic datatype or committed/transient datatype. - * - * Return: void - * - * In/Out: h5tools_context_t *ctx - *------------------------------------------------------------------------- - */ -void -h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx, hid_t type) -{ - size_t ncols = 80; /* available output width */ - h5tools_str_t buffer; /* string into which to render */ - hsize_t curr_pos; /* total data element position */ - hsize_t elmt_counter = 0;/* counts the # elements printed.*/ - - /* setup */ - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); - - if (info->line_ncols > 0) - ncols = info->line_ncols; - - /* pass to the prefix in h5tools_simple_prefix the total position - * instead of the current stripmine position i; this is necessary - * to print the array indices - */ - curr_pos = ctx->sm_pos; - - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - /* Render the element */ - h5tools_str_reset(&buffer); - - ctx->indent_level++; - h5tools_str_append(&buffer, "%s %s ", - h5tools_dump_header_format->datatypebegin, - h5tools_dump_header_format->datatypeblockbegin); - - h5tools_print_datatype(&buffer, info, ctx, type); - - if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { - h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeblockend); - if (HDstrlen(h5tools_dump_header_format->datatypeend)) - h5tools_str_append(&buffer, " "); - } - if (HDstrlen(h5tools_dump_header_format->datatypeend)) - h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend); - h5tools_str_append(&buffer, "\n"); - - curr_pos = h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, - ncols, elmt_counter, 0); - - ctx->need_prefix = TRUE; - ctx->indent_level--; -} - -/*------------------------------------------------------------------------- - * Function: init_acc_pos - * - * Purpose: initialize accumulator and matrix position - * - * Return: void - *------------------------------------------------------------------------- - */ -void -init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) -{ - int i; - - assert(ctx->ndims); - - ctx->acc[ctx->ndims - 1] = 1; - for (i = (ctx->ndims - 2); i >= 0; i--) { - ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1]; - } - for (i = 0; i < ctx->ndims; i++) - ctx->pos[i] = 0; -} - -/*------------------------------------------------------------------------- - * Function: do_bin_output - * - * Purpose: Dump memory buffer to a binary file stream - * - * Return: Success: SUCCEED - * Failure: FAIL - *------------------------------------------------------------------------- - */ -static -int do_bin_output(FILE *stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem) -{ - HERR_INIT(int, SUCCEED) - unsigned char *mem = (unsigned char*)_mem; - size_t size; /* datum size */ - hsize_t i; /* element counter */ - - if((size = H5Tget_size(tid)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - - for (i = 0; i < nelmts; i++) { - if (render_bin_output(stream, container, tid, mem + i * size) < 0) { - printf("\nError in writing binary stream\n"); - return FAIL; - } - } - -CATCH - return ret_value; -} - -/*------------------------------------------------------------------------- - * Function: render_bin_output - * - * Purpose: Write one element of memory buffer to a binary file stream + * Purpose: Write one element of memory buffer to a binary file stream * * Return: Success: SUCCEED * Failure: FAIL *------------------------------------------------------------------------- */ -static int +int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem) { HERR_INIT(int, SUCCEED) @@ -3708,8 +1119,8 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem) #ifdef DEBUG_H5DUMP_BIN static char fmt_llong[8], fmt_ullong[8]; if (!fmt_llong[0]) { - sprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH); - sprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH); + HDsprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH); + HDsprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH); } #endif @@ -3717,30 +1128,30 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); if (H5Tequal(tid, H5T_NATIVE_FLOAT)) { - memcpy(&tempfloat, mem, sizeof(float)); + HDmemcpy(&tempfloat, mem, sizeof(float)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%g ", tempfloat); + HDfprintf(stream, "%g ", tempfloat); #else - if (1 != fwrite(&tempfloat, size, 1, stream)) + if (1 != HDfwrite(&tempfloat, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else if (H5Tequal(tid, H5T_NATIVE_DOUBLE)) { - memcpy(&tempdouble, mem, sizeof(double)); + HDmemcpy(&tempdouble, mem, sizeof(double)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%g ", tempdouble); + HDfprintf(stream, "%g ", tempdouble); #else - if (1 != fwrite(&tempdouble, size, 1, stream)) + if (1 != HDfwrite(&tempdouble, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } #if H5_SIZEOF_LONG_DOUBLE !=0 else if (H5Tequal(tid, H5T_NATIVE_LDOUBLE)) { - memcpy(&templdouble, mem, sizeof(long double)); + HDmemcpy(&templdouble, mem, sizeof(long double)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%Lf ", templdouble); + HDfprintf(stream, "%Lf ", templdouble); #else - if (1 != fwrite(&templdouble, size, 1, stream)) + if (1 != HDfwrite(&templdouble, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } @@ -3763,159 +1174,159 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); } for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { - memcpy(&tempuchar, &s[i], sizeof(unsigned char)); + HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%d", tempuchar); + HDfprintf(stream, "%d", tempuchar); #else - if (1 != fwrite(&tempuchar, size, 1, stream)) + if (1 != HDfwrite(&tempuchar, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } /* i */ } else if (H5Tequal(tid, H5T_NATIVE_INT)) { - memcpy(&tempint, mem, sizeof(int)); + HDmemcpy(&tempint, mem, sizeof(int)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%d ", tempint); + HDfprintf(stream, "%d ", tempint); #else - if (1 != fwrite(&tempint, size, 1, stream)) + if (1 != HDfwrite(&tempint, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else if (H5Tequal(tid, H5T_NATIVE_UINT)) { - memcpy(&tempuint, mem, sizeof(unsigned int)); + HDmemcpy(&tempuint, mem, sizeof(unsigned int)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%u ", tempuint); + HDfprintf(stream, "%u ", tempuint); #else - if (1 != fwrite(&tempuint, size, 1, stream)) + if (1 != HDfwrite(&tempuint, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else if (H5Tequal(tid, H5T_NATIVE_SCHAR)) { - memcpy(&tempschar, mem, sizeof(char)); + HDmemcpy(&tempschar, mem, sizeof(char)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%d ", tempschar); + HDfprintf(stream, "%d ", tempschar); #else - if (1 != fwrite(&tempschar, size, 1, stream)) + if (1 != HDfwrite(&tempschar, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else if (H5Tequal(tid, H5T_NATIVE_UCHAR)) { - memcpy(&tempuchar, mem, sizeof(unsigned char)); + HDmemcpy(&tempuchar, mem, sizeof(unsigned char)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%u ", tempuchar); + HDfprintf(stream, "%u ", tempuchar); #else - if (1 != fwrite(&tempuchar, size, 1, stream)) + if (1 != HDfwrite(&tempuchar, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else if (H5Tequal(tid, H5T_NATIVE_SHORT)) { - memcpy(&tempshort, mem, sizeof(short)); + HDmemcpy(&tempshort, mem, sizeof(short)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%d ", tempshort); + HDfprintf(stream, "%d ", tempshort); #else - if (1 != fwrite(&tempshort, size, 1, stream)) + if (1 != HDfwrite(&tempshort, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else if (H5Tequal(tid, H5T_NATIVE_USHORT)) { - memcpy(&tempushort, mem, sizeof(unsigned short)); + HDmemcpy(&tempushort, mem, sizeof(unsigned short)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%u ", tempushort); + HDfprintf(stream, "%u ", tempushort); #else - if (1 != fwrite(&tempushort, size, 1, stream)) + if (1 != HDfwrite(&tempushort, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else if (H5Tequal(tid, H5T_NATIVE_LONG)) { - memcpy(&templong, mem, sizeof(long)); + HDmemcpy(&templong, mem, sizeof(long)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%ld ", templong); + HDfprintf(stream, "%ld ", templong); #else - if (1 != fwrite(&templong, size, 1, stream)) + if (1 != HDfwrite(&templong, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else if (H5Tequal(tid, H5T_NATIVE_ULONG)) { - memcpy(&tempulong, mem, sizeof(unsigned long)); + HDmemcpy(&tempulong, mem, sizeof(unsigned long)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%lu ", tempulong); + HDfprintf(stream, "%lu ", tempulong); #else - if (1 != fwrite(&tempulong, size, 1, stream)) + if (1 != HDfwrite(&tempulong, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else if (H5Tequal(tid, H5T_NATIVE_LLONG)) { - memcpy(&templlong, mem, sizeof(long long)); + HDmemcpy(&templlong, mem, sizeof(long long)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, fmt_llong, templlong); + HDfprintf(stream, fmt_llong, templlong); #else - if (1 != fwrite(&templlong, size, 1, stream)) + if (1 != HDfwrite(&templlong, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else if (H5Tequal(tid, H5T_NATIVE_ULLONG)) { - memcpy(&tempullong, mem, sizeof(unsigned long long)); + HDmemcpy(&tempullong, mem, sizeof(unsigned long long)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, fmt_ullong, tempullong); + HDfprintf(stream, fmt_ullong, tempullong); #else - if (1 != fwrite(&tempullong, size, 1, stream)) + if (1 != HDfwrite(&tempullong, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else if (H5Tequal(tid, H5T_NATIVE_HSSIZE)) { if (sizeof(hssize_t) == sizeof(int)) { - memcpy(&tempint, mem, sizeof(int)); + HDmemcpy(&tempint, mem, sizeof(int)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%d ", tempint); + HDfprintf(stream, "%d ", tempint); #else - if (1 != fwrite(&tempint, size, 1, stream)) + if (1 != HDfwrite(&tempint, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else if (sizeof(hssize_t) == sizeof(long)) { - memcpy(&templong, mem, sizeof(long)); + HDmemcpy(&templong, mem, sizeof(long)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%ld ", templong); + HDfprintf(stream, "%ld ", templong); #else - if (1 != fwrite(&templong, size, 1, stream)) + if (1 != HDfwrite(&templong, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else { - memcpy(&templlong, mem, sizeof(long long)); + HDmemcpy(&templlong, mem, sizeof(long long)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, fmt_llong, templlong); + HDfprintf(stream, fmt_llong, templlong); #else - if (1 != fwrite(&templlong, size, 1, stream)) + if (1 != HDfwrite(&templlong, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } } else if (H5Tequal(tid, H5T_NATIVE_HSIZE)) { if (sizeof(hsize_t) == sizeof(int)) { - memcpy(&tempuint, mem, sizeof(unsigned int)); + HDmemcpy(&tempuint, mem, sizeof(unsigned int)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%u ", tempuint); + HDfprintf(stream, "%u ", tempuint); #else - if (1 != fwrite(&tempuint, size, 1, stream)) + if (1 != HDfwrite(&tempuint, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else if (sizeof(hsize_t) == sizeof(long)) { - memcpy(&tempulong, mem, sizeof(unsigned long)); + HDmemcpy(&tempulong, mem, sizeof(unsigned long)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%lu ", tempulong); + HDfprintf(stream, "%lu ", tempulong); #else - if (1 != fwrite(&tempulong, size, 1, stream)) + if (1 != HDfwrite(&tempulong, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else { - memcpy(&tempullong, mem, sizeof(unsigned long long)); + HDmemcpy(&tempullong, mem, sizeof(unsigned long long)); #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, fmt_ullong, tempullong); + HDfprintf(stream, fmt_ullong, tempullong); #else - if (1 != fwrite(&tempullong, size, 1, stream)) + if (1 != HDfwrite(&tempullong, size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } @@ -3942,18 +1353,18 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem) unsigned int i; if (1 == size) { #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "0x%02x", mem[0]); + HDfprintf(stream, "0x%02x", mem[0]); #else - if (1 != fwrite(&mem[0], size, 1, stream)) + if (1 != HDfwrite(&mem[0], size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else { for (i = 0; i < size; i++) { #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%s%02x", i?":":"", mem[i]); + HDfprintf(stream, "%s%02x", i?":":"", mem[i]); #else - if (1 != fwrite(&mem[i], sizeof(char), 1, stream)) + if (1 != HDfwrite(&mem[i], sizeof(char), 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } /*i*/ @@ -3969,7 +1380,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem) size = H5Tget_size(memb); ndims = H5Tget_array_ndims(tid); H5Tget_array_dims2(tid, dims); - assert(ndims >= 1 && ndims <= H5S_MAX_RANK); + HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK); /* calculate the number of array elements */ for (k = 0, nelmts = 1; k < ndims; k++) { @@ -4032,18 +1443,18 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem) size_t i; if (1 == size) { #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "0x%02x", mem[0]); + HDfprintf(stream, "0x%02x", mem[0]); #else - if (1 != fwrite(&mem[0], size, 1, stream)) + if (1 != HDfwrite(&mem[0], size, 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } else { for (i = 0; i < size; i++) { #ifdef DEBUG_H5DUMP_BIN - fprintf(stream, "%s%02x", i?":":"", mem[i]); + HDfprintf(stream, "%s%02x", i?":":"", mem[i]); #else - if (1 != fwrite(&mem[i], sizeof(char), 1, stream)) + if (1 != HDfwrite(&mem[i], sizeof(char), 1, stream)) H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); #endif } /*i*/ @@ -4067,14 +1478,15 @@ CATCH * *------------------------------------------------------------------------- */ -static int +int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) { hsize_t *dims1 = NULL; hsize_t *start = NULL; hsize_t *count = NULL; - size_t numelem; + hsize_t numelem; + hsize_t numindex; hsize_t total_size[H5S_MAX_RANK]; int jndx; int type_size; @@ -4132,10 +1544,10 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - for (jndx = 0; jndx < numelem; jndx++) { + for (numindex = 0; numindex < numelem; numindex++) { render_bin_output(stream, container, type_id, - ((char*)region_buf + jndx * type_size)); + ((char*)region_buf + numindex * type_size)); /* Render the region data element end */ } /* end for (jndx = 0; jndx < numelem; jndx++) */ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ @@ -4167,7 +1579,7 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, * *------------------------------------------------------------------------- */ -static hbool_t +hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream, hid_t container) { @@ -4187,8 +1599,8 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); - assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ - if((ptdata = (hsize_t*) malloc((size_t) alloc_size)) == NULL) + HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ + if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t); @@ -4204,7 +1616,7 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, type_id, nblocks, ptdata); done: - free(ptdata); + HDfree(ptdata); if(H5Tclose(type_id) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); @@ -4294,7 +1706,7 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id, * *------------------------------------------------------------------------- */ -static hbool_t +hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container) { @@ -4314,7 +1726,7 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); alloc_size = npoints * ndims * sizeof(ptdata[0]); - assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ + HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); @@ -4332,7 +1744,7 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, stream, container, ndims, type_id, npoints, ptdata); done: - free(ptdata); + HDfree(ptdata); if(H5Tclose(type_id) < 0) HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); @@ -4353,8 +1765,8 @@ CATCH * Return: TRUE if all bytes are zero; FALSE otherwise *------------------------------------------------------------------------- */ -static -hbool_t h5tools_is_zero(const void *_mem, size_t size) +hbool_t +h5tools_is_zero(const void *_mem, size_t size) { const unsigned char *mem = (const unsigned char *) _mem; @@ -4385,18 +1797,19 @@ hbool_t h5tools_is_zero(const void *_mem, size_t size) * *------------------------------------------------------------------------- */ -hbool_t h5tools_is_obj_same(hid_t loc_id1, const char *name1, +hbool_t +h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char *name2) { H5O_info_t oinfo1, oinfo2; hbool_t ret_val = 0; - if ( name1 && strcmp(name1, ".")) + if ( name1 && HDstrcmp(name1, ".")) H5Oget_info_by_name(loc_id1, name1, &oinfo1, H5P_DEFAULT); else H5Oget_info(loc_id1, &oinfo1); - if ( name2 && strcmp(name2, ".")) + if ( name2 && HDstrcmp(name2, ".")) H5Oget_info_by_name(loc_id2, name2, &oinfo2, H5P_DEFAULT); else H5Oget_info(loc_id2, &oinfo2); diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 1b2014a..0f4b271 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -31,23 +31,6 @@ #define START_OF_DATA 0x0001 #define END_OF_DATA 0x0002 -/* - * The output functions need a temporary buffer to hold a piece of the - * dataset while it's being printed. This constant sets the limit on the - * size of that temporary buffer in bytes. For efficiency's sake, choose the - * largest value suitable for your machine (for testing use a small value). - */ -#if 1 -#define H5TOOLS_BUFSIZE (1024 * 1024) -#else -#define H5TOOLS_BUFSIZE (1024) -#endif - -/* - * Maximum size used in a call to malloc - */ -#define H5TOOLS_MALLOCSIZE (128 * 1024 * 1024) - /* format for hsize_t */ #define HSIZE_T_FORMAT "%"H5_PRINTF_LL_WIDTH"u" @@ -101,6 +84,9 @@ #define EXTERNAL_FILE "EXTERNAL_FILE" #define FILLVALUE "FILLVALUE" #define FILE_CONTENTS "FILE_CONTENTS" +#define PACKED_BITS "PACKED_BITS" +#define PACKED_OFFSET "OFFSET" +#define PACKED_LENGTH "LENGTH" #define BEGIN "{" #define END "}" @@ -526,17 +512,27 @@ struct subset_t { #include "h5tools_str.h" +H5TOOLS_DLLVAR h5tool_format_t h5tools_dataformat; +H5TOOLS_DLLVAR const h5tools_dump_header_t h5tools_standardformat; +H5TOOLS_DLLVAR const h5tools_dump_header_t* h5tools_dump_header_format; + #ifdef __cplusplus extern "C" { #endif -H5TOOLS_DLLVAR int packed_bits_num; /* number of packed bits to display */ -H5TOOLS_DLLVAR int packed_data_offset; /* offset of packed bits to display */ +H5TOOLS_DLLVAR int packed_bits_num; /* number of packed bits to display */ +H5TOOLS_DLLVAR int packed_data_offset; /* offset of packed bits to display */ +H5TOOLS_DLLVAR int packed_data_length; /* lengtht of packed bits to display */ H5TOOLS_DLLVAR unsigned long long packed_data_mask; /* mask in which packed bits to display */ H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */ +H5TOOLS_DLLVAR FILE *rawoutstream; /* output stream for raw output */ +H5TOOLS_DLLVAR FILE *rawerrorstream; /* output stream for raw error */ H5TOOLS_DLLVAR int bin_output; /* binary output */ H5TOOLS_DLLVAR int bin_form; /* binary form */ H5TOOLS_DLLVAR int region_output; /* region output */ +H5TOOLS_DLLVAR int oid_output; /* oid output */ +H5TOOLS_DLLVAR int data_output; /* data output */ +H5TOOLS_DLLVAR int attr_data_output; /* attribute data output */ /* Strings for output */ #define H5_TOOLS_GROUP "GROUP" @@ -544,41 +540,45 @@ H5TOOLS_DLLVAR int region_output; /* region output */ #define H5_TOOLS_DATATYPE "DATATYPE" /* Definitions of useful routines */ -H5TOOLS_DLL void h5tools_init(void); -H5TOOLS_DLL void h5tools_close(void); -H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, - const char *driver, char *drivername, size_t drivername_len); -H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, - hid_t p_typ, struct subset_t *sset, int indentlevel); -H5TOOLS_DLL int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, - hid_t type, hid_t space, void *mem, int indentlevel); -H5TOOLS_DLL hid_t h5tools_get_native_type(hid_t type); -H5TOOLS_DLL hid_t h5tools_get_little_endian_type(hid_t type); -H5TOOLS_DLL hid_t h5tools_get_big_endian_type(hid_t type); - -H5TOOLS_DLL htri_t h5tools_detect_vlen(hid_t tid); -H5TOOLS_DLL htri_t h5tools_detect_vlen_str(hid_t tid); -H5TOOLS_DLL hbool_t h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char *name2); - -H5TOOLS_DLL void h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, - h5tools_context_t *ctx/*in,out*/, unsigned flags, - hsize_t nelmts, hid_t type, void *_mem); - -H5TOOLS_DLL int h5tools_canreadf(const char* name, - hid_t dcpl_id); -H5TOOLS_DLL int h5tools_can_encode(H5Z_filter_t filtn); - -void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims); -/* - * new functions needed to display region reference data - */ -void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, - h5tools_context_t *ctx/*in,out*/, hid_t type); -int h5tools_print_dataspace(h5tools_str_t *buffer/*in,out*/, hid_t space); -int h5tools_print_datatype(h5tools_str_t *buffer/*in,out*/, - const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, - hid_t type); -int h5tools_print_enum(h5tools_str_t *buffer/*in,out*/, hid_t type); +H5TOOLS_DLL void h5tools_init(void); +H5TOOLS_DLL void h5tools_close(void); +H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl, + const char *driver, char *drivername, size_t drivername_len); +H5TOOLS_DLL hid_t h5tools_get_native_type(hid_t type); +H5TOOLS_DLL hid_t h5tools_get_little_endian_type(hid_t type); +H5TOOLS_DLL hid_t h5tools_get_big_endian_type(hid_t type); +H5TOOLS_DLL htri_t h5tools_detect_vlen(hid_t tid); +H5TOOLS_DLL htri_t h5tools_detect_vlen_str(hid_t tid); +H5TOOLS_DLL hbool_t h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char *name2); +H5TOOLS_DLL void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims); +H5TOOLS_DLL hbool_t h5tools_is_zero(const void *_mem, size_t size); +H5TOOLS_DLL int h5tools_canreadf(const char* name, hid_t dcpl_id); +H5TOOLS_DLL int h5tools_can_encode(H5Z_filter_t filtn); + +H5TOOLS_DLL void h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hsize_t elmtno, int secnum); +H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum); + +H5TOOLS_DLL int do_bin_output(FILE *stream, FILE *err_stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem); +H5TOOLS_DLL int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem); +H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, + hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); +H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, + FILE *stream, hid_t container); +H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, + FILE *stream, hid_t container); + +H5TOOLS_DLL hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos, + size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter); +H5TOOLS_DLL hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer/*string into which to render */, + hsize_t *curr_pos/*total data element position*/, + size_t ncols, hsize_t *ptdata, + hsize_t local_elmt_counter/*element counter*/, + hsize_t elmt_counter); #ifdef __cplusplus } diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c new file mode 100644 index 0000000..15cb679 --- /dev/null +++ b/tools/lib/h5tools_dump.c @@ -0,0 +1,3921 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Robb Matzke + * Thursday, July 23, 1998 + * + * Purpose: A library for displaying the values of a dataset in a human + * readable format. + */ + +#include +#include + +#include "h5tools.h" +#include "h5tools_dump.h" +#include "h5tools_ref.h" +#include "h5tools_utils.h" +#include "H5private.h" + +#define SANITY_CHECK + +#define ALIGN(A,Z) ((((A) + (Z) - 1) / (Z)) * (Z)) + +h5tool_format_t h5tools_dataformat = { +0, /*raw */ + +"", /*fmt_raw */ +"%d", /*fmt_int */ +"%u", /*fmt_uint */ +"%hhd", /*fmt_schar */ +"%u", /*fmt_uchar */ +"%d", /*fmt_short */ +"%u", /*fmt_ushort */ +"%ld", /*fmt_long */ +"%lu", /*fmt_ulong */ +NULL, /*fmt_llong */ +NULL, /*fmt_ullong */ +"%g", /*fmt_double */ +"%g", /*fmt_float */ + +0, /*ascii */ +0, /*str_locale */ +0, /*str_repeat */ + +"[ ", /*arr_pre */ +",", /*arr_sep */ +" ]", /*arr_suf */ +1, /*arr_linebreak */ + +"", /*cmpd_name */ +",\n", /*cmpd_sep */ +"{", /*cmpd_pre */ +"}", /*cmpd_suf */ +"\n", /*cmpd_end */ + +", ", /*vlen_sep */ +"(", /*vlen_pre */ +")", /*vlen_suf */ +"", /*vlen_end */ + +"%s", /*elmt_fmt */ +",", /*elmt_suf1 */ +" ", /*elmt_suf2 */ + +"", /*idx_n_fmt */ +"", /*idx_sep */ +"", /*idx_fmt */ + +80, /*line_ncols *//*standard default columns */ +0, /*line_per_line */ +"", /*line_pre */ +"%s", /*line_1st */ +"%s", /*line_cont */ +"", /*line_suf */ +"", /*line_sep */ +1, /*line_multi_new */ +" ", /*line_indent */ + +1, /*skip_first */ + +1, /*obj_hidefileno */ +" "H5_PRINTF_HADDR_FMT, /*obj_format */ + +1, /*dset_hidefileno */ +"DATASET %s ", /*dset_format */ +"%s", /*dset_blockformat_pre */ +"%s", /*dset_ptformat_pre */ +"%s", /*dset_ptformat */ +1, /*array indices */ +1 /*escape non printable characters */ +}; + +const h5tools_dump_header_t h5tools_standardformat = { +"standardformat", /*name */ +"HDF5", /*fileebgin */ +"", /*fileend */ +SUPER_BLOCK, /*bootblockbegin */ +"", /*bootblockend */ +H5_TOOLS_GROUP, /*groupbegin */ +"", /*groupend */ +H5_TOOLS_DATASET, /*datasetbegin */ +"", /*datasetend */ +ATTRIBUTE, /*attributebegin */ +"", /*attributeend */ +H5_TOOLS_DATATYPE, /*datatypebegin */ +"", /*datatypeend */ +DATASPACE, /*dataspacebegin */ +"", /*dataspaceend */ +DATA, /*databegin */ +"", /*dataend */ +SOFTLINK, /*softlinkbegin */ +"", /*softlinkend */ +EXTLINK, /*extlinkbegin */ +"", /*extlinkend */ +UDLINK, /*udlinkbegin */ +"", /*udlinkend */ +SUBSET, /*subsettingbegin */ +"", /*subsettingend */ +START, /*startbegin */ +"", /*startend */ +STRIDE, /*stridebegin */ +"", /*strideend */ +COUNT, /*countbegin */ +"", /*countend */ +BLOCK, /*blockbegin */ +"", /*blockend */ + +"{", /*fileblockbegin */ +"}", /*fileblockend */ +"{", /*bootblockblockbegin */ +"}", /*bootblockblockend */ +"{", /*groupblockbegin */ +"}", /*groupblockend */ +"{", /*datasetblockbegin */ +"}", /*datasetblockend */ +"{", /*attributeblockbegin */ +"}", /*attributeblockend */ +"", /*datatypeblockbegin */ +"", /*datatypeblockend */ +"", /*dataspaceblockbegin */ +"", /*dataspaceblockend */ +"{", /*datablockbegin */ +"}", /*datablockend */ +"{", /*softlinkblockbegin */ +"}", /*softlinkblockend */ +"{", /*extlinkblockbegin */ +"}", /*extlinkblockend */ +"{", /*udlinkblockbegin */ +"}", /*udlinkblockend */ +"{", /*strblockbegin */ +"}", /*strblockend */ +"{", /*enumblockbegin */ +"}", /*enumblockend */ +"{", /*structblockbegin */ +"}", /*structblockend */ +"{", /*vlenblockbegin */ +"}", /*vlenblockend */ +"{", /*subsettingblockbegin */ +"}", /*subsettingblockend */ +"(", /*startblockbegin */ +");", /*startblockend */ +"(", /*strideblockbegin */ +");", /*strideblockend */ +"(", /*countblockbegin */ +");", /*countblockend */ +"(", /*blockblockbegin */ +");", /*blockblockend */ + +"", /*dataspacedescriptionbegin */ +"", /*dataspacedescriptionend */ +"(", /*dataspacedimbegin */ +")", /*dataspacedimend */ +}; + +const h5tools_dump_header_t* h5tools_dump_header_format; +table_t *h5dump_type_table = NULL; /*type table reference for datatype dump */ + +/* local prototypes */ + +hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer/*string into which to render */, + hsize_t *curr_pos/*total data element position*/, + size_t ncols, hsize_t local_elmt_counter/*element counter*/, + hsize_t elmt_counter); + +hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer/*string into which to render */, + hsize_t *curr_pos/*total data element position*/, + size_t ncols, hsize_t *ptdata, + hsize_t local_elmt_counter/*element counter*/, + hsize_t elmt_counter); + +static int h5tools_print_region_data_blocks(hid_t region_id, + FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, + h5tools_str_t *buffer/*string into which to render */, size_t ncols, + int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); + +hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, + FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer/*string into which to render */, + hsize_t *curr_pos/*total data element position*/, + size_t ncols, hsize_t region_elmt_counter/*element counter*/, + hsize_t elmt_counter); + +int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, + FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, + h5tools_str_t *buffer, size_t ncols, + int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata); + +hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, + FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer/*string into which to render */, + hsize_t *curr_pos/*total data element position*/, + size_t ncols, hsize_t region_elmt_counter/*element counter*/, + hsize_t elmt_counter); +void +h5tools_dump_init(void) +{ + h5tools_dump_header_format = &h5tools_standardformat; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Prints NELMTS data elements to output STREAM. + * Description: + * Prints some (NELMTS) data elements to output STREAM. The elements are + * stored in _MEM as type TYPE and are printed according to the format + * described in INFO. The CTX struct contains context information shared + * between calls to this function. The FLAGS is a bit field that + * indicates whether the data supplied in this call falls at the + * beginning or end of the total data to be printed (START_OF_DATA and + * END_OF_DATA). + * Return: + * None + * Programmer: + * Robb Matzke, Monday, April 26, 1999 + * Modifications: + * Robb Matzke, 1999-06-04 + * The `container' argument is the optional dataset for reference types. + * + * Robb Matzke, 1999-09-29 + * Understands the `per_line' property which indicates that every Nth + * element should begin a new line. + * + * Robb Matzke, LLNL, 2003-06-05 + * Do not dereference the memory for a variable-length string here. + * Deref in h5tools_str_sprint() instead so recursive types are + * handled correctly. + * + * Pedro Vicente Nunes, The HDF Group, 2005-10-19 + * pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + * new field sm_pos in h5tools_context_t, the current stripmine element position + *------------------------------------------------------------------------- + */ +void +h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, + h5tools_context_t *ctx/*in,out*/, unsigned flags, + hsize_t nelmts, hid_t type, void *_mem) +{ + unsigned char *mem = (unsigned char*) _mem; + hsize_t i; /*element counter */ + size_t size; /*size of each datum */ + hid_t region_space = -1; + hid_t region_id = -1; + hbool_t dimension_break = TRUE; + H5S_sel_type region_type; + size_t ncols = 80; /*available output width */ + h5tools_str_t buffer; /*string into which to render */ + hsize_t curr_pos = 0; /* total data element position */ + hsize_t elmt_counter = 0;/*counts the # elements printed. + *I (ptl?) needed something that + *isn't going to get reset when a new + *line is formed. I'm going to use + *this var to count elements and + *break after we see a number equal + *to the ctx->size_last_dim. */ + + /* binary dump */ + if (bin_output) { + do_bin_output(rawdatastream, rawoutstream, container, nelmts, type, _mem); + } /* end if */ + else { + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + size = H5Tget_size(type); + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + /* pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + */ + curr_pos = ctx->sm_pos; + + if (region_output && H5Tequal(type, H5T_STD_REF_DSETREG)) { + for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) { + void* memref = mem + i * size; + char ref_name[1024]; + + /* region data */ + region_id = H5Rdereference(container, H5R_DATASET_REGION, memref); + if (region_id >= 0) { + region_space = H5Rget_region(container, H5R_DATASET_REGION, memref); + if (region_space >= 0) { + if (h5tools_is_zero(memref, H5Tget_size(type))) { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + /* Render the region element begin */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "NULL"); + + dimension_break = h5tools_render_element(stream, info, + ctx, &buffer, &curr_pos, ncols, i, elmt_counter); + } + else { + if(H5Rget_name(region_id, H5R_DATASET_REGION, memref, (char*) ref_name, 1024)<0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_name failed"); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos+i, 0); + + /* Render the region element begin */ + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, info->dset_format, ref_name); + + dimension_break = h5tools_render_element(stream, info, + ctx, &buffer, &curr_pos, ncols, i, elmt_counter); + + region_type = H5Sget_select_type(region_space); + if(region_type == H5S_SEL_POINTS) + /* Print point information */ + dimension_break = h5tools_dump_region_data_points( + region_space, region_id, stream, info, ctx, + &buffer, &curr_pos, ncols, i, elmt_counter); + else if(region_type == H5S_SEL_HYPERSLABS) + /* Print block information */ + dimension_break = h5tools_dump_region_data_blocks( + region_space, region_id, stream, info, ctx, + &buffer, &curr_pos, ncols, i, elmt_counter); + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "invalid region type"); + /* Render the region element end */ + + } /* end else to if (h5tools_is_zero(... */ + if(H5Sclose(region_space) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + } /* end if (region_space >= 0) */ + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_region failed"); + if(H5Dclose(region_id) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed"); + + } /* if (region_id >= 0) */ + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference failed"); + + ctx->need_prefix = TRUE; + + if(FALSE == dimension_break) + elmt_counter = 0; + } /* end for (i = 0; i < nelmts... */ + } /* end if (region_output... */ + else { + for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) { + void* memref = mem + i * size; + /* Render the data element begin*/ + h5tools_str_reset(&buffer); + h5tools_str_sprint(&buffer, info, container, type, memref, ctx); + + if (i + 1 < nelmts || (flags & END_OF_DATA) == 0) + h5tools_str_append(&buffer, "%s", OPT(info->elmt_suf1, ",")); + + dimension_break = h5tools_render_element(stream, info, ctx, &buffer, + &curr_pos, ncols, i, elmt_counter); + /* Render the data element end*/ + if(FALSE == dimension_break) + elmt_counter = 0; + } /* end for (i = 0; i < nelmts... */ + } + + h5tools_str_close(&buffer); + }/* else bin */ +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Print the data values from a dataset referenced by region blocks. + * + * Description: + * This is a special case subfunction to print the data in a region reference of type blocks. + * + * Return: + * The function returns FAIL if there was an error, otherwise SUCEED + * + * Parameters Description: + * h5tools_str_t *buffer is the string into which to render + * size_t ncols + * int ndims is the number of dimensions of the region element + * hssize_t nblocks is the number of blocks in the region + *------------------------------------------------------------------------- + */ +static int +h5tools_print_region_data_blocks(hid_t region_id, + FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, + h5tools_str_t *buffer/*string into which to render */, size_t ncols, + int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) +{ + hbool_t dimension_break = TRUE; + hsize_t *dims1 = NULL; + hsize_t *start = NULL; + hsize_t *count = NULL; + hsize_t blkndx; + hsize_t total_size[H5S_MAX_RANK]; + hsize_t elmtno; /* elemnt index */ + hsize_t curr_pos = 0; + unsigned int region_flags; /* buffer extent flags */ + hsize_t numelem; + hsize_t numindex; + size_t jndx; + int indx; + int type_size; + int ret_value = SUCCEED; + hid_t mem_space = -1; + hid_t sid1 = -1; + h5tools_context_t ctx; + void *region_buf = NULL; + + HDassert(info); + HDassert(cur_ctx); + HDassert(buffer); + HDassert(ptdata); + + HDmemset(&ctx, 0, sizeof(ctx)); + /* Get the dataspace of the dataset */ + if((sid1 = H5Dget_space(region_id)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + + /* Allocate space for the dimension array */ + if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + + /* find the dimensions of each data space from the block coordinates */ + numelem = 1; + for (jndx = 0; jndx < ndims; jndx++) { + dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1; + numelem = dims1[jndx] * numelem; + } + + /* Create dataspace for reading buffer */ + if((mem_space = H5Screate_simple(ndims, dims1, NULL)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + + if((type_size = H5Tget_size(type_id)) == 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + + if((region_buf = HDmalloc(type_size * numelem)) == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer"); + + /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ + /* 1 2 n 1 2 n */ + if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for start"); + + if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for count"); + + curr_pos = 0; + ctx.indent_level = cur_ctx->indent_level; + ctx.cur_column = cur_ctx->cur_column; + ctx.prev_multiline = cur_ctx->prev_multiline; + ctx.ndims = ndims; + for (blkndx = 0; blkndx < nblocks; blkndx++) { + ctx.need_prefix = TRUE; + ctx.cur_elmt = 0; + for (indx = 0; indx < ndims; indx++) { + start[indx] = ptdata[indx + blkndx * ndims * 2]; + count[indx] = dims1[indx]; + } + + if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + + if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed"); + + ctx.indent_level++; + if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + + /* assume entire data space to be printed */ + for (indx = 0; indx < (size_t) ctx.ndims; indx++) + ctx.p_min_idx[indx] = start[indx]; + init_acc_pos(&ctx, total_size); + + /* print the data */ + region_flags = START_OF_DATA; + if (blkndx == nblocks - 1) + region_flags |= END_OF_DATA; + + for (indx = 0; indx < (size_t)ctx.ndims; indx++) + ctx.p_max_idx[indx] = dims1[indx]; + + curr_pos = 0; + ctx.sm_pos = blkndx*2*ndims; + ctx.size_last_dim = dims1[ndims-1]; + + h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0); + + elmtno = 0; + for (numindex = 0; numindex < numelem; numindex++, elmtno++, ctx.cur_elmt++) { + /* Render the region data element begin */ + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "%s", numindex ? OPTIONAL_LINE_BREAK "" : ""); + h5tools_str_sprint(buffer, info, region_id, type_id, + ((char*)region_buf + numindex * type_size), &ctx); + + if (numindex + 1 < numelem || (region_flags & END_OF_DATA) == 0) + h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ",")); + + dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, + ncols, ptdata, numindex, elmtno); + /* Render the region data element end */ + + if(FALSE == dimension_break) + elmtno = 0; + } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */ + + ctx.indent_level--; + } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ + + done: + HDfree(start); + HDfree(count); + HDfree(region_buf); + HDfree(dims1); + + if(H5Sclose(mem_space) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + if(H5Sclose(sid1) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Print some values from a dataset referenced by region blocks. + * + * Description: + * This is a special case subfunction to dump a region reference using blocks. + * + * Return: + * The function returns False if the last dimension has been reached, otherwise True + * + * In/Out: + * h5tools_context_t *ctx + * hsize_t *curr_pos + * + * Parameters Description: + * h5tools_str_t *buffer is the string into which to render + * hsize_t curr_pos is the total data element position + * size_t ncols + * hsize_t region_elmt_counter is the region element loop counter + * hsize_t elmt_count is the data element loop counter + *------------------------------------------------------------------------- + */ +hbool_t +h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, + FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, + h5tools_str_t *buffer/*string into which to render */, + hsize_t *curr_pos/*total data element position*/, + size_t ncols, hsize_t region_elmt_counter/*element counter*/, + hsize_t elmt_counter) +{ + HERR_INIT(hbool_t, TRUE) + hbool_t dimension_break = TRUE; + hssize_t nblocks; + hsize_t alloc_size; + hsize_t *ptdata = NULL; + int ndims; + hid_t dtype = -1; + hid_t type_id = -1; + int i; + + HDassert(info); + HDassert(ctx); + HDassert(buffer); + + if((nblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); + + /* Print block information */ + if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + + /* Render the region { element begin */ + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "{"); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the region { element end */ + + ctx->indent_level++; + ctx->need_prefix = TRUE; + + /* Render the region datatype info and indices element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "REGION_TYPE BLOCK "); + + alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); + HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ + if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); + + H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t); + if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed"); + + for (i = 0; i < nblocks; i++) { + int j; + + h5tools_str_append(buffer, info->dset_blockformat_pre, + i ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long) i); + + /* Start coordinates and opposite corner */ + for (j = 0; j < ndims; j++) + h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, j ? "," : "(", + ptdata[i * 2 * ndims + j]); + + for (j = 0; j < ndims; j++) + h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, j ? "," : ")-(", + ptdata[i * 2 * ndims + j + ndims]); + + h5tools_str_append(buffer, ")"); + } /* end for (i = 0; i < nblocks; i++) */ + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the region datatype info and indices element end */ + + ctx->need_prefix = TRUE; + + if((dtype = H5Dget_type(region_id)) < 0) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); + + /* Render the datatype element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s %s ", + h5tools_dump_header_format->datatypebegin, + h5tools_dump_header_format->datatypeblockbegin); + + ctx->indent_level++; + h5tools_print_datatype(stream, buffer, info, ctx, dtype, TRUE); + ctx->indent_level--; + + if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeblockend); + if (HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend); + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the datatype element end */ + + ctx->need_prefix = TRUE; + + /* Render the dataspace element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin); + + h5tools_print_dataspace(stream, buffer, info, ctx, region_space); + + if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the dataspace element end */ + + ctx->need_prefix = TRUE; + + /* Render the databegin element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s %s ", + h5tools_dump_header_format->databegin, + h5tools_dump_header_format->datablockbegin); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the databegin element end */ + + ctx->need_prefix = TRUE; + + h5tools_print_region_data_blocks(region_id, rawdatastream, info, ctx, + buffer, ncols, ndims, type_id, nblocks, ptdata); + + done: + HDfree(ptdata); + + if(H5Tclose(type_id) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + if(H5Tclose(dtype) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + ctx->need_prefix = TRUE; + + /* Render the dataend element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s %s ", + h5tools_dump_header_format->dataend, + h5tools_dump_header_format->datablockend); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + ncols, region_elmt_counter, elmt_counter); + /* Render the dataend element end */ + + ctx->indent_level--; + ctx->need_prefix = TRUE; + + /* Render the region } element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "}"); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + ncols, region_elmt_counter, elmt_counter); + /* Render the region } element end */ + + H5_LEAVE(dimension_break) + + CATCH + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Print the data values from a dataset referenced by region points. + * + * Description: + * This is a special case subfunction to print the data in a region reference of type points. + * + * Return: + * The function returns FAIL on error, otherwise SUCCEED + * + * Parameters Description: + * h5tools_str_t *buffer is the string into which to render + * size_t ncols + * int ndims is the number of dimensions of the region element + * hssize_t npoints is the number of points in the region + *------------------------------------------------------------------------- + */ +int +h5tools_print_region_data_points(hid_t region_space, hid_t region_id, + FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, + h5tools_str_t *buffer, size_t ncols, + int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) +{ + hbool_t dimension_break = TRUE; + hsize_t *dims1 = NULL; + hsize_t elmtno; /* elemnt index */ + hsize_t curr_pos = 0; + hsize_t total_size[H5S_MAX_RANK]; + size_t jndx; + int indx; + int type_size; + int ret_value = SUCCEED; + unsigned int region_flags; /* buffer extent flags */ + hid_t mem_space = -1; + void *region_buf = NULL; + h5tools_context_t ctx; + + HDassert(info); + HDassert(cur_ctx); + HDassert(buffer); + HDassert(ptdata); + + HDmemset(&ctx, 0, sizeof(ctx)); + /* Allocate space for the dimension array */ + if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + + dims1[0] = npoints; + + /* Create dataspace for reading buffer */ + if((mem_space = H5Screate_simple(1, dims1, NULL)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + + if((type_size = H5Tget_size(type_id)) == 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + + if((region_buf = HDmalloc(type_size * npoints)) == NULL) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region"); + + curr_pos = 0; + ctx.indent_level = cur_ctx->indent_level; + ctx.cur_column = cur_ctx->cur_column; + ctx.prev_multiline = cur_ctx->prev_multiline; + ctx.ndims = ndims; + + if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + + elmtno = 0; + for (jndx = 0; jndx < npoints; jndx++, elmtno++) { + ctx.need_prefix = TRUE; + ctx.cur_elmt = 0; /* points are always 0 */ + + ctx.indent_level++; + if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + + /* assume entire data space to be printed */ + for (indx = 0; indx < (size_t) ctx.ndims; indx++) + ctx.p_min_idx[indx] = 0; + init_acc_pos(&ctx, total_size); + + /* print the data */ + region_flags = START_OF_DATA; + if (jndx == npoints - 1) + region_flags |= END_OF_DATA; + + for (indx = 0; indx < (size_t)ctx.ndims; indx++) + ctx.p_max_idx[indx] = cur_ctx->p_max_idx[indx]; + + ctx.sm_pos = jndx * ndims; + if (ctx.ndims > 0) { + ctx.size_last_dim = (int) (ctx.p_max_idx[ctx.ndims - 1]); + } + else + ctx.size_last_dim = 0; + + curr_pos = 0; /* points requires constant 0 */ + h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0); + + /* Render the point element begin */ + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "%s", jndx ? OPTIONAL_LINE_BREAK "" : ""); + h5tools_str_sprint(buffer, info, region_id, type_id, + ((char*)region_buf + jndx * type_size), &ctx); + + if (jndx + 1 < npoints || (region_flags & END_OF_DATA) == 0) + h5tools_str_append(buffer, "%s", OPT(info->elmt_suf1, ",")); + + dimension_break = h5tools_render_region_element(stream, info, &ctx, buffer, &curr_pos, + ncols, ptdata, (hsize_t)0, elmtno); + /* Render the point element end */ + if(FALSE == dimension_break) + elmtno = 0; + + ctx.indent_level--; + } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */ + + done: + HDfree(region_buf); + HDfree(dims1); + + if(H5Sclose(mem_space) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Print some values from a dataset referenced by region points. + * + * Description: + * This is a special case subfunction to dump a region reference using points. + * + * Return: + * The function returns False if the last dimension has been reached, otherwise True + * + * In/Out: + * h5tools_context_t *ctx + * hsize_t *curr_pos + * + * Parameters Description: + * h5tools_str_t *buffer is the string into which to render + * hsize_t curr_pos is the total data element position + * size_t ncols + * hsize_t region_elmt_counter is the region element loop counter + * hsize_t elmt_count is the data element loop counter + *------------------------------------------------------------------------- + */ +hbool_t +h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, + FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, + hsize_t elmt_counter) { + HERR_INIT(hbool_t, TRUE) + hbool_t dimension_break = TRUE; + hssize_t npoints; + hsize_t alloc_size; + hsize_t *ptdata; + int ndims; + hssize_t indx; + hid_t dtype; + hid_t type_id; + + HDassert(info); + HDassert(ctx); + HDassert(buffer); + + if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0) + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); + + /* Allocate space for the dimension array */ + if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + + /* Render the region { element begin */ + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "{"); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the region { element end */ + + /* Render the region datatype info and indices element begin */ + h5tools_str_reset(buffer); + + ctx->indent_level++; + ctx->need_prefix = TRUE; + h5tools_str_append(buffer, "REGION_TYPE POINT "); + + alloc_size = npoints * ndims * sizeof(ptdata[0]); + HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ + if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); + + H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t); + if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_pointlist failed"); + + for (indx = 0; indx < npoints; indx++) { + int loop_indx; + + h5tools_str_append(buffer, info->dset_ptformat_pre, + indx ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long) indx); + + for (loop_indx = 0; loop_indx < ndims; loop_indx++) + h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, loop_indx ? "," : "(", + ptdata[indx * ndims + loop_indx]); + + h5tools_str_append(buffer, ")"); + } /* end for (indx = 0; indx < npoints; indx++) */ + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the region datatype info and indices element end */ + + ctx->need_prefix = TRUE; + + if((dtype = H5Dget_type(region_id)) < 0) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); + + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) + HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); + + /* Render the datatype element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s %s ", + h5tools_dump_header_format->datatypebegin, + h5tools_dump_header_format->datatypeblockbegin); + + ctx->indent_level++; + h5tools_print_datatype(stream, buffer, info, ctx, dtype, TRUE); + ctx->indent_level--; + + if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeblockend); + if (HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->datatypeend); + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the datatype element end */ + + ctx->need_prefix = TRUE; + + /* Render the dataspace element begin */ + h5tools_str_reset(buffer); + + ctx->need_prefix = TRUE; + h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin); + + h5tools_print_dataspace(stream, buffer, info, ctx, region_space); + + if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend); + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + /* Render the dataspace element end */ + + ctx->need_prefix = TRUE; + + /* Render the databegin element begin */ + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "%s %s ", + h5tools_dump_header_format->databegin, + h5tools_dump_header_format->datablockbegin); + + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, ncols, region_elmt_counter, elmt_counter); + + ctx->need_prefix = TRUE; + + h5tools_print_region_data_points(region_space, region_id, + rawdatastream, info, ctx, buffer, ncols, ndims, type_id, npoints, ptdata); + + done: + HDfree(ptdata); + + if(H5Tclose(type_id) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + if(H5Tclose(dtype) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + ctx->need_prefix = TRUE; + + /* Render the dataend element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s %s ", + h5tools_dump_header_format->dataend, + h5tools_dump_header_format->datablockend); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + ncols, region_elmt_counter, elmt_counter); + /* Render the dataend element end*/ + + ctx->indent_level--; + ctx->need_prefix = TRUE; + + /* Render the region } element begin */ + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "}"); + dimension_break = h5tools_render_element(stream, info, ctx, buffer, curr_pos, + ncols, region_elmt_counter, elmt_counter); + /* Render the region } element end */ + + H5_LEAVE(dimension_break) +CATCH + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: print out the data for a subset of a dataset. + * Description: + * + * Select a hyperslab from the dataset DSET using the parameters + * specified in SSET. Dump this out to STREAM. + * + * Hyperslabs select "count" blocks of size "block", spaced "stride" elements + * from each other, starting at coordinate "start". + * + * Return: + * On success, return SUCCEED. Otherwise, the function returns FAIL. + * + * Algorithm + * + * The parameters from SSET are translated into temporary + * variables so that 1 row is printed at a time (getting the coordinate indices + * at each row). + * We define the stride, count and block to be 1 in the row dimension to achieve + * this and advance until all points are printed. + * + * The element position is obtained from the matrix according to: + * Given an index I(z,y,x) its position from the beginning of an array + * of sizes A(size_z, size_y,size_x) is given by + * Position of I(z,y,x) = index_z * size_y * size_x + * + index_y * size_x + * + index_x + * + *------------------------------------------------------------------------- + */ +static herr_t +h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hid_t dset, hid_t p_type, struct subset_t *sset, + hid_t f_space, hsize_t hyperslab_count, + hsize_t *temp_start,/* start inside offset count loop */ + hsize_t *temp_count,/* count inside offset count loop */ + hsize_t *temp_block,/* block size used in loop */ + hsize_t *temp_stride,/* stride size used in loop */ + hsize_t *total_size,/* total size of dataset */ + unsigned int row_dim/* index of row_counter dimension */) +{ + HERR_INIT(herr_t, SUCCEED) + size_t i; /* counters */ + size_t j; /* counters */ + hsize_t zero[1] = {0}; /* vector of zeros */ + unsigned int flags; /* buffer extent flags */ + hsize_t elmtno; /* elemnt index */ + hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */ + hsize_t high[H5S_MAX_RANK]; /* higher bound of hyperslab */ + size_t p_type_nbytes; /* size of memory type */ + hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ + hsize_t sm_nbytes; /* bytes per stripmine */ + hssize_t ssm_nelmts; /* elements per stripmine*/ + hsize_t sm_nelmts; /* elements per stripmine*/ + unsigned char *sm_buf = NULL; /* buffer for raw data */ + hid_t sm_space = -1; /* stripmine data space */ + hsize_t size_row_block; /* size for blocks along rows */ + hsize_t row_counter = 0; + + /* VL data special information */ + unsigned int vl_data = 0; /* contains VL datatypes */ + + if ((size_t) ctx->ndims > NELMTS(sm_size)) + H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed"); + + if (ctx->ndims > 0) + init_acc_pos(ctx, total_size); + + size_row_block = sset->block.data[row_dim]; + + /* Check if we have VL data in the dataset's datatype */ + if (h5tools_detect_vlen_str(p_type) == TRUE) + vl_data = TRUE; + if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + vl_data = TRUE; + + /* display loop */ + for (; hyperslab_count > 0; temp_start[row_dim] += temp_stride[row_dim], hyperslab_count--) { + /* jump rows if size of block exceeded + cases where block > 1 only and stride > block */ + if (size_row_block > 1 + && row_counter == size_row_block + && sset->stride.data[row_dim] > sset->block.data[row_dim]) { + + hsize_t increase_rows = sset->stride.data[row_dim] - sset->block.data[row_dim]; + temp_start[row_dim] += increase_rows; + row_counter = 0; + } + + row_counter++; + + /* calculate the potential number of elements we're going to print */ + if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + + if((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); + sm_nelmts = (hsize_t)ssm_nelmts; + + if (sm_nelmts > 0) { + /* + * determine the strip mine size and allocate a buffer. the strip mine is + * a hyperslab whose size is manageable. + */ + if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + + if (ctx->ndims > 0) + for (i = ctx->ndims; i > 0; --i) { + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if (size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + sm_size[i - 1] = MIN(total_size[i - 1], size); + sm_nbytes *= sm_size[i - 1]; + HDassert(sm_nbytes > 0); + } + + HDassert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ + if(NULL == (sm_buf = (unsigned char *)HDmalloc((size_t) sm_nelmts * p_type_nbytes))) + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); + + if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + + if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + + /* read the data */ + if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + + /* print the data */ + flags = START_OF_DATA; + + if (hyperslab_count == 1) + flags |= END_OF_DATA; + + for (i = 0; i < ctx->ndims; i++) + ctx->p_max_idx[i] = ctx->p_min_idx[i] + MIN(total_size[i], sm_size[i]); + + /* print array indices. get the lower bound of the hyperslab and calulate + the element position at the start of hyperslab */ + if(H5Sget_select_bounds(f_space, low, high) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); + + elmtno = 0; + for (i = 0; i < (size_t) ctx->ndims - 1; i++) { + hsize_t offset = 1; /* accumulation of the previous dimensions */ + for (j = i + 1; j < (size_t) ctx->ndims; j++) + offset *= total_size[j]; + elmtno += low[i] * offset; + } + elmtno += low[ctx->ndims - 1]; + + /* initialize the current stripmine position; this is necessary to print the array + indices */ + ctx->sm_pos = elmtno; + + ctx->need_prefix = TRUE; + + h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf); + + /* Reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); + + if(H5Sclose(sm_space) < 0) + H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + if(sm_buf) + HDfree(sm_buf); + sm_buf = NULL; + } + else + H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print"); + + ctx->continuation++; + + } /* hyperslab_count loop */ + +CATCH + if(sm_buf) + HDfree(sm_buf); + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: print out the data for a subset of a dataset. + * Description: + * + * Select a hyperslab from the dataset DSET using the parameters + * specified in SSET. Dump this out to STREAM. + * + * Hyperslabs select "count" blocks of size "block", spaced "stride" elements + * from each other, starting at coordinate "start". + * + * Return: + * On success, return SUCCEED. Otherwise, the function returns FAIL. + * + * Algorithm + * + * The parameters from SSET are translated into temporary + * variables so that 1 row is printed at a time (getting the coordinate indices + * at each row). + * We define the stride, count and block to be 1 in the row dimension to achieve + * this and advance until all points are printed. + * + * The element position is obtained from the matrix according to: + * Given an index I(z,y,x) its position from the beginning of an array + * of sizes A(size_z, size_y,size_x) is given by + * Position of I(z,y,x) = index_z * size_y * size_x + * + index_y * size_x + * + index_x + * + *------------------------------------------------------------------------- + */ +static herr_t +h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hid_t dset, hid_t p_type, struct subset_t *sset, + hid_t f_space, hsize_t *total_size) +{ + size_t i; /* counters */ + hsize_t n; /* counters */ + hsize_t count; /* hyperslab count */ + hsize_t outer_count; /* offset count */ + unsigned int row_dim; /* index of row_counter dimension */ + int current_outer_dim; /* dimension for start */ + hsize_t temp_start[H5S_MAX_RANK];/* temporary start inside offset count loop */ + hsize_t max_start[H5S_MAX_RANK]; /* maximum start inside offset count loop */ + hsize_t temp_count[H5S_MAX_RANK];/* temporary count inside offset count loop */ + hsize_t temp_block[H5S_MAX_RANK];/* temporary block size used in loop */ + hsize_t temp_stride[H5S_MAX_RANK];/* temporary stride size used in loop */ + int reset_dim; + herr_t ret_value = SUCCEED; + + if (ctx->ndims == 1) + row_dim = 0; + else + row_dim = ctx->ndims - 2; + + /* get the offset count */ + outer_count = 1; + if (ctx->ndims > 2) + for (i = 0; i < (size_t) ctx->ndims - 2; i++) { + /* block size is handled by containing h5tools_print_simple_subset call */ + outer_count = outer_count * sset->count.data[i]; + } + + /* initialize temporary start, count and maximum start */ + for (i = 0; i < (size_t) ctx->ndims; i++) { + temp_start[i] = sset->start.data[i]; + temp_count[i] = sset->count.data[i]; + temp_block[i] = sset->block.data[i]; + temp_stride[i] = sset->stride.data[i]; + max_start[i] = 0; + } + + if (ctx->ndims > 2) { + for (i = 0; i < (size_t) ctx->ndims - 2; i++) { + max_start[i] = temp_start[i] + sset->count.data[i]; + temp_count[i] = 1; + } + } + + /* offset loop */ + for (n = 0; n < outer_count; n++) { + /* number of read iterations in inner loop, read by rows, to match 2D display */ + if (ctx->ndims > 1) { + /* count is the number of iterations to display all the rows, + the block size count times */ + count = sset->count.data[row_dim] * sset->block.data[row_dim]; + + /* always 1 row_counter at a time, that is a block of size 1, 1 time */ + temp_count[row_dim] = 1; + temp_block[row_dim] = 1; + + /* advance 1 row_counter at a time */ + if (sset->block.data[row_dim] > 1) + temp_stride[row_dim] = 1; + } + /* for the 1D case */ + else { + count = 1; + } + + h5tools_print_simple_subset(stream, info, ctx, dset, p_type, sset, + f_space, count, temp_start, temp_count, + temp_block, temp_stride, total_size, row_dim); + + if (ctx->ndims > 2) { + /* dimension for start */ + current_outer_dim = (ctx->ndims - 2) - 1; + + /* set start to original from current_outer_dim up */ + for (i = current_outer_dim + 1; i < ctx->ndims; i++) { + temp_start[i] = sset->start.data[i]; + } + + /* increment start dimension */ + do { + reset_dim = 0; + temp_start[current_outer_dim]++; + if (temp_start[current_outer_dim] >= max_start[current_outer_dim]) { + temp_start[current_outer_dim] = sset->start.data[current_outer_dim]; + + /* consider block */ + if (sset->block.data[current_outer_dim] > 1) + temp_start[current_outer_dim]++; + + current_outer_dim--; + reset_dim = 1; + } + } while (current_outer_dim >= 0 && reset_dim); + + } /* ctx.ndims > 1 */ + + } /* outer_count */ + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Dump out a subset of a dataset. + * Description: + * + * Select a hyperslab from the dataset DSET using the parameters + * specified in SSET. Dump this out to STREAM. + * + * Hyperslabs select "count" blocks of size "block", spaced "stride" elements + * from each other, starting at coordinate "start". + * + * Return: + * On success, return SUCCEED. Otherwise, the function returns FAIL. + * + * Original programmer: + * Bill Wendling, Wednesday, March 07, 2001 + * + * Rewritten with modified algorithm by: + * Pedro Vicente, Wednesday, January 16, 2008, contributions from Quincey Koziol + * + * Algorithm + * + * In a inner loop, the parameters from SSET are translated into temporary + * variables so that 1 row is printed at a time (getting the coordinate indices + * at each row). + * We define the stride, count and block to be 1 in the row dimension to achieve + * this and advance until all points are printed. + * An outer loop for cases where dimensionality is greater than 2D is made. + * In each iteration, the 2D block is displayed in the inner loop. The remaining + * slower dimensions above the first 2 are incremented one at a time in the outer loop + * + * The element position is obtained from the matrix according to: + * Given an index I(z,y,x) its position from the beginning of an array + * of sizes A(size_z, size_y,size_x) is given by + * Position of I(z,y,x) = index_z * size_y * size_x + * + index_y * size_x + * + index_x + * + *------------------------------------------------------------------------- + */ +static herr_t +h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, + hid_t p_type, struct subset_t *sset) +{ + HERR_INIT(herr_t, SUCCEED) + int sndims; + hid_t f_space = -1; /* file data space */ + size_t i; /* counters */ + hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ + + if((f_space = H5Dget_space(dset)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + + if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + ctx->ndims = (unsigned)sndims; + + /* assume entire data space to be printed */ + if (ctx->ndims > 0) + for (i = 0; i < (size_t) ctx->ndims; i++) + ctx->p_min_idx[i] = 0; + + if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + ctx->size_last_dim = total_size[ctx->ndims - 1]; + + h5tools_display_simple_subset(stream, info, ctx, dset, p_type, sset, f_space, total_size); + +CATCH + if(f_space >= 0 && H5Sclose(f_space) < 0) + H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Audience: Public + * Chapter: H5Tools Library + * Purpose: Print some values from a dataset with a simple data space. + * Description: + * This is a special case of h5tools_dump_dset(). This function only + * intended for dumping datasets -- it does strip mining and some other + * things which are unnecessary for smaller objects such as attributes + * (to print small objects like attributes simply read the attribute and + * call h5tools_dump_simple_mem()). + * Return: + * On success, the function returns SUCCEED. Otherwise, the function + * returns FAIL. + *------------------------------------------------------------------------- + */ +static int +h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hid_t dset, hid_t p_type) +{ + hid_t f_space; /* file data space */ + hsize_t elmtno; /* counter */ + size_t i; /* counter */ + int carry; /* counter carry value */ + hsize_t zero[8]; /* vector of zeros */ + unsigned int flags; /* buffer extent flags */ + hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ + + /* Print info */ + size_t p_type_nbytes; /* size of memory type */ + hsize_t p_nelmts; /* total selected elmts */ + + /* Stripmine info */ + hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ + hsize_t sm_nbytes; /* bytes per stripmine */ + hsize_t sm_nelmts; /* elements per stripmine*/ + unsigned char *sm_buf = NULL; /* buffer for raw data */ + hid_t sm_space; /* stripmine data space */ + + /* Hyperslab info */ + hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */ + hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */ + hsize_t hs_nelmts; /* elements in request */ + + /* VL data special information */ + unsigned int vl_data = 0; /* contains VL datatypes */ + + f_space = H5Dget_space(dset); + + if (f_space == FAIL) + return FAIL; + + ctx->ndims = H5Sget_simple_extent_ndims(f_space); + + if ((size_t)ctx->ndims > NELMTS(sm_size)) { + H5Sclose(f_space); + return FAIL; + } + + /* Assume entire data space to be printed */ + if (ctx->ndims > 0) + for (i = 0; i < (size_t)ctx->ndims; i++) + ctx->p_min_idx[i] = 0; + + H5Sget_simple_extent_dims(f_space, total_size, NULL); + + /* calculate the number of elements we're going to print */ + p_nelmts = 1; + + if (ctx->ndims > 0) { + for (i = 0; i < ctx->ndims; i++) + p_nelmts *= total_size[i]; + ctx->size_last_dim = (total_size[ctx->ndims - 1]); + } /* end if */ + else + ctx->size_last_dim = 0; + + if (p_nelmts == 0) { + /* nothing to print */ + H5Sclose(f_space); + return SUCCEED; + } + + /* Check if we have VL data in the dataset's datatype */ + if (h5tools_detect_vlen_str(p_type) == TRUE) + vl_data = TRUE; + if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + vl_data = TRUE; + + /* + * Determine the strip mine size and allocate a buffer. The strip mine is + * a hyperslab whose size is manageable. + */ + sm_nbytes = p_type_nbytes = H5Tget_size(p_type); + + if (ctx->ndims > 0) { + for (i = ctx->ndims; i > 0; --i) { + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + sm_size[i - 1] = MIN(total_size[i - 1], size); + sm_nbytes *= sm_size[i - 1]; + HDassert(sm_nbytes > 0); + } + } + + if(!sm_nbytes) + goto done; + + HDassert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ + sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes); + + sm_nelmts = sm_nbytes / p_type_nbytes; + sm_space = H5Screate_simple(1, &sm_nelmts, NULL); + + if (ctx->ndims > 0) + init_acc_pos(ctx, total_size); + + /* The stripmine loop */ + HDmemset(hs_offset, 0, sizeof hs_offset); + HDmemset(zero, 0, sizeof zero); + + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { + /* Calculate the hyperslab size */ + if (ctx->ndims > 0) { + for (i = 0, hs_nelmts = 1; i < ctx->ndims; i++) { + hs_size[i] = MIN(total_size[i] - hs_offset[i], sm_size[i]); + ctx->p_max_idx[i] = ctx->p_min_idx[i] + hs_size[i]; + hs_nelmts *= hs_size[i]; + } + + H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL); + H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL); + } + else { + H5Sselect_all(f_space); + H5Sselect_all(sm_space); + hs_nelmts = 1; + } + + /* Read the data */ + if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) { + H5Sclose(f_space); + H5Sclose(sm_space); + HDfree(sm_buf); + return FAIL; + } + + /* Print the data */ + flags = (elmtno == 0) ? START_OF_DATA : 0; + flags |= ((elmtno + hs_nelmts) >= p_nelmts) ? END_OF_DATA : 0; + + /* initialize the current stripmine position; this is necessary to print the array + indices */ + ctx->sm_pos = elmtno; + + h5tools_dump_simple_data(stream, info, dset, ctx, flags, hs_nelmts, p_type, sm_buf); + + /* Reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); + + /* Calculate the next hyperslab offset */ + for (i = ctx->ndims, carry = 1; i > 0 && carry; --i) { + ctx->p_min_idx[i - 1] = ctx->p_max_idx[i - 1]; + hs_offset[i - 1] += hs_size[i - 1]; + + if (hs_offset[i - 1] == total_size[i - 1]) + hs_offset[i - 1] = 0; + else + carry = 0; + } + + ctx->continuation++; + } + + HDfree(sm_buf); + +done: + H5Sclose(sm_space); + H5Sclose(f_space); + + return SUCCEED; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_dump_simple_mem + * + * Purpose: Print some values from memory with a simple data space. + * This is a special case of h5tools_dump_mem(). + * + * Return: Success: SUCCEED + * Failure: FAIL + * + *------------------------------------------------------------------------- + */ +static int +h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t obj_id, + hid_t type, hid_t space, void *mem) +{ + int i; /*counters */ + hsize_t nelmts; /*total selected elmts */ + + ctx->ndims = H5Sget_simple_extent_ndims(space); + + if ((size_t) ctx->ndims > NELMTS(ctx->p_min_idx)) + return FAIL; + + /* Assume entire data space to be printed */ + for (i = 0; i < ctx->ndims; i++) + ctx->p_min_idx[i] = 0; + + H5Sget_simple_extent_dims(space, ctx->p_max_idx, NULL); + + for (i = 0, nelmts = 1; ctx->ndims != 0 && i < ctx->ndims; i++) + nelmts *= ctx->p_max_idx[i] - ctx->p_min_idx[i]; + + if (nelmts == 0) + return SUCCEED; /*nothing to print*/ + if (ctx->ndims > 0) { + HDassert(ctx->p_max_idx[ctx->ndims - 1] == (hsize_t) ((int) ctx->p_max_idx[ctx->ndims - 1])); + ctx->size_last_dim = (int) (ctx->p_max_idx[ctx->ndims - 1]); + } /* end if */ + else + ctx->size_last_dim = 0; + + if (ctx->ndims > 0) + init_acc_pos(ctx, ctx->p_max_idx); + + h5tools_dump_simple_data(stream, info, obj_id, ctx, START_OF_DATA | END_OF_DATA, nelmts, type, mem); + + return SUCCEED; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_dump_dset + * + * Purpose: Print some values from a dataset DSET to the file STREAM + * after converting all types to P_TYPE (which should be a + * native type). If P_TYPE is a negative value then it will be + * computed from the dataset type using only native types. + * + * Note: This function is intended only for datasets since it does + * some things like strip mining which are unnecessary for + * smaller objects such as attributes. The easiest way to print + * small objects is to read the object into memory and call + * h5tools_dump_mem(). + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Modifications: + * Robb Matzke, 1999-06-07 + * If info->raw is set then the memory datatype will be the same + * as the file datatype. + * + * Bill Wendling, 2001-02-27 + * Renamed to ``h5tools_dump_dset'' and added the subsetting + * parameter. + * + *------------------------------------------------------------------------- + */ +int +h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hid_t dset, hid_t _p_type, struct subset_t *sset) +{ + hid_t f_space; + hid_t p_type = _p_type; + hid_t f_type; + H5S_class_t space_type; + int status = FAIL; + h5tool_format_t info_dflt; + /* Use default values */ + if (!stream) + stream = rawoutstream; + + if (!info) { + HDmemset(&info_dflt, 0, sizeof info_dflt); + info = &info_dflt; + } + + if (p_type < 0) { + f_type = H5Dget_type(dset); + + if (info->raw || bin_form == 1) + p_type = H5Tcopy(f_type); + else if (bin_form == 2) + p_type = h5tools_get_little_endian_type(f_type); + else if (bin_form == 3) + p_type = h5tools_get_big_endian_type(f_type); + else + p_type = h5tools_get_native_type(f_type); + + H5Tclose(f_type); + + if (p_type < 0) + goto done; + } + + /* Check the data space */ + f_space = H5Dget_space(dset); + + space_type = H5Sget_simple_extent_type(f_space); + + /* Print the data */ + if (space_type == H5S_SIMPLE || space_type == H5S_SCALAR) { + if(!sset) + status = h5tools_dump_simple_dset(rawdatastream, info, ctx, dset, p_type); + else + status = h5tools_dump_simple_subset(stream, info, ctx, dset, p_type, sset); + } + else + /* space is H5S_NULL */ + status = SUCCEED; + + /* Close the dataspace */ + H5Sclose(f_space); + +done: + if (p_type != _p_type) + H5Tclose(p_type); + + return status; +} + +/*------------------------------------------------------------------------- + * Function: h5tools_dump_mem + * + * Purpose: Displays the data contained in MEM. MEM must have the + * specified data TYPE and SPACE. Currently only simple data + * spaces are allowed and only the `all' selection. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + *------------------------------------------------------------------------- + */ +int +h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, + hid_t obj_id, hid_t type, hid_t space, void *mem) +{ + HERR_INIT(int, SUCCEED) + h5tool_format_t info_dflt; + + /* Use default values */ + if (!stream) + stream = rawoutstream; + + if (!info) { + HDmemset(&info_dflt, 0, sizeof(info_dflt)); + info = &info_dflt; + } + + /* Check the data space */ + if (H5Sis_simple(space) <= 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sis_simple failed") + + H5_LEAVE(h5tools_dump_simple_mem(stream, info, ctx, obj_id, type, space, mem)) + +CATCH + return ret_value; +} + +/*------------------------------------------------------------------------- + * Function: print_datatype + * + * Purpose: print the datatype - do not prefix. + * + * Return: void + * + * In/Out: h5tools_str_t *buffer + * h5tools_context_t *ctx + * + *------------------------------------------------------------------------- + */ +int +h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t type, int object_search) +{ + HERR_INIT(int, SUCCEED) + char *mname; + hid_t mtype = -1; + hid_t str_type = -1; + hid_t super = -1; + hid_t tmp_type = -1; + int snmembers; + int sndims; + unsigned nmembers; + unsigned i; + size_t size = 0; + size_t ncols = 80; /*available output width */ + hsize_t dims[H5TOOLS_DUMP_MAX_RANK]; + hsize_t curr_pos = 0; /* total data element position */ + H5T_str_t str_pad; + H5T_cset_t cset; + H5T_order_t order; + H5T_class_t type_class; + H5T_sign_t sign; /* sign scheme value */ + htri_t is_vlstr = FALSE; + const char *sign_s = NULL; /* sign scheme string */ + const char *order_s = NULL; /* byte order string */ + + if((type_class = H5Tget_class(type)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed"); + if (object_search && H5Tcommitted(type) > 0) { + H5O_info_t oinfo; + obj_t *obj = NULL; /* Found object */ + + H5Oget_info(type, &oinfo); + obj = search_obj(h5dump_type_table, oinfo.addr); + + if(obj) { + if(!obj->recorded) { + h5tools_str_append(buffer,"\"/#"H5_PRINTF_HADDR_FMT"\"", obj->objno); + } + else + h5tools_str_append(buffer, "\"%s\"", obj->objname); + } + else { + error_msg("unknown committed type.\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + return ret_value; + } + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + switch (type_class) { + case H5T_INTEGER: + if (H5Tequal(type, H5T_STD_I8BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I8BE"); + } + else if (H5Tequal(type, H5T_STD_I8LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I8LE"); + } + else if (H5Tequal(type, H5T_STD_I16BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I16BE"); + } + else if (H5Tequal(type, H5T_STD_I16LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I16LE"); + } + else if (H5Tequal(type, H5T_STD_I32BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I32BE"); + } + else if (H5Tequal(type, H5T_STD_I32LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I32LE"); + } + else if (H5Tequal(type, H5T_STD_I64BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I64BE"); + } + else if (H5Tequal(type, H5T_STD_I64LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_I64LE"); + } + else if (H5Tequal(type, H5T_STD_U8BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U8BE"); + } + else if (H5Tequal(type, H5T_STD_U8LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U8LE"); + } + else if (H5Tequal(type, H5T_STD_U16BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U16BE"); + } + else if (H5Tequal(type, H5T_STD_U16LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U16LE"); + } + else if (H5Tequal(type, H5T_STD_U32BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U32BE"); + } + else if (H5Tequal(type, H5T_STD_U32LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U32LE"); + } + else if (H5Tequal(type, H5T_STD_U64BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U64BE"); + } + else if (H5Tequal(type, H5T_STD_U64LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_U64LE"); + } + else if (H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_SCHAR"); + } + else if (H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_UCHAR"); + } + else if (H5Tequal(type, H5T_NATIVE_SHORT) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_SHORT"); + } + else if (H5Tequal(type, H5T_NATIVE_USHORT) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_USHORT"); + } + else if (H5Tequal(type, H5T_NATIVE_INT) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_INT"); + } + else if (H5Tequal(type, H5T_NATIVE_UINT) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_UINT"); + } + else if (H5Tequal(type, H5T_NATIVE_LONG) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_LONG"); + } + else if (H5Tequal(type, H5T_NATIVE_ULONG) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_ULONG"); + } + else if (H5Tequal(type, H5T_NATIVE_LLONG) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_LLONG"); + } + else if (H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_ULLONG"); + } + else { + + /* byte order */ + if (H5Tget_size(type) > 1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE == order) { + order_s = " little-endian"; + } + else if (H5T_ORDER_BE == order) { + order_s = " big-endian"; + } + else if (H5T_ORDER_VAX == order) { + order_s = " mixed-endian"; + } + else { + order_s = " unknown-byte-order"; + } + } + else { + order_s = ""; + } + + /* sign */ + if ((sign = H5Tget_sign(type)) >= 0) { + if (H5T_SGN_NONE == sign) { + sign_s = " unsigned"; + } + else if (H5T_SGN_2 == sign) { + sign_s = ""; + } + else { + sign_s = " unknown-sign"; + } + } + else { + sign_s = " unknown-sign"; + } + + /* print size, order, and sign */ + h5tools_str_append(buffer, "%lu-bit%s%s integer", + (unsigned long) (8 * H5Tget_size(type)), order_s, sign_s); + } + break; + + case H5T_FLOAT: + if (H5Tequal(type, H5T_IEEE_F32BE) == TRUE) { + h5tools_str_append(buffer, "H5T_IEEE_F32BE"); + } + else if (H5Tequal(type, H5T_IEEE_F32LE) == TRUE) { + h5tools_str_append(buffer, "H5T_IEEE_F32LE"); + } + else if (H5Tequal(type, H5T_IEEE_F64BE) == TRUE) { + h5tools_str_append(buffer, "H5T_IEEE_F64BE"); + } + else if (H5Tequal(type, H5T_IEEE_F64LE) == TRUE) { + h5tools_str_append(buffer, "H5T_IEEE_F64LE"); + } + else if (H5Tequal(type, H5T_VAX_F32) == TRUE) { + h5tools_str_append(buffer, "H5T_VAX_F32"); + } + else if (H5Tequal(type, H5T_VAX_F64) == TRUE) { + h5tools_str_append(buffer, "H5T_VAX_F64"); + } + else if (H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_FLOAT"); + } + else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_DOUBLE"); +#if H5_SIZEOF_LONG_DOUBLE !=0 + } + else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) { + h5tools_str_append(buffer, "H5T_NATIVE_LDOUBLE"); +#endif + } + else { + + /* byte order */ + if (H5Tget_size(type) > 1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE == order) { + order_s = " little-endian"; + } + else if (H5T_ORDER_BE == order) { + order_s = " big-endian"; + } + else if (H5T_ORDER_VAX == order) { + order_s = " mixed-endian"; + } + else { + order_s = " unknown-byte-order"; + } + } + else { + order_s = ""; + } + + /* print size and byte order */ + h5tools_str_append(buffer, "%lu-bit%s floating-point", + (unsigned long) (8 * H5Tget_size(type)), order_s); + + } + break; + + case H5T_TIME: + h5tools_str_append(buffer, "H5T_TIME: not yet implemented"); + break; + + case H5T_STRING: + /* Make a copy of type in memory in case when TYPE is on disk, the size + * will be bigger than in memory. This makes it easier to compare + * types in memory. */ + tmp_type = H5Tcopy(type); + size = H5Tget_size(tmp_type); + str_pad = H5Tget_strpad(tmp_type); + cset = H5Tget_cset(tmp_type); + is_vlstr = H5Tis_variable_str(tmp_type); + + curr_pos = ctx->cur_column; + h5tools_str_append(buffer, "H5T_STRING %s", h5tools_dump_header_format->strblockbegin); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + + if (is_vlstr) + h5tools_str_append(buffer, "%s H5T_VARIABLE;", STRSIZE); + else + h5tools_str_append(buffer, "%s %d;", STRSIZE, (int) size); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "%s ", STRPAD); + if (str_pad == H5T_STR_NULLTERM) + h5tools_str_append(buffer, "H5T_STR_NULLTERM;"); + else if (str_pad == H5T_STR_NULLPAD) + h5tools_str_append(buffer, "H5T_STR_NULLPAD;"); + else if (str_pad == H5T_STR_SPACEPAD) + h5tools_str_append(buffer, "H5T_STR_SPACEPAD;"); + else + h5tools_str_append(buffer, "H5T_STR_ERROR;"); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + + h5tools_str_append(buffer, "%s ", CSET); + + if (cset == H5T_CSET_ASCII) + h5tools_str_append(buffer, "H5T_CSET_ASCII;"); + else + h5tools_str_append(buffer, "unknown_cset;"); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + + str_type = H5Tcopy(H5T_C_S1); + if (is_vlstr) + H5Tset_size(str_type, H5T_VARIABLE); + else + H5Tset_size(str_type, size); + H5Tset_cset(str_type, cset); + H5Tset_strpad(str_type, str_pad); + + h5tools_str_append(buffer, "%s ", CTYPE); + + /* Check C variable-length string first. Are the two types equal? */ + if (H5Tequal(tmp_type, str_type)) { + h5tools_str_append(buffer, "H5T_C_S1;"); + goto done; + } + + /* Change the endianness and see if they're equal. */ + order = H5Tget_order(tmp_type); + if (order == H5T_ORDER_LE) + H5Tset_order(str_type, H5T_ORDER_LE); + else if (order == H5T_ORDER_BE) + H5Tset_order(str_type, H5T_ORDER_BE); + + if (H5Tequal(tmp_type, str_type)) { + h5tools_str_append(buffer, "H5T_C_S1;"); + goto done; + } + + /* If not equal to C variable-length string, check Fortran type. */ + if(H5Tclose(str_type) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + str_type = H5Tcopy(H5T_FORTRAN_S1); + + H5Tset_cset(str_type, cset); + H5Tset_size(str_type, size); + H5Tset_strpad(str_type, str_pad); + + /* Are the two types equal? */ + if (H5Tequal(tmp_type, str_type)) { + h5tools_str_append(buffer, "H5T_FORTRAN_S1;"); + goto done; + } + + /* Change the endianness and see if they're equal. */ + order = H5Tget_order(tmp_type); + if (order == H5T_ORDER_LE) + H5Tset_order(str_type, H5T_ORDER_LE); + else if (order == H5T_ORDER_BE) + H5Tset_order(str_type, H5T_ORDER_BE); + + if (H5Tequal(tmp_type, str_type)) { + h5tools_str_append(buffer, "H5T_FORTRAN_S1;"); + goto done; + } + + /* Type doesn't match any of above. */ + h5tools_str_append(buffer, "unknown_one_character_type;"); + + done: + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + if(H5Tclose(str_type) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + if(H5Tclose(tmp_type) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->strblockend); + break; + + case H5T_BITFIELD: + if (H5Tequal(type, H5T_STD_B8BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B8BE"); + } + else if (H5Tequal(type, H5T_STD_B8LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B8LE"); + } + else if (H5Tequal(type, H5T_STD_B16BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B16BE"); + } + else if (H5Tequal(type, H5T_STD_B16LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B16LE"); + } + else if (H5Tequal(type, H5T_STD_B32BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B32BE"); + } + else if (H5Tequal(type, H5T_STD_B32LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B32LE"); + } + else if (H5Tequal(type, H5T_STD_B64BE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B64BE"); + } + else if (H5Tequal(type, H5T_STD_B64LE) == TRUE) { + h5tools_str_append(buffer, "H5T_STD_B64LE"); + } + else { + h5tools_str_append(buffer, "undefined bitfield"); + } + break; + + case H5T_OPAQUE: + h5tools_str_append(buffer, "H5T_OPAQUE %s", h5tools_dump_header_format->structblockbegin); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + ctx->indent_level++; + { + char *ttag = H5Tget_tag(type); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + if (ttag) + HDfree(ttag); + } + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); + break; + + case H5T_COMPOUND: + if((snmembers = H5Tget_nmembers(type)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + nmembers = (unsigned)snmembers; + + h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + for (i = 0; i < nmembers; i++) { + mname = H5Tget_member_name(type, i); + if((mtype = H5Tget_member_type(type, i))>=0) { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_print_datatype(stream, buffer, info, ctx, mtype, TRUE); + + h5tools_str_append(buffer, " \"%s\";", mname); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + if(H5Tclose(mtype) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + } + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_member_type failed"); + HDfree(mname); + } + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->structblockend); + break; + + case H5T_REFERENCE: + h5tools_str_append(buffer, "H5T_REFERENCE"); + if (H5Tequal(type, H5T_STD_REF_DSETREG) == TRUE) { + h5tools_str_append(buffer, " { H5T_STD_REF_DSETREG }"); + } + else { + h5tools_str_append(buffer, " { H5T_STD_REF_OBJECT }"); + } + break; + + case H5T_ENUM: + if((super = H5Tget_super(type)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + + h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->enumblockbegin); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); + + if(H5Tclose(super) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + h5tools_str_append(buffer, ";"); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + + h5tools_print_enum(stream, buffer, info, ctx, type); + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->enumblockend); + + break; + + case H5T_VLEN: + if((super = H5Tget_super(type)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + + h5tools_str_append(buffer, "H5T_VLEN %s ", h5tools_dump_header_format->vlenblockbegin); + + h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); + + if(H5Tclose(super) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + + h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend); + + break; + + case H5T_ARRAY: + h5tools_str_append(buffer, "H5T_ARRAY { "); + + /* Get array information */ + if((sndims = H5Tget_array_ndims(type)) >= 0) { + unsigned ndims = (unsigned)sndims; + + if(H5Tget_array_dims2(type, dims) >= 0) { + /* Print array dimensions */ + for (i = 0; i < ndims; i++) + h5tools_str_append(buffer, "[" HSIZE_T_FORMAT "]", dims[i]); + + h5tools_str_append(buffer, " "); + } + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_array_dims2 failed"); + } + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_array_ndims failed"); + + /* Get array base type */ + if((super = H5Tget_super(type)) >= 0) { + /* Print base type */ + h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); + /* Close array base type */ + if(H5Tclose(super) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + } + else + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_super failed"); + + h5tools_str_append(buffer, " }"); + + break; + + default: + h5tools_str_append(buffer, "unknown datatype"); + break; + } + +CATCH + return ret_value; +} + +/*------------------------------------------------------------------------- + * Function: print_dataspace + * + * Purpose: print the dataspace. + * + * Return: void + * + * In/Out: h5tools_str_t *buffer + * h5tools_context_t *ctx + * + *------------------------------------------------------------------------- + */ +int +h5tools_print_dataspace(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t space) +{ + HERR_INIT(int, SUCCEED) + hsize_t size[H5TOOLS_DUMP_MAX_RANK]; + hsize_t maxsize[H5TOOLS_DUMP_MAX_RANK]; + int ndims = -1; + H5S_class_t space_type = -1; + int i; + + if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + + if((space_type = H5Sget_simple_extent_type(space)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed"); + + switch(space_type) { + case H5S_SCALAR: + /* scalar dataspace */ + h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedescriptionbegin, S_SCALAR); + break; + + case H5S_SIMPLE: + /* simple dataspace */ + h5tools_str_append(buffer, "%s %s { %s " HSIZE_T_FORMAT, + h5tools_dump_header_format->dataspacedescriptionbegin, S_SIMPLE, + h5tools_dump_header_format->dataspacedimbegin, size[0]); + + for(i = 1; i < ndims; i++) + h5tools_str_append(buffer, ", " HSIZE_T_FORMAT, size[i]); + + h5tools_str_append(buffer, " %s / ", h5tools_dump_header_format->dataspacedimend); + + if(maxsize[0] == H5S_UNLIMITED) + h5tools_str_append(buffer, "%s %s", + h5tools_dump_header_format->dataspacedimbegin, "H5S_UNLIMITED"); + else + h5tools_str_append(buffer, "%s " HSIZE_T_FORMAT, + h5tools_dump_header_format->dataspacedimbegin, maxsize[0]); + + for(i = 1; i < ndims; i++) + if(maxsize[i] == H5S_UNLIMITED) + h5tools_str_append(buffer, ", %s", "H5S_UNLIMITED"); + else + h5tools_str_append(buffer, ", " HSIZE_T_FORMAT, maxsize[i]); + + h5tools_str_append(buffer, " %s }", h5tools_dump_header_format->dataspacedimend); + break; + + case H5S_NULL: + /* null dataspace */ + h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedescriptionbegin, S_NULL); + break; + + case H5S_NO_CLASS: + default: + h5tools_str_append(buffer, "%s unknown dataspace %s\n", BEGIN, END); + break; + } /* end switch */ + +CATCH + return ret_value; +} + + +/*------------------------------------------------------------------------- + * Function: print_enum + * + * Purpose: prints the enum data + * + * Return: void + * + * In/Out: h5tools_str_t *buffer + * h5tools_context_t *ctx + * + *-----------------------------------------------------------------------*/ +int +h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t type) +{ + HERR_INIT(int, SUCCEED) + char **name = NULL; /*member names */ + unsigned char *value = NULL; /*value array */ + unsigned char *copy = NULL; /*a pointer to value array */ + unsigned i; + unsigned nmembs = 0; /*number of members */ + int snmembs; + int nchars; /*number of output characters */ + hid_t super = -1; /*enum base integer type */ + hid_t native = -1; /*native integer datatype */ + H5T_sign_t sign_type; /*sign of value type */ + size_t type_size; /*value type size */ + size_t dst_size; /*destination value type size */ + size_t ncols = 80; /*available output width */ + hsize_t curr_pos = 0; /* total data element position */ + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + if((snmembs = H5Tget_nmembers(type)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + nmembs = (unsigned)snmembs; + HDassert(nmembs > 0); + + if((super = H5Tget_super(type)) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); + + if((type_size = H5Tget_size(type)) <= 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed"); + + /* + * Determine what datatype to use for the native values. To simplify + * things we entertain three possibilities: + * 1. long long -- the largest native signed integer + * 2. unsigned long long -- the largest native unsigned integer + * 3. raw format + */ + if(type_size <= sizeof(long long)) { + dst_size = sizeof(long long); + + if((sign_type = H5Tget_sign(type))<0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed"); + if(H5T_SGN_NONE == sign_type) + native = H5T_NATIVE_ULLONG; + else + native = H5T_NATIVE_LLONG; + } /* end if */ + else + dst_size = type_size; + + /* Get the names and raw values of all members */ + if(NULL == (name = (char **)HDcalloc(nmembs, sizeof(char *)))) + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name"); + if(NULL == (value = (unsigned char *)HDcalloc(nmembs, MAX(type_size, dst_size)))) + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value"); + + for (i = 0; i < nmembs; i++) { + name[i] = H5Tget_member_name(type, i); + if(H5Tget_member_value(type, i, value + i * type_size) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed"); + } + + /* Convert values to native datatype */ + if (native > 0) + if(H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed"); + + /* + * Sort members by increasing value + * ***not implemented yet*** + */ + + /* Print members */ + for (i = 0; i < nmembs; i++) { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "\"%s\"", name[i]); + nchars = HDstrlen(name[i]); + h5tools_str_append(buffer, "%*s ", MAX(0, 16 - nchars), ""); + + if (native < 0) { + size_t j; + + h5tools_str_append(buffer, "0x"); + + for (j = 0; j < dst_size; j++) + h5tools_str_append(buffer, "%02x", value[i * dst_size + j]); + } + else if (H5T_SGN_NONE == H5Tget_sign(native)) { + /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" + *strangely, unless use another pointer "copy".*/ + copy = value + i * dst_size; + h5tools_str_append(buffer, HSIZE_T_FORMAT, *((unsigned long long *) ((void *) copy))); + } + else { + /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" + *strangely, unless use another pointer "copy".*/ + copy = value + i * dst_size; + h5tools_str_append(buffer, "%" H5_PRINTF_LL_WIDTH "d", *((long long *) ((void *) copy))); + } + + h5tools_str_append(buffer, ";"); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); + } + +CATCH + if(name) { + /* Release resources */ + for(i = 0; i < nmembs; i++) + if(name[i]) + HDfree(name[i]); + HDfree(name); + } /* end if */ + + if(value) + HDfree(value); + + if(super >= 0 && H5Tclose(super) < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class"); + + if(0 == nmembs) + h5tools_str_append(buffer, "\n"); + + return ret_value; +} + +/*------------------------------------------------------------------------- + * Function: dump_datatype + * + * Purpose: Dump the datatype. Datatype can be HDF5 predefined + * atomic datatype or committed/transient datatype. + * + * Return: void + * + * In/Out: h5tools_context_t *ctx + *------------------------------------------------------------------------- + */ +void +h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t type) +{ + h5tools_str_t buffer; /* string into which to render */ + size_t ncols = 80; /* available output width */ + hsize_t curr_pos = ctx->sm_pos; /* total data element position */ + /* pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + ctx->need_prefix = TRUE; + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s ", + h5tools_dump_header_format->datatypebegin, + h5tools_dump_header_format->datatypeblockbegin); + h5tools_print_datatype(stream, &buffer, info, ctx, type, TRUE); + if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeblockend); + if (HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(&buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->datatypeend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend); + + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_dataspace + * + * Purpose: Dump the dataspace. + * + * Return: void + * + * In/Out: h5tools_context_t *ctx + *------------------------------------------------------------------------- + */ +void +h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t type) +{ + h5tools_str_t buffer; /* string into which to render */ + size_t ncols = 80; /* available output width */ + hsize_t curr_pos = ctx->sm_pos; /* total data element position */ + /* pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + ctx->need_prefix = TRUE; + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s ", + h5tools_dump_header_format->dataspacebegin); + + h5tools_print_dataspace(stream, &buffer, info, ctx, type); + + if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataspaceblockend); + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(&buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->dataspaceend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataspaceend); + + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_oid + * + * Purpose: Dump the oid. + * + * Return: void + * + * In/Out: h5tools_context_t *ctx + *------------------------------------------------------------------------- + */ +void +h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t oid) +{ + h5tools_str_t buffer; /* string into which to render */ + size_t ncols = 80; /* available output width */ + hsize_t curr_pos = ctx->sm_pos; /* total data element position */ + /* pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s %d %s", OBJID, BEGIN, oid, END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + h5tools_str_close(&buffer); +} + + +/*------------------------------------------------------------------------- + * Function: dump_fill_value + * + * Purpose: prints the fill value + * + * Return: void + * + * Programmer: pvn + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, hid_t dcpl, hid_t type_id, hid_t obj_id) +{ + size_t size; + hid_t n_type; + hsize_t nelmts = 1; + void *buf = NULL; + + n_type = h5tools_get_native_type(type_id); + + size = H5Tget_size(n_type); + buf = HDmalloc(size); + + H5Pget_fill_value(dcpl, n_type, buf); + + h5tools_str_sprint(buffer, info, obj_id, n_type, buf, ctx); + + H5Tclose(n_type); + + if (buf) + HDfree (buf); +} + +/*------------------------------------------------------------------------- + * Function: dump_dcpl + * + * Purpose: prints several dataset create property list properties + * + * Return: void + * + * Modifications: pvn, March 28, 2008 + * Add a COMPRESSION ratio information for cases when filters are present + * + *------------------------------------------------------------------------- + */ +void +h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t dcpl_id,hid_t type_id, hid_t obj_id) +{ + int nfilters; /* number of filters */ + int rank; /* rank */ + int i; + unsigned j; + unsigned filt_flags; /* filter flags */ + unsigned cd_values[20]; /* filter client data values */ + unsigned szip_options_mask; + unsigned szip_pixels_per_block; + H5Z_filter_t filtn; /* filter identification number */ + H5D_fill_value_t fvstatus; + H5D_alloc_time_t at; + H5D_fill_time_t ft; + size_t ncols = 80; /* available output width */ + size_t cd_nelmts; /* filter client number of values */ + off_t offset; /* offset of external file */ + char f_name[256]; /* filter name */ + char name[256]; /* external file name */ + hsize_t chsize[64]; /* chunk size in elements */ + hsize_t size; /* size of external file */ + hsize_t storage_size; + hsize_t curr_pos = 0; /* total data element position */ + hsize_t elmt_counter = 0;/* counts the # elements printed.*/ + haddr_t ioffset; + h5tools_str_t buffer; /* string into which to render */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + if (info->line_ncols > 0) + ncols = info->line_ncols; + + storage_size = H5Dget_storage_size(obj_id); + nfilters = H5Pget_nfilters(dcpl_id); + ioffset = H5Dget_offset(obj_id); + HDstrcpy(f_name,"\0"); + + /*------------------------------------------------------------------------- + * STORAGE_LAYOUT + *------------------------------------------------------------------------- + */ + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", STORAGE_LAYOUT, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + if(H5D_CHUNKED == H5Pget_layout(dcpl_id)) { + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s ", CHUNKED); + + rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize); + h5tools_str_append(&buffer, "%s " HSIZE_T_FORMAT, h5tools_dump_header_format->dataspacedimbegin, chsize[0]); + for(i = 1; i < rank; i++) + h5tools_str_append(&buffer, ", " HSIZE_T_FORMAT, chsize[i]); + h5tools_str_append(&buffer, " %s", h5tools_dump_header_format->dataspacedimend); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + + /* if there are filters, print a compression ratio */ + if(nfilters) { + hsize_t dims[H5S_MAX_RANK]; + hsize_t nelmts = 1; + double ratio = 0; + int ok = 0; + + hid_t tid = H5Dget_type(obj_id); + hid_t sid = H5Dget_space(obj_id); + size_t datum_size = H5Tget_size(tid); + int ndims = H5Sget_simple_extent_dims(sid, dims, NULL); + + /* only print the compression ratio for these filters */ + for(i = 0; i < nfilters; i++) { + cd_nelmts = NELMTS(cd_values); + filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, + cd_values, sizeof(f_name), f_name, NULL); + + switch(filtn) { + case H5Z_FILTER_DEFLATE: + case H5Z_FILTER_SZIP: + case H5Z_FILTER_NBIT: + case H5Z_FILTER_SCALEOFFSET: + ok = 1; + break; + } + } + + if(ndims && ok) { + hsize_t uncomp_size; + + for(i = 0; i < ndims; i++) { + nelmts *= dims[i]; + } + uncomp_size = nelmts * datum_size; + + /* compression ratio = uncompressed size / compressed size */ + + if(storage_size != 0) + ratio = (double) uncomp_size / (double) storage_size; + + h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT" (%.3f:1 COMPRESSION)", storage_size, ratio); + + } + else + h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size); + + H5Sclose(sid); + H5Tclose(tid); + + } + else { + h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size); + } + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + else if(H5D_COMPACT == H5Pget_layout(dcpl_id)) { + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", COMPACT); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + else if(H5D_CONTIGUOUS == H5Pget_layout(dcpl_id)) { + int next; + + next = H5Pget_external_count(dcpl_id); + + /*------------------------------------------------------------------------- + * EXTERNAL_FILE + *------------------------------------------------------------------------- + */ + if(next) { + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", CONTIGUOUS); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", EXTERNAL, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + for(j = 0; j < (unsigned)next; j++) { + H5Pget_external(dcpl_id, j, sizeof(name), name, &offset, &size); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "FILENAME %s SIZE " HSIZE_T_FORMAT, name, size); + h5tools_str_append(&buffer, " OFFSET %ld", offset); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + else { + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", CONTIGUOUS); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer,"SIZE " HSIZE_T_FORMAT, storage_size); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer,"OFFSET "H5_PRINTF_HADDR_FMT, ioffset); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + } + /*------------------------------------------------------------------------- + * FILTERS + *------------------------------------------------------------------------- + */ + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", FILTERS, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + if(nfilters) { + for(i = 0; i < nfilters; i++) { + cd_nelmts = NELMTS(cd_values); + filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, + cd_values, sizeof(f_name), f_name, NULL); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + switch(filtn) { + case H5Z_FILTER_DEFLATE: + h5tools_str_append(&buffer, "%s %s %s %d %s", DEFLATE, BEGIN, DEFLATE_LEVEL, cd_values[0], END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + break; + case H5Z_FILTER_SHUFFLE: + h5tools_str_append(&buffer, "%s", SHUFFLE); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + break; + case H5Z_FILTER_FLETCHER32: + h5tools_str_append(&buffer, "%s", FLETCHER32); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + break; + case H5Z_FILTER_SZIP: + { + szip_options_mask = cd_values[0];; + szip_pixels_per_block = cd_values[1]; + + h5tools_str_append(&buffer, "%s %s",SZIP, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "PIXELS_PER_BLOCK %d", szip_pixels_per_block); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + if(szip_options_mask & H5_SZIP_CHIP_OPTION_MASK) + h5tools_str_append(&buffer, "MODE %s", "HARDWARE"); + else if(szip_options_mask & H5_SZIP_ALLOW_K13_OPTION_MASK) + h5tools_str_append(&buffer, "MODE %s", "K13"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + if(szip_options_mask & H5_SZIP_EC_OPTION_MASK) + h5tools_str_append(&buffer, "CODING %s", "ENTROPY"); + else if(szip_options_mask & H5_SZIP_NN_OPTION_MASK) + h5tools_str_append(&buffer, "CODING %s", "NEAREST NEIGHBOUR"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + if(szip_options_mask & H5_SZIP_LSB_OPTION_MASK) + h5tools_str_append(&buffer, "BYTE_ORDER %s", "LSB"); + else if(szip_options_mask & H5_SZIP_MSB_OPTION_MASK) + h5tools_str_append(&buffer, "BYTE_ORDER %s", "MSB"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + if(szip_options_mask & H5_SZIP_RAW_OPTION_MASK) { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "HEADER %s", "RAW"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + break; + case H5Z_FILTER_NBIT: + h5tools_str_append(&buffer, "%s", NBIT); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + break; + case H5Z_FILTER_SCALEOFFSET: + h5tools_str_append(&buffer, "%s %s %s %d %s", SCALEOFFSET, BEGIN, SCALEOFFSET_MINBIT, cd_values[0], END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + break; + default: + if(H5Zfilter_avail(filtn)) + h5tools_str_append(&buffer, "%s %s", "USER_REGISTERED_FILTER", BEGIN); + else + h5tools_str_append(&buffer, "%s %s", "UNKNOWN_FILTER", BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "FILTER_ID %d", filtn); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + if(f_name[0] != '\0') { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "COMMENT %s", f_name); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + if (cd_nelmts) { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s ","PARAMS", BEGIN); + for (j=0; jindent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + break; + }/*switch*/ + } /*i*/ + }/*nfilters*/ + else { + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "NONE"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s",END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + /*------------------------------------------------------------------------- + * FILLVALUE + *------------------------------------------------------------------------- + */ + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", FILLVALUE, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "FILL_TIME "); + + H5Pget_fill_time(dcpl_id, &ft); + switch(ft) { + case H5D_FILL_TIME_ALLOC: + h5tools_str_append(&buffer, "%s", "H5D_FILL_TIME_ALLOC"); + break; + case H5D_FILL_TIME_NEVER: + h5tools_str_append(&buffer, "%s", "H5D_FILL_TIME_NEVER"); + break; + case H5D_FILL_TIME_IFSET: + h5tools_str_append(&buffer, "%s", "H5D_FILL_TIME_IFSET"); + break; + default: + HDassert(0); + break; + } + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s ", "VALUE "); + H5Pfill_value_defined(dcpl_id, &fvstatus); + if(fvstatus == H5D_FILL_VALUE_UNDEFINED) + h5tools_str_append(&buffer, "%s", "H5D_FILL_VALUE_UNDEFINED"); + else { + ctx->indent_level--; + h5tools_print_fill_value(&buffer, info, ctx, dcpl_id, type_id, obj_id); + ctx->indent_level++; + } + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + /*------------------------------------------------------------------------- + * ALLOCATION_TIME + *------------------------------------------------------------------------- + */ + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "ALLOCATION_TIME %s", BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + H5Pget_alloc_time(dcpl_id, &at); + switch(at) { + case H5D_ALLOC_TIME_EARLY: + h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_EARLY"); + break; + case H5D_ALLOC_TIME_INCR: + h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_INCR"); + break; + case H5D_ALLOC_TIME_LATE: + h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_LATE"); + break; + default: + HDassert(0); + break; + } + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_comment + * + * Purpose: prints the comment for the the object name + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void +h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t obj_id) +{ + char *comment = NULL; + ssize_t cmt_bufsize = -1; + size_t buf_size = 0; + size_t ncols = 80; /* available output width */ + h5tools_str_t buffer; /* string into which to render */ + hsize_t elmt_counter = 0;/* counts the # elements printed.*/ + hsize_t curr_pos = ctx->sm_pos; /* total data element position */ + /* pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + cmt_bufsize = H5Oget_comment(obj_id, comment, buf_size); + + /* call H5Oget_comment again with the correct value. + * If the call to H5Oget_comment returned an error, skip this block */ + if (cmt_bufsize > 0) { + comment = (char *)HDmalloc((size_t)(cmt_bufsize+1)); /* new_size including null terminator */ + if(comment) { + cmt_bufsize = H5Oget_comment(obj_id, comment, cmt_bufsize); + if(cmt_bufsize > 0) { + comment[cmt_bufsize] = '\0'; /* necessary because null char is not returned */ + + ctx->need_prefix = TRUE; + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "COMMENT \"%s\"", comment); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + h5tools_str_close(&buffer); + } /* end if */ + HDfree(comment); + } + } +} /* end dump_comment() */ + +/*------------------------------------------------------------------------- + * Function: dump_attribute + * + * Purpose: Dump the attribute. + * + * Return: void + * + * In/Out: h5tools_context_t *ctx + *------------------------------------------------------------------------- + */ +void +h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t oid, const char *attr_name, hid_t attr_id, + int display_index, int display_char) +{ + h5tools_str_t buffer; /* string into which to render */ + size_t ncols = 80; /* available output width */ + hsize_t elmt_counter = 0;/* counts the # elements printed.*/ + hsize_t curr_pos = ctx->sm_pos; /* total data element position */ + /* pass to the prefix in h5tools_simple_prefix the total position + * instead of the current stripmine position i; this is necessary + * to print the array indices + */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + + if (info->line_ncols > 0) + ncols = info->line_ncols; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s \"%s\" %s", + h5tools_dump_header_format->attributebegin, attr_name, + h5tools_dump_header_format->attributeblockbegin); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + if(attr_id < 0) { + error_msg("unable to open attribute \"%s\"\n", attr_name); + } + else { + hid_t type, space; + + ctx->indent_level++; + + type = H5Aget_type(attr_id); + h5tools_dump_datatype(stream, info, ctx, type); + + space = H5Aget_space(attr_id); + h5tools_dump_dataspace(stream, info, ctx, space); + + if(oid_output) + h5tools_dump_oid(stream, info, ctx, attr_id); + + if(data_output || attr_data_output) + h5tools_dump_data(stream, info, ctx, attr_id, FALSE, NULL, display_index, display_char); + + ctx->indent_level--; + + H5Tclose(type); + H5Sclose(space); + H5Aclose(attr_id); + } + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(&buffer); + + if (HDstrlen(h5tools_dump_header_format->attributeblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeblockend); + if (HDstrlen(h5tools_dump_header_format->attributeend)) + h5tools_str_append(&buffer, " "); + } + if (HDstrlen(h5tools_dump_header_format->attributeend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend); + + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_dims + * + * Purpose: Dump the dimensions handed to it in a comma separated list + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 27. February 2001 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims) +{ + int i; + + for (i = 0; i < dims; i++) { + h5tools_str_append(buffer, HSIZE_T_FORMAT, s[i]); + + if (i + 1 != dims) h5tools_str_append(buffer, ", "); + } +} + +/*------------------------------------------------------------------------- + * Function: print_packed_bits + * + * Purpose: Prints the packed bits offset and length + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void +h5tools_print_packed_bits(h5tools_str_t *buffer, hid_t type) +{ + int packed_bits_size = 0; + + hid_t n_type = h5tools_get_native_type(type); + if(H5Tget_class(n_type)==H5T_INTEGER) { + if(H5Tequal(n_type, H5T_NATIVE_SCHAR) == TRUE) { + packed_bits_size = 8 * sizeof(char); + } + else if(H5Tequal(n_type, H5T_NATIVE_UCHAR) == TRUE) { + packed_bits_size = 8 * sizeof(unsigned char); + } + else if(H5Tequal(n_type, H5T_NATIVE_SHORT) == TRUE) { + packed_bits_size = 8 * sizeof(short); + } + else if(H5Tequal(n_type, H5T_NATIVE_USHORT) == TRUE) { + packed_bits_size = 8 * sizeof(unsigned short); + } + else if(H5Tequal(n_type, H5T_NATIVE_INT) == TRUE) { + packed_bits_size = 8 * sizeof(int); + } + else if(H5Tequal(n_type, H5T_NATIVE_UINT) == TRUE) { + packed_bits_size = 8 * sizeof(unsigned int); + } + else if(H5Tequal(n_type, H5T_NATIVE_LONG) == TRUE) { + packed_bits_size = 8 * sizeof(long); + } + else if(H5Tequal(n_type, H5T_NATIVE_ULONG) == TRUE) { + packed_bits_size = 8 * sizeof(unsigned long); + } + else if(H5Tequal(n_type, H5T_NATIVE_LLONG) == TRUE) { + packed_bits_size = 8 * sizeof(long long); + } + else if(H5Tequal(n_type, H5T_NATIVE_ULLONG) == TRUE) { + packed_bits_size = 8 * sizeof(unsigned long long); + } + else + error_msg("Packed Bit not valid for this datatype"); + } + + if ((packed_bits_size>0) && (packed_data_offset + packed_data_length) > packed_bits_size) { + error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n", packed_data_offset+packed_data_length, packed_bits_size); + packed_data_mask = 0; + }; + h5tools_str_append(buffer, "%s %s=%d %s=%d", PACKED_BITS, PACKED_OFFSET, packed_data_offset, PACKED_LENGTH, packed_data_length); +} + +/*------------------------------------------------------------------------- + * Function: dump_subsetting_header + * + * Purpose: Dump the subsetting header like specified in the DDL. + * + * Return: void + * + * Programmer: Bill Wendling + * Tuesday, 27. February 2001 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, struct subset_t *sset, int dims) +{ + h5tools_str_t buffer; /* string into which to render */ + hsize_t curr_pos = 0; /* total data element position */ + size_t ncols = 80; /* available output width */ + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + if (info->line_ncols > 0) + ncols = info->line_ncols; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->subsettingbegin, h5tools_dump_header_format->subsettingblockbegin); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level++; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->startbegin, h5tools_dump_header_format->startblockbegin); + h5tools_print_dims(&buffer, sset->start.data, dims); + h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->startend, h5tools_dump_header_format->startblockend); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->stridebegin, h5tools_dump_header_format->strideblockbegin); + h5tools_print_dims(&buffer, sset->stride.data, dims); + h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->strideend, h5tools_dump_header_format->strideblockend); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->countbegin, h5tools_dump_header_format->countblockbegin); + + if(sset->count.data) + h5tools_print_dims(&buffer, sset->count.data, dims); + else + h5tools_str_append(&buffer, "DEFAULT"); + + h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->countend, h5tools_dump_header_format->countblockend); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, 0, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s ", h5tools_dump_header_format->blockbegin, h5tools_dump_header_format->blockblockbegin); + + if(sset->block.data) + h5tools_print_dims(&buffer, sset->block.data, dims); + else + h5tools_str_append(&buffer, "DEFAULT"); + + h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->blockend, h5tools_dump_header_format->blockblockend); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); + + ctx->indent_level--; + + h5tools_str_close(&buffer); +} + +/*------------------------------------------------------------------------- + * Function: dump_data + * + * Purpose: Dump attribute or dataset data + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void +h5tools_dump_data(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t obj_id, int obj_data, struct subset_t *sset, + int display_index, int display_char) +{ + H5S_class_t space_type; + int ndims; + int i; + hid_t space; + hid_t type; + hid_t p_type; + hsize_t size[64]; + hsize_t alloc_size; + hsize_t nelmts = 1; + int status = -1; + void *buf = NULL; + h5tools_str_t buffer; /* string into which to render */ + hsize_t curr_pos = 0; /* total data element position */ + size_t ncols = 80; /* available output width */ + h5tool_format_t string_dataformat; + h5tool_format_t outputformat; + + /* setup */ + HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + if (info->line_ncols > 0) + ncols = info->line_ncols; + + outputformat = *info; + string_dataformat = *info; + /* print the matrix indices */ + string_dataformat.pindex = display_index; + + /* do not print indices for regions */ + if(obj_data) { + hid_t f_type = H5Dget_type(obj_id); + + if (H5Tequal(f_type, H5T_STD_REF_DSETREG)) { + /* For the region option, correct the display of indices */ + if (region_output) { + if (!string_dataformat.pindex) { + string_dataformat.idx_fmt = ""; + string_dataformat.idx_n_fmt = ""; + string_dataformat.idx_sep = ""; + string_dataformat.line_pre = ""; + } + } + else + string_dataformat.pindex = 0; + } + H5Tclose(f_type); + } + + if (string_dataformat.pindex) { + string_dataformat.idx_fmt = "(%s): "; + string_dataformat.idx_n_fmt = HSIZE_T_FORMAT; + string_dataformat.idx_sep = ","; + string_dataformat.line_pre = "%s"; + } + info = &string_dataformat; + + if (sset && obj_data) { + hid_t f_space = H5Dget_space(obj_id); + + h5tools_dump_subsetting_header(stream, &outputformat, ctx, sset, H5Sget_simple_extent_ndims(f_space)); + H5Sclose(f_space); + + ctx->indent_level++; + } + + ctx->need_prefix = TRUE; + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", h5tools_dump_header_format->databegin, h5tools_dump_header_format->datablockbegin); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + + /* Print all the values. */ + if(obj_data) { + h5tools_context_t datactx = *ctx; /* print context */ + hid_t f_type = H5Dget_type(obj_id); + + if((display_char && H5Tget_size(f_type) == 1) && (H5Tget_class(f_type) == H5T_INTEGER)) { + /* + * Print 1-byte integer data as an ASCII character string + * instead of integers if the `-r' or `--string' command-line + * option was given. + * + * We don't want to modify the global dataformat, so make a + * copy of it instead. + */ + string_dataformat = *info; + string_dataformat.idx_fmt = "\""; + info = &string_dataformat; + datactx.indent_level++; + datactx.need_prefix = TRUE; + h5tools_simple_prefix(stream, info, &datactx, 0, 0); + + string_dataformat = *info; + string_dataformat.idx_fmt = "\""; + string_dataformat.line_multi_new = 1; + string_dataformat.str_repeat = 8; + string_dataformat.ascii = TRUE; + string_dataformat.elmt_suf1 = ""; + string_dataformat.elmt_suf2 = ""; + string_dataformat.line_suf = "\""; + info = &string_dataformat; + } + else + datactx.need_prefix = TRUE; + status = h5tools_dump_dset(stream, info, &datactx, obj_id, -1, sset); + if((display_char && H5Tget_size(f_type) == 1) && (H5Tget_class(f_type) == H5T_INTEGER)) { + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\""); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + H5Tclose(f_type); + } + else { + h5tools_context_t datactx = *ctx; /* print context */ + /* need to call h5tools_dump_mem for the attribute data */ + space = H5Aget_space(obj_id); + space_type = H5Sget_simple_extent_type(space); + if(space_type == H5S_NULL || space_type == H5S_NO_CLASS) { + status = SUCCEED; + } + else { + /* VL data special information */ + unsigned int vl_data = 0; /* contains VL datatypes */ + + type = H5Aget_type(obj_id); + p_type = h5tools_get_native_type(type); + + ndims = H5Sget_simple_extent_dims(space, size, NULL); + + /* Check if we have VL data in the dataset's datatype */ + if (h5tools_detect_vlen_str(p_type) == TRUE) + vl_data = TRUE; + if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + vl_data = TRUE; + + for (i = 0; i < ndims; i++) + nelmts *= size[i]; + + alloc_size = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); + HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + + if(alloc_size) { + buf = HDmalloc((size_t)alloc_size); + HDassert(buf); + + if (H5Aread(obj_id, p_type, buf) >= 0) + if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) { + /* + * Print 1-byte integer data as an ASCII character string + * instead of integers if the `-r' or `--string' command-line + * option was given. + * + * We don't want to modify the global dataformat, so make a + * copy of it instead. + */ + string_dataformat = *info; + string_dataformat.idx_fmt = "\""; + info = &string_dataformat; + datactx.indent_level++; + datactx.need_prefix = TRUE; + h5tools_simple_prefix(stream, info, &datactx, 0, 0); + + string_dataformat = *info; + string_dataformat.idx_fmt = "\""; + string_dataformat.line_multi_new = 1; + string_dataformat.str_repeat = 8; + string_dataformat.ascii = TRUE; + string_dataformat.elmt_suf1 = ""; + string_dataformat.elmt_suf2 = ""; + string_dataformat.line_suf = "\""; + info = &string_dataformat; + } + else + datactx.need_prefix = TRUE; + + status = h5tools_dump_mem(stream, info, &datactx, obj_id, p_type, space, buf); + if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) { + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\""); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + + /* Reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); + + HDfree(buf); + } + else + status = SUCCEED; + + H5Tclose(p_type); + H5Tclose(type); + } + H5Sclose(space); + } + + if (status == FAIL) { + error_msg("unable to print data\n"); + h5tools_setstatus(EXIT_FAILURE); + } + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, &outputformat, ctx, 0, 0); + + h5tools_str_reset(&buffer); + if(HDstrlen(h5tools_dump_header_format->datablockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datablockend); + if(HDstrlen(h5tools_dump_header_format->dataend)) + h5tools_str_append(&buffer, " "); + } + if(HDstrlen(h5tools_dump_header_format->dataend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataend); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + + if (sset && obj_data) { + ctx->indent_level--; + + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, &outputformat, ctx, 0, 0); + + h5tools_str_reset(&buffer); + if(HDstrlen(h5tools_dump_header_format->subsettingblockend)) { + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->subsettingblockend); + if(HDstrlen(h5tools_dump_header_format->subsettingend)) + h5tools_str_append(&buffer, " "); + } + if(HDstrlen(h5tools_dump_header_format->subsettingend)) + h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->subsettingend); + h5tools_render_element(stream, &outputformat, ctx, &buffer, &curr_pos, ncols, 0, 0); + } + + h5tools_str_close(&buffer); +} + diff --git a/tools/lib/h5tools_dump.h b/tools/lib/h5tools_dump.h new file mode 100644 index 0000000..c94d0e1 --- /dev/null +++ b/tools/lib/h5tools_dump.h @@ -0,0 +1,85 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Support h5dump functions for the various tools. + */ +#ifndef H5TOOLS_DUMP_H__ +#define H5TOOLS_DUMP_H__ + +#include "h5tools_utils.h" + +/* 3 private values: can't be set, but can be read. + Note: these are defined in H5Zprivate, they are + duplicated here. + */ +#define H5_SZIP_LSB_OPTION_MASK 8 +#define H5_SZIP_MSB_OPTION_MASK 16 +#define H5_SZIP_RAW_OPTION_MASK 128 + +#ifdef __cplusplus +extern "C" { +#endif + +H5TOOLS_DLLVAR table_t *h5dump_type_table; /*type table reference for datatype dump */ + +/* Definitions of useful routines */ +H5TOOLS_DLL void h5tools_dump_init(void); + +H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t dset, + hid_t p_typ, struct subset_t *sset); +H5TOOLS_DLL int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t obj_id, + hid_t type, hid_t space, void *mem); +H5TOOLS_DLL void h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, + h5tools_context_t *ctx/*in,out*/, unsigned flags, + hsize_t nelmts, hid_t type, void *_mem); +H5TOOLS_DLL void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t type); +H5TOOLS_DLL void h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t space); +H5TOOLS_DLL void h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t oid, const char *attr_name, + hid_t attr_id, int display_index, int display_char); +H5TOOLS_DLL void h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t oid); +H5TOOLS_DLL void h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t dcpl, hid_t type_id, hid_t obj_id); +H5TOOLS_DLL void h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx/*in,out*/, hid_t obj_id); +H5TOOLS_DLL void h5tools_dump_data(FILE *stream, const h5tool_format_t *info, + h5tools_context_t *ctx, hid_t obj_id, + int obj_data, struct subset_t *sset, int display_index, int display_char); + +H5TOOLS_DLL int h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer/*in,out*/, + const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t type, int object_search); +H5TOOLS_DLL int h5tools_print_dataspace(FILE *stream, h5tools_str_t *buffer/*in,out*/, + const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t space); +H5TOOLS_DLL int h5tools_print_enum(FILE *stream, h5tools_str_t *buffer/*in,out*/, + const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t type); +H5TOOLS_DLL void h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, + const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, + hid_t dcpl, hid_t type_id, hid_t obj_id); +H5TOOLS_DLL void h5tools_print_packed_bits(h5tools_str_t *buffer/*in,out*/, hid_t type); +#ifdef __cplusplus +} +#endif + +#endif /* H5TOOLS_DUMP_H__ */ + diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index e7d920c..1d99490 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -68,8 +68,8 @@ void h5tools_str_close(h5tools_str_t *str) { if (str && str->nalloc) { - free(str->s); - memset(str, 0, sizeof(h5tools_str_t)); + HDfree(str->s); + HDmemset(str, 0, sizeof(h5tools_str_t)); } } @@ -123,18 +123,13 @@ char * h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) { va_list ap; - hbool_t isReallocated = FALSE; /* Make sure we have some memory into which to print */ if (!str->s || str->nalloc <= 0) { - str->nalloc = STR_INIT_LEN; - str->s = malloc(str->nalloc); - assert(str->s); - str->s[0] = '\0'; - str->len = 0; + h5tools_str_reset(str); } - if (strlen(fmt) == 0) { + if (HDstrlen(fmt) == 0) { /* nothing to print */ return str->s; } @@ -145,9 +140,9 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) size_t avail = str->nalloc - str->len; int nchars = -1; - va_start(ap, fmt); + HDva_start(ap, fmt); nchars = HDvsnprintf(str->s + str->len, avail, fmt, ap); - va_end(ap); + HDva_end(ap); /* Note: HDvsnprintf() behaves differently on Windows as Unix, when * buffer is smaller than source string. On Unix, this function @@ -155,17 +150,21 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) * buffer size with NULL at the end of the buffer. However on * Windows with the same condition, this function returns -1 and * doesn't add NULL at the end of the buffer. - * Because of this different return results, isReallocated variable + * Because of this different return results, the strlen of the new string * is used to handle when HDvsnprintf() returns -1 on Windows due * to lack of buffer size, so try one more time after realloc more * buffer size before return NULL. */ - if (nchars < 0 && isReallocated == TRUE) { + if (nchars < 0 +#ifndef H5_VSNPRINTF_WORKS + && (HDstrlen(str->s) < str->nalloc) +#endif + ) { /* failure, such as bad format */ return NULL; } - if (nchars < 0 || (size_t) nchars >= avail || (0 == nchars && (strcmp(fmt, "%s")))) { + if (nchars < 0 || (size_t) nchars >= avail || (0 == nchars && (HDstrcmp(fmt, "%s")))) { /* Truncation return value as documented by C99, or zero return value with either of the * following conditions, each of which indicates that the proper C99 return value probably * should have been positive when the format string is @@ -173,11 +172,10 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) * Alocate at least twice as much space and try again. */ size_t newsize = MAX(str->len + nchars + 1, 2 * str->nalloc); - assert(newsize > str->nalloc); /*overflow*/ - str->s = realloc(str->s, newsize); - assert(str->s); + HDassert(newsize > str->nalloc); /*overflow*/ + str->s = HDrealloc(str->s, newsize); + HDassert(str->s); str->nalloc = newsize; - isReallocated = TRUE; } else { /* Success */ @@ -211,8 +209,8 @@ h5tools_str_reset(h5tools_str_t *str/*in,out*/) { if (!str->s || str->nalloc <= 0) { str->nalloc = STR_INIT_LEN; - str->s = malloc(str->nalloc); - assert(str->s); + str->s = HDmalloc(str->nalloc); + HDassert(str->s); } str->s[0] = '\0'; @@ -273,19 +271,19 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt) char _temp[1024], *temp = _temp; /* If the format string is simply "%s" then don't bother doing anything */ - if (!strcmp(fmt, "%s")) + if (!HDstrcmp(fmt, "%s")) return str->s; /* * Save the input value if there is a `%' anywhere in FMT. Otherwise * don't bother because we don't need a temporary copy. */ - if (strchr(fmt, '%')) { + if (HDstrchr(fmt, '%')) { size_t n = sizeof(_temp); if (str->len - start + 1 > n) { n = str->len - start + 1; - temp = malloc(n); - assert(temp); + temp = HDmalloc(n); + HDassert(temp); } HDstrncpy(temp, str->s + start, n); @@ -297,7 +295,7 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt) /* Free the temp buffer if we allocated one */ if (temp != _temp) - free(temp); + HDfree(temp); return str->s; } @@ -336,7 +334,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, ctx->pos[i] = curr_pos / ctx->acc[i]; curr_pos -= ctx->acc[i] * ctx->pos[i]; } - assert(curr_pos == 0); + HDassert(curr_pos == 0); /* Print the index values */ for (i = 0; i < (size_t) ndims; i++) { @@ -451,8 +449,8 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region, int i; alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); - assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ - ptdata = (hsize_t *)malloc((size_t) alloc_size); + HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ + ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t); H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata); @@ -464,17 +462,17 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region, /* Start coordinates and opposite corner */ for (j = 0; j < ndims; j++) - h5tools_str_append(str, "%s%lu", j ? "," : "(", - (unsigned long) ptdata[i * 2 * ndims + j]); + h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", + ptdata[i * 2 * ndims + j]); for (j = 0; j < ndims; j++) - h5tools_str_append(str, "%s%lu", j ? "," : ")-(", - (unsigned long) ptdata[i * 2 * ndims + j + ndims]); + h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : ")-(", + ptdata[i * 2 * ndims + j + ndims]); h5tools_str_append(str, ")"); } - free(ptdata); + HDfree(ptdata); } /* end if (nblocks > 0) */ } @@ -512,8 +510,8 @@ h5tools_str_dump_region_points(h5tools_str_t *str, hid_t region, int i; alloc_size = npoints * ndims * sizeof(ptdata[0]); - assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ - ptdata = (hsize_t *)malloc((size_t) alloc_size); + HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ + ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t); H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata); @@ -524,13 +522,13 @@ h5tools_str_dump_region_points(h5tools_str_t *str, hid_t region, (unsigned long)i); for (j = 0; j < ndims; j++) - h5tools_str_append(str, "%s%lu", j ? "," : "(", - (unsigned long) (ptdata[i * ndims + j])); + h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", + (ptdata[i * ndims + j])); h5tools_str_append(str, ")"); } - free(ptdata); + HDfree(ptdata); } /* end if (npoints > 0) */ } @@ -610,6 +608,32 @@ h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch) } } } +void +h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, + h5tools_context_t *ctx) +{ + int i, indentlevel = 0; + + /* Write new prefix */ + if (ctx->indent_level >= 0) { + indentlevel = ctx->indent_level; + } + else { + /* + * This is because sometimes we don't print out all the header + * info for the data (like the tattr-2.ddl example). If that happens + * the ctx->indent_level is negative so we need to skip the above and + * just print out the default indent levels. + */ + indentlevel = ctx->default_indent_level; + } + + for (i = 0; i < indentlevel; i++) { + h5tools_str_append(str, "%s", OPT(info->line_indent, "")); + } + +// ctx->need_prefix = 0; +} /*------------------------------------------------------------------------- * Function: h5tools_str_sprint @@ -650,7 +674,7 @@ h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch) * * Raymond Lu, 2011-09-01 * CLANG compiler complained about the line (about 800): - * tempint = (tempint >> packed_data_offset) & packed_data_mask; + * tempint = (tempint >> packed_data_offset) & packed_data_mask; * The right shift may cause undefined behavior if PACKED_DATA_OFFSET is * 32-bit or more. For every kind of native integers, I changed the code * to make it zero if PACKED_DATA_OFFSET is greater than or equal to the @@ -840,7 +864,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, OPT(info->fmt_schar, "%hd"), tempchar); #else h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), tempchar); -#endif +#endif } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { unsigned char tempuchar; @@ -919,29 +943,29 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) { if (sizeof(hssize_t) == sizeof(int)) { - memcpy(&tempint, vp, sizeof(int)); + HDmemcpy(&tempint, vp, sizeof(int)); h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint); } else if (sizeof(hssize_t) == sizeof(long)) { - memcpy(&templong, vp, sizeof(long)); + HDmemcpy(&templong, vp, sizeof(long)); h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong); } else { - memcpy(&templlong, vp, sizeof(long long)); + HDmemcpy(&templlong, vp, sizeof(long long)); h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong); } } else if (H5Tequal(type, H5T_NATIVE_HSIZE)) { if (sizeof(hsize_t) == sizeof(int)) { - memcpy(&tempuint, vp, sizeof(unsigned int)); + HDmemcpy(&tempuint, vp, sizeof(unsigned int)); h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint); } else if (sizeof(hsize_t) == sizeof(long)) { - memcpy(&tempulong, vp, sizeof(long)); + HDmemcpy(&tempulong, vp, sizeof(long)); h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong); } else { - memcpy(&tempullong, vp, sizeof(unsigned long long)); + HDmemcpy(&tempullong, vp, sizeof(unsigned long long)); h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong); } } @@ -951,59 +975,39 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai nmembs = H5Tget_nmembers(type); h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); + ctx->indent_level++; + for (j = 0; j < nmembs; j++) { if (j) - h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", " OPTIONAL_LINE_BREAK)); - - /* RPM 2000-10-31 - * If the previous character is a line-feed (which is true when - * h5dump is running) then insert some white space for - * indentation. Be warned that column number calculations will be - * incorrect and that object indices at the beginning of the line - * will be missing (h5dump doesn't display them anyway). */ - if (ctx->indent_level >= 0 && str->len && str->s[str->len - 1] == '\n') { - int x; - - h5tools_str_append(str, OPT(info->line_pre, ""), ""); - - for (x = 0; x < ctx->indent_level + 1; x++) - h5tools_str_append(str, "%s", OPT(info->line_indent, "")); - } + h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK)); + else + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); + if(info->arr_linebreak) + h5tools_str_indent(str, info, ctx); + /* The name */ name = H5Tget_member_name(type, j); h5tools_str_append(str, OPT(info->cmpd_name, ""), name); - free(name); + HDfree(name); /* The value */ offset = H5Tget_member_offset(type, j); memb = H5Tget_member_type(type, j); - ctx->indent_level++; h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx); - ctx->indent_level--; H5Tclose(memb); } + ctx->indent_level--; - /* RPM 2000-10-31 - * If the previous character is a line feed (which is true when - * h5dump is running) then insert some white space for indentation. - * Be warned that column number calculations will be incorrect and - * that object indices at the beginning of the line will be missing - * (h5dump doesn't display them anyway). */ - h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - - if (ctx->indent_level >= 0 && str->len && str->s[str->len - 1] == '\n') { - int x; - h5tools_str_append(str, OPT(info->line_pre, ""), ""); - - for (x = 0; x < ctx->indent_level; x++) - h5tools_str_append(str, "%s", OPT(info->line_indent, "")); + if(info->arr_linebreak) { + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); + h5tools_str_indent(str, info, ctx); } - h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); + } else if (H5Tget_class(type) == H5T_ENUM) { char enum_name[1024]; @@ -1084,25 +1088,27 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else if (H5Tget_class(type) == H5T_ARRAY) { int k, ndims; hsize_t i, dims[H5S_MAX_RANK], temp_nelmts; - static int is_next_arry_elmt=0; + static int is_next_arry_elmt = 0; /* Get the array's base datatype for each element */ memb = H5Tget_super(type); size = H5Tget_size(memb); ndims = H5Tget_array_ndims(type); H5Tget_array_dims2(type, dims); - assert(ndims >= 1 && ndims <= H5S_MAX_RANK); + HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK); /* Calculate the number of array elements */ for (k = 0, nelmts = 1; k < ndims; k++) { temp_nelmts = nelmts; temp_nelmts *= dims[k]; - assert(temp_nelmts == (hsize_t) ((size_t) temp_nelmts)); + HDassert(temp_nelmts == (hsize_t) ((size_t) temp_nelmts)); nelmts = (size_t) temp_nelmts; } /* Print the opening bracket */ h5tools_str_append(str, "%s", OPT(info->arr_pre, "[")); + ctx->indent_level++; + for (i = 0; i < nelmts; i++) { if (i) h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK)); @@ -1111,14 +1117,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai int x; h5tools_str_append(str, "%s", "\n"); + h5tools_str_indent(str, info, ctx); - /* need to indent some more here*/ - if (ctx->indent_level >= 0) - if (!info->pindex) - h5tools_str_append(str, "%s", OPT(info->line_pre, "")); - - for (x = 0; x < ctx->indent_level + 1; x++) - h5tools_str_append(str, "%s", OPT(info->line_indent, "")); } /* end if */ else if (i && info->arr_sep) { /* if next element begin, add next line with indent */ @@ -1127,13 +1127,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai is_next_arry_elmt = 0; h5tools_str_append(str, "%s", "\n "); + h5tools_str_indent(str, info, ctx); - if (ctx->indent_level >= 0) - if (!info->pindex) - h5tools_str_append(str, "%s", OPT(info->line_pre, "")); - - for (x = 0; x < ctx->indent_level + 1; x++) - h5tools_str_append(str, "%s", OPT(info->line_indent, "")); } /* otherwise just add space */ else @@ -1141,15 +1136,13 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } /* end else if */ - ctx->indent_level++; - /* Dump values in an array element */ is_next_arry_elmt = 0; /* dump all values in the array element, so turn it off */ h5tools_str_sprint(str, info, container, memb, cp_vp + i * size, ctx); - - ctx->indent_level--; } /* end for */ + ctx->indent_level--; + /* Print the closing bracket */ h5tools_str_append(str, "%s", OPT(info->arr_suf, "]")); is_next_arry_elmt = 1; /* set for begining of next array element */ @@ -1280,7 +1273,7 @@ static char * h5tools_escape(char *s/*in,out*/, size_t size) { register size_t i; - size_t n = strlen(s); + size_t n = HDstrlen(s); const char *escape; char octal[8]; @@ -1332,14 +1325,14 @@ h5tools_escape(char *s/*in,out*/, size_t size) } if (escape) { - size_t esc_size = strlen(escape); + size_t esc_size = HDstrlen(escape); if (n + esc_size + 1 > size) /*would overflow*/ return NULL; - memmove(s + i + esc_size, s + i + 1, n - i); /*make room*/ - memcpy(s + i, escape, esc_size); /*insert*/ + HDmemmove(s + i + esc_size, s + i + 1, n - i); /*make room*/ + HDmemcpy(s + i, escape, esc_size); /*insert*/ n += esc_size - 1; /* adjust total string size */ i += esc_size; /* adjust string position */ } diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h index 599c7d1..9527a56 100644 --- a/tools/lib/h5tools_str.h +++ b/tools/lib/h5tools_str.h @@ -26,25 +26,25 @@ typedef struct h5tools_str_t { size_t nalloc; /*allocated size of string */ } h5tools_str_t; -extern void h5tools_str_close(h5tools_str_t *str); -extern size_t h5tools_str_len(h5tools_str_t *str); -extern char *h5tools_str_append(h5tools_str_t *str, const char *fmt, ...); -extern char *h5tools_str_reset(h5tools_str_t *str); -extern char *h5tools_str_trunc(h5tools_str_t *str, size_t size); -extern char *h5tools_str_fmt(h5tools_str_t *str, size_t start, const char *fmt); -extern char *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t *info, +H5TOOLS_DLL void h5tools_str_close(h5tools_str_t *str); +H5TOOLS_DLL size_t h5tools_str_len(h5tools_str_t *str); +H5TOOLS_DLL char *h5tools_str_append(h5tools_str_t *str, const char *fmt, ...); +H5TOOLS_DLL char *h5tools_str_reset(h5tools_str_t *str); +H5TOOLS_DLL char *h5tools_str_trunc(h5tools_str_t *str, size_t size); +H5TOOLS_DLL char *h5tools_str_fmt(h5tools_str_t *str, size_t start, const char *fmt); +H5TOOLS_DLL char *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t *info, hsize_t elmtno, unsigned ndims, h5tools_context_t *ctx); /* * new functions needed to display region reference data */ -extern char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info, +H5TOOLS_DLL char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info, hsize_t elmtno, hsize_t *ptdata, unsigned ndims, hsize_t max_idx[], h5tools_context_t *ctx); -extern void h5tools_str_dump_region_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *); -extern void h5tools_str_dump_region_points(h5tools_str_t *, hid_t, const h5tool_format_t *); -extern void h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info, hid_t container, +H5TOOLS_DLL void h5tools_str_dump_region_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *); +H5TOOLS_DLL void h5tools_str_dump_region_points(h5tools_str_t *, hid_t, const h5tool_format_t *); +H5TOOLS_DLL void h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info, hid_t container, void *vp); -extern char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, +H5TOOLS_DLL char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t container, hid_t type, void *vp, h5tools_context_t *ctx); diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c index bbd1b8d..d68d3c5 100644 --- a/tools/lib/h5tools_type.c +++ b/tools/lib/h5tools_type.c @@ -66,62 +66,62 @@ h5tools_get_native_type(hid_t type) hid_t h5tools_get_little_endian_type(hid_t tid) { - hid_t p_type=-1; - H5T_class_t type_class; - size_t size; - H5T_sign_t sign; - - type_class = H5Tget_class(tid); - size = H5Tget_size(tid); - sign = H5Tget_sign(tid); - - switch( type_class ) - { - case H5T_INTEGER: - { - if ( size == 1 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I8LE); - else if ( size == 2 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I16LE); - else if ( size == 4 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I32LE); - else if ( size == 8 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I64LE); - else if ( size == 1 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U8LE); - else if ( size == 2 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U16LE); - else if ( size == 4 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U32LE); - else if ( size == 8 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U64LE); - } - break; - - case H5T_FLOAT: - if ( size == 4) - p_type=H5Tcopy(H5T_IEEE_F32LE); - else if ( size == 8) - p_type=H5Tcopy(H5T_IEEE_F64LE); - break; - - case H5T_TIME: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_STRING: - case H5T_COMPOUND: - case H5T_REFERENCE: - case H5T_ENUM: - case H5T_VLEN: - case H5T_ARRAY: - break; - - default: - break; - - } - - return(p_type); + hid_t p_type=-1; + H5T_class_t type_class; + size_t size; + H5T_sign_t sign; + + type_class = H5Tget_class(tid); + size = H5Tget_size(tid); + sign = H5Tget_sign(tid); + + switch( type_class ) + { + case H5T_INTEGER: + { + if ( size == 1 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I8LE); + else if ( size == 2 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I16LE); + else if ( size == 4 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I32LE); + else if ( size == 8 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I64LE); + else if ( size == 1 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U8LE); + else if ( size == 2 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U16LE); + else if ( size == 4 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U32LE); + else if ( size == 8 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U64LE); + } + break; + + case H5T_FLOAT: + if ( size == 4) + p_type=H5Tcopy(H5T_IEEE_F32LE); + else if ( size == 8) + p_type=H5Tcopy(H5T_IEEE_F64LE); + break; + + case H5T_TIME: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_STRING: + case H5T_COMPOUND: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + break; + + default: + break; + + } + + return(p_type); } @@ -143,62 +143,62 @@ h5tools_get_little_endian_type(hid_t tid) hid_t h5tools_get_big_endian_type(hid_t tid) { - hid_t p_type=-1; - H5T_class_t type_class; - size_t size; - H5T_sign_t sign; - - type_class = H5Tget_class(tid); - size = H5Tget_size(tid); - sign = H5Tget_sign(tid); - - switch( type_class ) - { - case H5T_INTEGER: - { - if ( size == 1 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I8BE); - else if ( size == 2 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I16BE); - else if ( size == 4 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I32BE); - else if ( size == 8 && sign == H5T_SGN_2) - p_type=H5Tcopy(H5T_STD_I64BE); - else if ( size == 1 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U8BE); - else if ( size == 2 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U16BE); - else if ( size == 4 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U32BE); - else if ( size == 8 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U64BE); - } - break; - - case H5T_FLOAT: - if ( size == 4) - p_type=H5Tcopy(H5T_IEEE_F32BE); - else if ( size == 8) - p_type=H5Tcopy(H5T_IEEE_F64BE); - break; - - case H5T_TIME: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_STRING: - case H5T_COMPOUND: - case H5T_REFERENCE: - case H5T_ENUM: - case H5T_VLEN: - case H5T_ARRAY: - break; - - default: - break; - - } - - - return(p_type); + hid_t p_type=-1; + H5T_class_t type_class; + size_t size; + H5T_sign_t sign; + + type_class = H5Tget_class(tid); + size = H5Tget_size(tid); + sign = H5Tget_sign(tid); + + switch( type_class ) + { + case H5T_INTEGER: + { + if ( size == 1 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I8BE); + else if ( size == 2 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I16BE); + else if ( size == 4 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I32BE); + else if ( size == 8 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I64BE); + else if ( size == 1 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U8BE); + else if ( size == 2 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U16BE); + else if ( size == 4 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U32BE); + else if ( size == 8 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U64BE); + } + break; + + case H5T_FLOAT: + if ( size == 4) + p_type=H5Tcopy(H5T_IEEE_F32BE); + else if ( size == 8) + p_type=H5Tcopy(H5T_IEEE_F64BE); + break; + + case H5T_TIME: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_STRING: + case H5T_COMPOUND: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + break; + + default: + break; + + } + + + return(p_type); } diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index ab8536f..4505609 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -28,13 +28,13 @@ #include #include +#include "h5tools.h" #include "h5tools_utils.h" #include "H5private.h" #include "h5trav.h" /* global variables */ -int nCols = 80; - +int h5tools_nCols = 80; /* ``get_option'' variables */ int opt_err = 1; /*get_option prints errors if this is on */ int opt_ind = 1; /*token pointer */ @@ -42,6 +42,18 @@ const char *opt_arg; /*flag argument (or value) */ static int h5tools_d_status = 0; static const char *h5tools_progname = "h5tools"; +/* + * The output functions need a temporary buffer to hold a piece of the + * dataset while it's being printed. This constant sets the limit on the + * size of that temporary buffer in bytes. For efficiency's sake, choose the + * largest value suitable for your machine (for testing use a small value). + */ +/* Maximum size used in a call to malloc for a dataset */ +hsize_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); +/* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */ +hsize_t H5TOOLS_BUFSIZE = (1024 * 1024); + + /* ``parallel_print'' variables */ unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */ char outBuff[OUTBUFF_SIZE]; @@ -68,57 +80,54 @@ static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t */ void parallel_print(const char* format, ...) { - int bytes_written; - va_list ap; - - va_start(ap, format); + int bytes_written; + va_list ap; - if(!g_Parallel) - vprintf(format, ap); - else - { + HDva_start(ap, format); - if(overflow_file == NULL) /*no overflow has occurred yet */ - { + if(!g_Parallel) + HDvprintf(format, ap); + else { + if(overflow_file == NULL) /*no overflow has occurred yet */ { #if 0 - printf("calling HDvsnprintf: OUTBUFF_SIZE=%ld, outBuffOffset=%ld, ", (long)OUTBUFF_SIZE, (long)outBuffOffset); + printf("calling HDvsnprintf: OUTBUFF_SIZE=%ld, outBuffOffset=%ld, ", (long)OUTBUFF_SIZE, (long)outBuffOffset); #endif - bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap); + bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap); #if 0 - printf("bytes_written=%ld\n", (long)bytes_written); + printf("bytes_written=%ld\n", (long)bytes_written); #endif - va_end(ap); - va_start(ap, format); + HDva_end(ap); + HDva_start(ap, format); #if 0 - printf("Result: bytes_written=%ld, OUTBUFF_SIZE-outBuffOffset=%ld\n", (long)bytes_written, (long)OUTBUFF_SIZE-outBuffOffset); + printf("Result: bytes_written=%ld, OUTBUFF_SIZE-outBuffOffset=%ld\n", (long)bytes_written, (long)OUTBUFF_SIZE-outBuffOffset); #endif - if ((bytes_written < 0) || + if ((bytes_written < 0) || #ifdef H5_VSNPRINTF_WORKS - (bytes_written >= (OUTBUFF_SIZE-outBuffOffset)) + (bytes_written >= (OUTBUFF_SIZE-outBuffOffset)) #else - ((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset)) + ((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset)) #endif - ) - { - /* Terminate the outbuff at the end of the previous output */ - outBuff[outBuffOffset] = '\0'; - - overflow_file = HDtmpfile(); - if(overflow_file == NULL) - fprintf(stderr, "warning: could not create overflow file. Output may be truncated.\n"); - else - bytes_written = HDvfprintf(overflow_file, format, ap); - } - else - outBuffOffset += bytes_written; - } - else - bytes_written = HDvfprintf(overflow_file, format, ap); - - } - va_end(ap); + ) + { + /* Terminate the outbuff at the end of the previous output */ + outBuff[outBuffOffset] = '\0'; + + overflow_file = HDtmpfile(); + if(overflow_file == NULL) + HDfprintf(rawerrorstream, "warning: could not create overflow file. Output may be truncated.\n"); + else + bytes_written = HDvfprintf(overflow_file, format, ap); + } + else + outBuffOffset += bytes_written; + } + else + bytes_written = HDvfprintf(overflow_file, format, ap); + + } + HDva_end(ap); } @@ -142,12 +151,13 @@ error_msg(const char *fmt, ...) { va_list ap; - va_start(ap, fmt); - HDfflush(stdout); - HDfprintf(stderr, "%s error: ", h5tools_getprogname()); - HDvfprintf(stderr, fmt, ap); + HDva_start(ap, fmt); + HDfflush(rawdatastream); + HDfflush(rawoutstream); + HDfprintf(rawerrorstream, "%s error: ", h5tools_getprogname()); + HDvfprintf(rawerrorstream, fmt, ap); - va_end(ap); + HDva_end(ap); } @@ -171,11 +181,12 @@ warn_msg(const char *fmt, ...) { va_list ap; - va_start(ap, fmt); - HDfflush(stdout); - HDfprintf(stderr, "%s warning: ", h5tools_getprogname()); - HDvfprintf(stderr, fmt, ap); - va_end(ap); + HDva_start(ap, fmt); + HDfflush(rawdatastream); + HDfflush(rawoutstream); + HDfprintf(rawerrorstream, "%s warning: ", h5tools_getprogname()); + HDvfprintf(rawerrorstream, fmt, ap); + HDva_end(ap); } /*------------------------------------------------------------------------- @@ -228,7 +239,8 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti /* check for more flag-like tokens */ if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') { return EOF; - } else if (HDstrcmp(argv[opt_ind], "--") == 0) { + } + else if (HDstrcmp(argv[opt_ind], "--") == 0) { opt_ind++; return EOF; } @@ -254,27 +266,27 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti if (opt_ind < (argc - 1)) if (argv[opt_ind + 1][0] != '-') opt_arg = argv[++opt_ind]; - } else if (l_opts[i].has_arg == require_arg) { + } + else if (l_opts[i].has_arg == require_arg) { if (opt_err) - HDfprintf(stderr, + HDfprintf(rawerrorstream, "%s: option required for \"--%s\" flag\n", argv[0], arg); opt_opt = '?'; } - } else { + } + else { if (arg[len] == '=') { if (opt_err) - HDfprintf(stderr, + HDfprintf(rawerrorstream, "%s: no option required for \"%s\" flag\n", argv[0], arg); opt_opt = '?'; } - opt_arg = NULL; } - break; } } @@ -282,22 +294,23 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti if (l_opts[i].name == NULL) { /* exhausted all of the l_opts we have and still didn't match */ if (opt_err) - HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg); + HDfprintf(rawerrorstream, "%s: unknown option \"%s\"\n", argv[0], arg); opt_opt = '?'; } opt_ind++; sp = 1; - } else { + } + else { register char *cp; /* pointer into current token */ /* short command line option */ opt_opt = argv[opt_ind][sp]; - if (opt_opt == ':' || (cp = strchr(opts, opt_opt)) == 0) { + if (opt_opt == ':' || (cp = HDstrchr(opts, opt_opt)) == 0) { if (opt_err) - HDfprintf(stderr, "%s: unknown option \"%c\"\n", + HDfprintf(rawerrorstream, "%s: unknown option \"%c\"\n", argv[0], opt_opt); /* if no chars left in this token, move to next token */ @@ -305,7 +318,6 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti opt_ind++; sp = 1; } - return '?'; } @@ -314,48 +326,41 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti if (argv[opt_ind][sp + 1] != '\0') { /* flag value is rest of current token */ opt_arg = &argv[opt_ind++][sp + 1]; - } else if (++opt_ind >= argc) { + } + else if (++opt_ind >= argc) { if (opt_err) - HDfprintf(stderr, + HDfprintf(rawerrorstream, "%s: value expected for option \"%c\"\n", argv[0], opt_opt); opt_opt = '?'; - } else { + } + else { /* flag value is next token */ opt_arg = argv[opt_ind++]; } sp = 1; } - /* wildcard argument */ - else if (*cp == '*') - { + else if (*cp == '*') { /* check the next argument */ opt_ind++; /* we do have an extra argument, check if not last */ - if ( argv[opt_ind][0] != '-' && (opt_ind+1) < argc ) - { + if ( argv[opt_ind][0] != '-' && (opt_ind+1) < argc ) { opt_arg = argv[opt_ind++]; } - else - { + else { opt_arg = NULL; } } - - else - { + else { /* set up to look at next char in token, next time */ if (argv[opt_ind][++sp] == '\0') { /* no more in current token, so setup next token */ opt_ind++; sp = 1; - - } - opt_arg = NULL; } } @@ -381,12 +386,13 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti void indentation(int x) { - if (x < nCols) { + if (x < h5tools_nCols) { while (x-- > 0) - printf(" "); - } else { - HDfprintf(stderr, "error: the indentation exceeds the number of cols.\n"); - exit(1); + HDfprintf(rawoutstream, " "); + } + else { + HDfprintf(rawerrorstream, "error: the indentation exceeds the number of cols.\n"); + HDexit(1); } } @@ -408,7 +414,7 @@ indentation(int x) void print_version(const char *progname) { - printf("%s: Version %u.%u.%u%s%s\n", + HDfprintf(rawoutstream, "%s: Version %u.%u.%u%s%s\n", progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, ((char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE); } @@ -488,9 +494,9 @@ dump_table(char* tablename, table_t *table) { unsigned u; - printf("%s: # of entries = %d\n", tablename,table->nobjs); + HDfprintf(rawoutstream,"%s: # of entries = %d\n", tablename,table->nobjs); for (u = 0; u < table->nobjs; u++) - HDfprintf(stdout,"%a %s %d %d\n", table->objs[u].objno, + HDfprintf(rawoutstream,"%a %s %d %d\n", table->objs[u].objno, table->objs[u].objname, table->objs[u].displayed, table->objs[u].recorded); } @@ -889,3 +895,43 @@ int h5tools_getstatus(void) { return h5tools_d_status; } + +/*----------------------------------------------------------- + * PURPOSE : + * if environment variable H5TOOLS_BUFSIZE is set, + * update H5TOOLS_BUFSIZE and H5TOOLS_MALLOCSIZE from the env + * This can be called from each tools main() as part of initial act. + * Note: this is more of debugging purpose for now. + */ +int h5tools_getenv_update_hyperslab_bufsize(void) +{ + const char *env_str = NULL; + long hyperslab_bufsize_mb; + + /* check if environment variable is set for the hyperslab buffer size */ + if (NULL != (env_str = HDgetenv ("H5TOOLS_BUFSIZE"))) + { + errno = 0; + hyperslab_bufsize_mb = HDstrtol(env_str, (char**)NULL, 10); + if (errno != 0 || hyperslab_bufsize_mb <= 0) + { + + /* TODO: later when pubilshed + HDfprintf(rawerrorstream,"Error: Invalid environment variable \"H5TOOLS_BUFSIZE\" : %s\n", env_str); + */ + + goto error; + } + + + /* convert MB to byte */ + H5TOOLS_BUFSIZE = hyperslab_bufsize_mb * 1024 * 1024; + + H5TOOLS_MALLOCSIZE = MAX(H5TOOLS_BUFSIZE, H5TOOLS_MALLOCSIZE); + } + + + return (1); +error: + return (-1); +} diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 4d356c7..f30974a 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -29,8 +29,8 @@ extern "C" { #endif /* ``parallel_print'' information */ -#define PRINT_DATA_MAX_SIZE 512 -#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4) +#define PRINT_DATA_MAX_SIZE 512 +#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4) H5TOOLS_DLLVAR int g_nTasks; H5TOOLS_DLLVAR unsigned char g_Parallel; @@ -38,6 +38,10 @@ H5TOOLS_DLLVAR char outBuff[]; H5TOOLS_DLLVAR int outBuffOffset; H5TOOLS_DLLVAR FILE * overflow_file; +/* Maximum size used in a call to malloc for a dataset */ +H5TOOLS_DLLVAR hsize_t H5TOOLS_MALLOCSIZE; +/* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */ +H5TOOLS_DLLVAR hsize_t H5TOOLS_BUFSIZE; /* * begin get_option section */ @@ -115,7 +119,7 @@ typedef struct find_objs_t { table_t *dset_table; } find_objs_t; -H5TOOLS_DLLVAR int nCols; /*max number of columns for outputting */ +H5TOOLS_DLLVAR int h5tools_nCols; /*max number of columns for outputting */ /* Definitions of useful routines */ H5TOOLS_DLL void indentation(int); @@ -169,7 +173,7 @@ H5TOOLS_DLL const char *h5tools_getprogname(void); H5TOOLS_DLL void h5tools_setprogname(const char*progname); H5TOOLS_DLL int h5tools_getstatus(void); H5TOOLS_DLL void h5tools_setstatus(int d_status); - +H5TOOLS_DLL int h5tools_getenv_update_hyperslab_bufsize(void); #ifdef __cplusplus } #endif diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index c3cfddf..3bb8b3f 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -900,7 +900,7 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT); printf(" %-10s %s -> %s\n", "link", path, targbuf); - free(targbuf); + HDfree(targbuf); } /* end if */ else printf(" %-10s %s ->\n", "link", path); @@ -913,12 +913,12 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) const char *objname; targbuf = HDmalloc(linfo->u.val_size + 1); - assert(targbuf); + HDassert(targbuf); H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT); H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &objname); printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname); - free(targbuf); + HDfree(targbuf); } /* end if */ else printf(" %-10s %s ->\n", "ext link", path); diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index b0bcfbb..ad4188c 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -118,7 +118,7 @@ get_H5B2_class(const uint8_t *sig) break; default: - fprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype)); + HDfprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype)); HDexit(4); } /* end switch */ @@ -152,35 +152,35 @@ main(int argc, char *argv[]) herr_t status = SUCCEED; if(argc == 1) { - fprintf(stderr, "Usage: %s filename [signature-addr [extra]]\n", argv[0]); - HDexit(1); + HDfprintf(stderr, "Usage: %s filename [signature-addr [extra]]\n", argv[0]); + HDexit(1); } /* end if */ /* Initialize the library */ if(H5open() < 0) { - fprintf(stderr, "cannot initialize the library\n"); + HDfprintf(stderr, "cannot initialize the library\n"); HDexit(1); } /* end if */ /* * Open the file and get the file descriptor. */ - if((dxpl = H5Pcreate (H5P_DATASET_XFER))<0) { - fprintf(stderr, "cannot create dataset transfer property list\n"); + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) { + HDfprintf(stderr, "cannot create dataset transfer property list\n"); HDexit(1); } /* end if */ - if((fapl = H5Pcreate (H5P_FILE_ACCESS))<0) { - fprintf(stderr, "cannot create file access property list\n"); + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + HDfprintf(stderr, "cannot create file access property list\n"); HDexit(1); } /* end if */ - if(strchr (argv[1], '%')) - H5Pset_fapl_family (fapl, (hsize_t)0, H5P_DEFAULT); + if(HDstrchr(argv[1], '%')) + H5Pset_fapl_family (fapl, (hsize_t)0, H5P_DEFAULT); if((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0) { - fprintf(stderr, "cannot open file\n"); + HDfprintf(stderr, "cannot open file\n"); HDexit(1); } /* end if */ - if(NULL == (f = H5I_object(fid))) { - fprintf(stderr, "cannot obtain H5F_t pointer\n"); + if(NULL == (f = (H5F_t *)H5I_object(fid))) { + HDfprintf(stderr, "cannot obtain H5F_t pointer\n"); HDexit(2); } /* end if */ @@ -203,7 +203,7 @@ main(int argc, char *argv[]) */ HDfprintf(stdout, "Reading signature at address %a (rel)\n", addr); if(H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), dxpl, sig) < 0) { - fprintf(stderr, "cannot read signature\n"); + HDfprintf(stderr, "cannot read signature\n"); HDexit(3); } if(!HDmemcmp(sig, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) { @@ -231,9 +231,9 @@ main(int argc, char *argv[]) /* Check for extra parameters */ if(extra == 0) { - fprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n"); - fprintf(stderr, "Symbol table node usage:\n"); - fprintf(stderr, "\th5debug
\n\n"); + HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n"); + HDfprintf(stderr, "Symbol table node usage:\n"); + HDfprintf(stderr, "\th5debug
\n\n"); } /* end if */ status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra); @@ -251,9 +251,9 @@ main(int argc, char *argv[]) case H5B_SNODE_ID: /* Check for extra parameters */ if(extra == 0) { - fprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n"); - fprintf(stderr, "B-tree symbol table node usage:\n"); - fprintf(stderr, "\th5debug
\n\n"); + HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n"); + HDfprintf(stderr, "B-tree symbol table node usage:\n"); + HDfprintf(stderr, "\th5debug
\n\n"); } /* end if */ status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra); @@ -262,9 +262,9 @@ main(int argc, char *argv[]) case H5B_CHUNK_ID: /* Check for extra parameters */ if(extra == 0) { - fprintf(stderr, "ERROR: Need number of dimensions of chunk in order to dump chunk B-tree node\n"); - fprintf(stderr, "B-tree chunked storage node usage:\n"); - fprintf(stderr, "\th5debug <# of dimensions>\n"); + HDfprintf(stderr, "ERROR: Need number of dimensions of chunk in order to dump chunk B-tree node\n"); + HDfprintf(stderr, "B-tree chunked storage node usage:\n"); + HDfprintf(stderr, "\th5debug <# of dimensions>\n"); HDexit(4); } /* end if */ @@ -273,7 +273,7 @@ main(int argc, char *argv[]) break; default: - fprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype)); + HDfprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype)); HDexit(4); } @@ -295,10 +295,10 @@ main(int argc, char *argv[]) /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0 || extra3 == 0) { - fprintf(stderr, "ERROR: Need v2 B-tree header address and the node's number of records and depth in order to dump internal node\n"); - fprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n"); - fprintf(stderr, "v2 B-tree internal node usage:\n"); - fprintf(stderr, "\th5debug \n"); + HDfprintf(stderr, "ERROR: Need v2 B-tree header address and the node's number of records and depth in order to dump internal node\n"); + HDfprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n"); + HDfprintf(stderr, "v2 B-tree internal node usage:\n"); + HDfprintf(stderr, "\th5debug \n"); HDexit(4); } /* end if */ @@ -313,9 +313,9 @@ main(int argc, char *argv[]) /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0) { - fprintf(stderr, "ERROR: Need v2 B-tree header address and number of records in order to dump leaf node\n"); - fprintf(stderr, "v2 B-tree leaf node usage:\n"); - fprintf(stderr, "\th5debug \n"); + HDfprintf(stderr, "ERROR: Need v2 B-tree header address and number of records in order to dump leaf node\n"); + HDfprintf(stderr, "v2 B-tree leaf node usage:\n"); + HDfprintf(stderr, "\th5debug \n"); HDexit(4); } /* end if */ @@ -334,9 +334,9 @@ main(int argc, char *argv[]) /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0) { - fprintf(stderr, "ERROR: Need fractal heap header address and size of direct block in order to dump direct block\n"); - fprintf(stderr, "Fractal heap direct block usage:\n"); - fprintf(stderr, "\th5debug \n"); + HDfprintf(stderr, "ERROR: Need fractal heap header address and size of direct block in order to dump direct block\n"); + HDfprintf(stderr, "Fractal heap direct block usage:\n"); + HDfprintf(stderr, "\th5debug \n"); HDexit(4); } /* end if */ @@ -349,9 +349,9 @@ main(int argc, char *argv[]) /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0) { - fprintf(stderr, "ERROR: Need fractal heap header address and number of rows in order to dump indirect block\n"); - fprintf(stderr, "Fractal heap indirect block usage:\n"); - fprintf(stderr, "\th5debug \n"); + HDfprintf(stderr, "ERROR: Need fractal heap header address and number of rows in order to dump indirect block\n"); + HDfprintf(stderr, "Fractal heap indirect block usage:\n"); + HDfprintf(stderr, "\th5debug \n"); HDexit(4); } /* end if */ @@ -371,9 +371,9 @@ main(int argc, char *argv[]) /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0) { - fprintf(stderr, "ERROR: Need free space header address and client address in order to dump serialized sections\n"); - fprintf(stderr, "Free space serialized sections usage:\n"); - fprintf(stderr, "\th5debug \n"); + HDfprintf(stderr, "ERROR: Need free space header address and client address in order to dump serialized sections\n"); + HDfprintf(stderr, "Free space serialized sections usage:\n"); + HDfprintf(stderr, "\th5debug \n"); HDexit(4); } /* end if */ @@ -393,9 +393,9 @@ main(int argc, char *argv[]) /* Check for enough valid parameters */ if(extra2 == 0) { - fprintf(stderr, "ERROR: Need list format version and number of messages in order to shared message list\n"); - fprintf(stderr, "Shared message list usage:\n"); - fprintf(stderr, "\th5debug \n"); + HDfprintf(stderr, "ERROR: Need list format version and number of messages in order to shared message list\n"); + HDfprintf(stderr, "Shared message list usage:\n"); + HDfprintf(stderr, "\th5debug \n"); HDexit(4); } /* end if */ @@ -431,13 +431,13 @@ main(int argc, char *argv[]) } HDputchar('\n'); - fprintf(stderr, "unknown signature\n"); + HDfprintf(stderr, "unknown signature\n"); HDexit(4); } /* end else */ /* Check for an error when dumping information */ if(status < 0) { - fprintf(stderr, "An error occurred!\n"); + HDfprintf(stderr, "An error occurred!\n"); H5Eprint2(H5E_DEFAULT, stderr); HDexit(5); } /* end if */ diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c index 09f23ef..b4ac6f6 100644 --- a/tools/misc/h5mkgrp.c +++ b/tools/misc/h5mkgrp.c @@ -63,7 +63,7 @@ static void leave(int ret) { h5tools_close(); - exit(ret); + HDexit(ret); } /* end leave() */ @@ -81,7 +81,7 @@ leave(int ret) static void usage(void) { - fprintf(stdout, "\ + HDfprintf(stdout, "\ usage: h5mkgrp [OPTIONS] FILE GROUP...\n\ OPTIONS\n\ -h, --help Print a usage message and exit\n\ @@ -97,8 +97,8 @@ usage: h5mkgrp [OPTIONS] FILE GROUP...\n\ * * Purpose: Parses command line and sets up global variable to control output * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * * Programmer: Quincey Koziol, 2/13/2007 * diff --git a/tools/testfiles/filter_fail.ddl b/tools/testfiles/filter_fail.ddl index 1bb65ba..9cc2de5 100644 --- a/tools/testfiles/filter_fail.ddl +++ b/tools/testfiles/filter_fail.ddl @@ -4,7 +4,7 @@ GROUP "/" { DATATYPE H5T_STD_I32LE DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { - } + } } } } diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index 9083782..ca16c42 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tall-2A.h5.xml b/tools/testfiles/tall-2A.h5.xml index a2da338..d118a69 100644 --- a/tools/testfiles/tall-2A.h5.xml +++ b/tools/testfiles/tall-2A.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -32,8 +41,10 @@ - 0 1 - 2 3 + 0 + 1 + 2 + 3 @@ -43,9 +54,9 @@ - + - + @@ -72,8 +83,33 @@ - 49 115 116 32 97 116 116 114 105 98 117 116 101 32 111 102 32 - 100 115 101 116 49 46 49 46 49 0 + 49 + 115 + 116 + 32 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 32 + 111 + 102 + 32 + 100 + 115 + 101 + 116 + 49 + 46 + 49 + 46 + 49 + 0 @@ -90,8 +126,33 @@ - 50 110 100 32 97 116 116 114 105 98 117 116 101 32 111 102 32 - 100 115 101 116 49 46 49 46 49 0 + 50 + 110 + 100 + 32 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 32 + 111 + 102 + 32 + 100 + 115 + 101 + 116 + 49 + 46 + 49 + 46 + 49 + 0 @@ -103,9 +164,9 @@ - + - + @@ -135,9 +196,9 @@ - + - + @@ -158,9 +219,9 @@ - + - + diff --git a/tools/testfiles/tall-2B.ddl b/tools/testfiles/tall-2B.ddl index c9313b7..dc8aab7 100644 --- a/tools/testfiles/tall-2B.ddl +++ b/tools/testfiles/tall-2B.ddl @@ -24,14 +24,14 @@ GROUP "/" { DATATYPE H5T_STD_I8BE DATASPACE SIMPLE { ( 27 ) / ( 27 ) } DATA { - "1st attribute of dset1.1.1\000" + "1st attribute of dset1.1.1\000" } } ATTRIBUTE "attr2" { DATATYPE H5T_STD_I8BE DATASPACE SIMPLE { ( 27 ) / ( 27 ) } DATA { - "2nd attribute of dset1.1.1\000" + "2nd attribute of dset1.1.1\000" } } } diff --git a/tools/testfiles/tall.h5.xml b/tools/testfiles/tall.h5.xml index 0ab7e29..a74ccbe 100644 --- a/tools/testfiles/tall.h5.xml +++ b/tools/testfiles/tall.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -32,8 +41,10 @@ - 0 1 - 2 3 + 0 + 1 + 2 + 3 @@ -43,9 +54,9 @@ - + - + @@ -72,8 +83,33 @@ - 49 115 116 32 97 116 116 114 105 98 117 116 101 32 111 102 32 - 100 115 101 116 49 46 49 46 49 0 + 49 + 115 + 116 + 32 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 32 + 111 + 102 + 32 + 100 + 115 + 101 + 116 + 49 + 46 + 49 + 46 + 49 + 0 @@ -90,23 +126,138 @@ - 50 110 100 32 97 116 116 114 105 98 117 116 101 32 111 102 32 - 100 115 101 116 49 46 49 46 49 0 + 50 + 110 + 100 + 32 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 32 + 111 + 102 + 32 + 100 + 115 + 101 + 116 + 49 + 46 + 49 + 46 + 49 + 0 - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 @@ -114,9 +265,9 @@ - + - + @@ -131,7 +282,26 @@ - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 @@ -148,9 +318,9 @@ - + - + @@ -165,7 +335,16 @@ - 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 + 1 + 1.1 + 1.2 + 1.3 + 1.4 + 1.5 + 1.6 + 1.7 + 1.8 + 1.9 @@ -173,9 +352,9 @@ - + - + @@ -191,9 +370,21 @@ - 0 0.1 0.2 0.3 0.4 - 0 0.2 0.4 0.6 0.8 - 0 0.3 0.6 0.9 1.2 + 0 + 0.1 + 0.2 + 0.3 + 0.4 + 0 + 0.2 + 0.4 + 0.6 + 0.8 + 0 + 0.3 + 0.6 + 0.9 + 1.2 diff --git a/tools/testfiles/tallfilters.ddl b/tools/testfiles/tallfilters.ddl index c8e7b5f..ac6762a 100644 --- a/tools/testfiles/tallfilters.ddl +++ b/tools/testfiles/tallfilters.ddl @@ -5,7 +5,7 @@ DATASET "all" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 458 (1.747:1 COMPRESSION) - } + } FILTERS { PREPROCESSING SHUFFLE COMPRESSION SZIP { @@ -21,7 +21,7 @@ DATASET "all" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tarray1.h5.xml b/tools/testfiles/tarray1.h5.xml index 01aeb3c..86db36f 100644 --- a/tools/testfiles/tarray1.h5.xml +++ b/tools/testfiles/tarray1.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - 0 1 2 3 10 11 12 13 20 21 22 23 30 31 32 33 + 0 1 2 3 + 10 11 12 13 + 20 21 22 23 + 30 31 32 33 diff --git a/tools/testfiles/tarray2.h5.xml b/tools/testfiles/tarray2.h5.xml index ca253ae..7f89b9b 100644 --- a/tools/testfiles/tarray2.h5.xml +++ b/tools/testfiles/tarray2.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -29,54 +29,10 @@ - 0 1 2 3 4 - 10 11 12 13 14 - 20 21 22 23 24 - 30 31 32 33 34 - 100 101 102 103 104 - 110 111 112 113 114 - 120 121 122 123 124 - 130 131 132 133 134 - 200 201 202 203 204 - 210 211 212 213 214 - 220 221 222 223 224 - 230 231 232 233 234 - 1000 1001 1002 1003 1004 - 1010 1011 1012 1013 1014 - 1020 1021 1022 1023 1024 - 1030 1031 1032 1033 1034 - 1100 1101 1102 1103 1104 - 1110 1111 1112 1113 1114 - 1120 1121 1122 1123 1124 - 1130 1131 1132 1133 1134 - 1200 1201 1202 1203 1204 - 1210 1211 1212 1213 1214 - 1220 1221 1222 1223 1224 - 1230 1231 1232 1233 1234 - 2000 2001 2002 2003 2004 - 2010 2011 2012 2013 2014 - 2020 2021 2022 2023 2024 - 2030 2031 2032 2033 2034 - 2100 2101 2102 2103 2104 - 2110 2111 2112 2113 2114 - 2120 2121 2122 2123 2124 - 2130 2131 2132 2133 2134 - 2200 2201 2202 2203 2204 - 2210 2211 2212 2213 2214 - 2220 2221 2222 2223 2224 - 2230 2231 2232 2233 2234 - 3000 3001 3002 3003 3004 - 3010 3011 3012 3013 3014 - 3020 3021 3022 3023 3024 - 3030 3031 3032 3033 3034 - 3100 3101 3102 3103 3104 - 3110 3111 3112 3113 3114 - 3120 3121 3122 3123 3124 - 3130 3131 3132 3133 3134 - 3200 3201 3202 3203 3204 - 3210 3211 3212 3213 3214 - 3220 3221 3222 3223 3224 - 3230 3231 3232 3233 3234 + 0 1 2 3 4 10 11 12 13 14 20 21 22 23 24 30 31 32 33 34 100 101 102 103 104 110 111 112 113 114 120 121 122 123 124 130 131 132 133 134 200 201 202 203 204 210 211 212 213 214 220 221 222 223 224 230 231 232 233 234 + 1000 1001 1002 1003 1004 1010 1011 1012 1013 1014 1020 1021 1022 1023 1024 1030 1031 1032 1033 1034 1100 1101 1102 1103 1104 1110 1111 1112 1113 1114 1120 1121 1122 1123 1124 1130 1131 1132 1133 1134 1200 1201 1202 1203 1204 1210 1211 1212 1213 1214 1220 1221 1222 1223 1224 1230 1231 1232 1233 1234 + 2000 2001 2002 2003 2004 2010 2011 2012 2013 2014 2020 2021 2022 2023 2024 2030 2031 2032 2033 2034 2100 2101 2102 2103 2104 2110 2111 2112 2113 2114 2120 2121 2122 2123 2124 2130 2131 2132 2133 2134 2200 2201 2202 2203 2204 2210 2211 2212 2213 2214 2220 2221 2222 2223 2224 2230 2231 2232 2233 2234 + 3000 3001 3002 3003 3004 3010 3011 3012 3013 3014 3020 3021 3022 3023 3024 3030 3031 3032 3033 3034 3100 3101 3102 3103 3104 3110 3111 3112 3113 3114 3120 3121 3122 3123 3124 3130 3131 3132 3133 3134 3200 3201 3202 3203 3204 3210 3211 3212 3213 3214 3220 3221 3222 3223 3224 3230 3231 3232 3233 3234 diff --git a/tools/testfiles/tarray3.h5.xml b/tools/testfiles/tarray3.h5.xml index fb1ed07..0b74db8 100644 --- a/tools/testfiles/tarray3.h5.xml +++ b/tools/testfiles/tarray3.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -33,102 +33,22 @@ - 0 1 2 - 10 11 12 - 20 21 22 - 30 31 32 - 40 41 42 - 50 51 52 - 100 101 102 - 110 111 112 - 120 121 122 - 130 131 132 - 140 141 142 - 150 151 152 - 200 201 202 - 210 211 212 - 220 221 222 - 230 231 232 - 240 241 242 - 250 251 252 - 300 301 302 - 310 311 312 - 320 321 322 - 330 331 332 - 340 341 342 - 350 351 352 - 1000 1001 1002 - 1010 1011 1012 - 1020 1021 1022 - 1030 1031 1032 - 1040 1041 1042 - 1050 1051 1052 - 1100 1101 1102 - 1110 1111 1112 - 1120 1121 1122 - 1130 1131 1132 - 1140 1141 1142 - 1150 1151 1152 - 1200 1201 1202 - 1210 1211 1212 - 1220 1221 1222 - 1230 1231 1232 - 1240 1241 1242 - 1250 1251 1252 - 1300 1301 1302 - 1310 1311 1312 - 1320 1321 1322 - 1330 1331 1332 - 1340 1341 1342 - 1350 1351 1352 - 2000 2001 2002 - 2010 2011 2012 - 2020 2021 2022 - 2030 2031 2032 - 2040 2041 2042 - 2050 2051 2052 - 2100 2101 2102 - 2110 2111 2112 - 2120 2121 2122 - 2130 2131 2132 - 2140 2141 2142 - 2150 2151 2152 - 2200 2201 2202 - 2210 2211 2212 - 2220 2221 2222 - 2230 2231 2232 - 2240 2241 2242 - 2250 2251 2252 - 2300 2301 2302 - 2310 2311 2312 - 2320 2321 2322 - 2330 2331 2332 - 2340 2341 2342 - 2350 2351 2352 - 3000 3001 3002 - 3010 3011 3012 - 3020 3021 3022 - 3030 3031 3032 - 3040 3041 3042 - 3050 3051 3052 - 3100 3101 3102 - 3110 3111 3112 - 3120 3121 3122 - 3130 3131 3132 - 3140 3141 3142 - 3150 3151 3152 - 3200 3201 3202 - 3210 3211 3212 - 3220 3221 3222 - 3230 3231 3232 - 3240 3241 3242 - 3250 3251 3252 - 3300 3301 3302 - 3310 3311 3312 - 3320 3321 3322 - 3330 3331 3332 - 3340 3341 3342 - 3350 3351 3352 + 0 1 2 10 11 12 20 21 22 30 31 32 40 41 42 50 51 52 + 100 101 102 110 111 112 120 121 122 130 131 132 140 141 142 150 151 152 + 200 201 202 210 211 212 220 221 222 230 231 232 240 241 242 250 251 252 + 300 301 302 310 311 312 320 321 322 330 331 332 340 341 342 350 351 352 + 1000 1001 1002 1010 1011 1012 1020 1021 1022 1030 1031 1032 1040 1041 1042 1050 1051 1052 + 1100 1101 1102 1110 1111 1112 1120 1121 1122 1130 1131 1132 1140 1141 1142 1150 1151 1152 + 1200 1201 1202 1210 1211 1212 1220 1221 1222 1230 1231 1232 1240 1241 1242 1250 1251 1252 + 1300 1301 1302 1310 1311 1312 1320 1321 1322 1330 1331 1332 1340 1341 1342 1350 1351 1352 + 2000 2001 2002 2010 2011 2012 2020 2021 2022 2030 2031 2032 2040 2041 2042 2050 2051 2052 + 2100 2101 2102 2110 2111 2112 2120 2121 2122 2130 2131 2132 2140 2141 2142 2150 2151 2152 + 2200 2201 2202 2210 2211 2212 2220 2221 2222 2230 2231 2232 2240 2241 2242 2250 2251 2252 + 2300 2301 2302 2310 2311 2312 2320 2321 2322 2330 2331 2332 2340 2341 2342 2350 2351 2352 + 3000 3001 3002 3010 3011 3012 3020 3021 3022 3030 3031 3032 3040 3041 3042 3050 3051 3052 + 3100 3101 3102 3110 3111 3112 3120 3121 3122 3130 3131 3132 3140 3141 3142 3150 3151 3152 + 3200 3201 3202 3210 3211 3212 3220 3221 3222 3230 3231 3232 3240 3241 3242 3250 3251 3252 + 3300 3301 3302 3310 3311 3312 3320 3321 3322 3330 3331 3332 3340 3341 3342 3350 3351 3352 diff --git a/tools/testfiles/tarray6.h5.xml b/tools/testfiles/tarray6.h5.xml index 96fc69e..628a342 100644 --- a/tools/testfiles/tarray6.h5.xml +++ b/tools/testfiles/tarray6.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -31,10 +31,10 @@ - 0 10 11 20 21 22 30 31 32 33 - 100 101 110 111 112 120 121 122 123 130 131 132 133 134 - 200 201 202 210 211 212 213 220 221 222 223 224 230 231 232 233 234 235 - 300 301 302 303 310 311 312 313 314 320 321 322 323 324 325 330 331 332 333 334 335 336 + 0 10 11 20 21 22 30 31 32 33 + 100 101 110 111 112 120 121 122 123 130 131 132 133 134 + 200 201 202 210 211 212 213 220 221 222 223 224 230 231 232 233 234 235 + 300 301 302 303 310 311 312 313 314 320 321 322 323 324 325 330 331 332 333 334 335 336 diff --git a/tools/testfiles/tarray7.h5.xml b/tools/testfiles/tarray7.h5.xml index 6a0558c..dbf5ec5 100644 --- a/tools/testfiles/tarray7.h5.xml +++ b/tools/testfiles/tarray7.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -36,22 +36,22 @@ - 0 1 2 3 - 100 101 102 103 110 111 112 113 - 200 201 202 203 210 211 212 213 220 221 222 223 - 300 301 302 303 310 311 312 313 320 321 322 323 330 331 332 333 - 1000 1001 1002 1003 1010 1011 1012 1013 - 1100 1101 1102 1103 1110 1111 1112 1113 1120 1121 1122 1123 - 1200 1201 1202 1203 1210 1211 1212 1213 1220 1221 1222 1223 1230 1231 1232 1233 - 1300 1301 1302 1303 1310 1311 1312 1313 1320 1321 1322 1323 1330 1331 1332 1333 1340 1341 1342 1343 - 2000 2001 2002 2003 2010 2011 2012 2013 2020 2021 2022 2023 - 2100 2101 2102 2103 2110 2111 2112 2113 2120 2121 2122 2123 2130 2131 2132 2133 - 2200 2201 2202 2203 2210 2211 2212 2213 2220 2221 2222 2223 2230 2231 2232 2233 2240 2241 2242 2243 - 2300 2301 2302 2303 2310 2311 2312 2313 2320 2321 2322 2323 2330 2331 2332 2333 2340 2341 2342 2343 2350 2351 2352 2353 - 3000 3001 3002 3003 3010 3011 3012 3013 3020 3021 3022 3023 3030 3031 3032 3033 - 3100 3101 3102 3103 3110 3111 3112 3113 3120 3121 3122 3123 3130 3131 3132 3133 3140 3141 3142 3143 - 3200 3201 3202 3203 3210 3211 3212 3213 3220 3221 3222 3223 3230 3231 3232 3233 3240 3241 3242 3243 3250 3251 3252 3253 - 3300 3301 3302 3303 3310 3311 3312 3313 3320 3321 3322 3323 3330 3331 3332 3333 3340 3341 3342 3343 3350 3351 3352 3353 3360 3361 3362 3363 + 0 1 2 3 + 100 101 102 103 110 111 112 113 + 200 201 202 203 210 211 212 213 220 221 222 223 + 300 301 302 303 310 311 312 313 320 321 322 323 330 331 332 333 + 1000 1001 1002 1003 1010 1011 1012 1013 + 1100 1101 1102 1103 1110 1111 1112 1113 1120 1121 1122 1123 + 1200 1201 1202 1203 1210 1211 1212 1213 1220 1221 1222 1223 1230 1231 1232 1233 + 1300 1301 1302 1303 1310 1311 1312 1313 1320 1321 1322 1323 1330 1331 1332 1333 1340 1341 1342 1343 + 2000 2001 2002 2003 2010 2011 2012 2013 2020 2021 2022 2023 + 2100 2101 2102 2103 2110 2111 2112 2113 2120 2121 2122 2123 2130 2131 2132 2133 + 2200 2201 2202 2203 2210 2211 2212 2213 2220 2221 2222 2223 2230 2231 2232 2233 2240 2241 2242 2243 + 2300 2301 2302 2303 2310 2311 2312 2313 2320 2321 2322 2323 2330 2331 2332 2333 2340 2341 2342 2343 2350 2351 2352 2353 + 3000 3001 3002 3003 3010 3011 3012 3013 3020 3021 3022 3023 3030 3031 3032 3033 + 3100 3101 3102 3103 3110 3111 3112 3113 3120 3121 3122 3123 3130 3131 3132 3133 3140 3141 3142 3143 + 3200 3201 3202 3203 3210 3211 3212 3213 3220 3221 3222 3223 3230 3231 3232 3233 3240 3241 3242 3243 3250 3251 3252 3253 + 3300 3301 3302 3303 3310 3311 3312 3313 3320 3321 3322 3323 3330 3331 3332 3333 3340 3341 3342 3343 3350 3351 3352 3353 3360 3361 3362 3363 diff --git a/tools/testfiles/tattr-1.ddl b/tools/testfiles/tattr-1.ddl index 540c973..d353577 100644 --- a/tools/testfiles/tattr-1.ddl +++ b/tools/testfiles/tattr-1.ddl @@ -31,11 +31,11 @@ GROUP "/" { } ATTRIBUTE "attr5" { DATATYPE H5T_STRING { - STRSIZE 17; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 17; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "string attribute" diff --git a/tools/testfiles/tattr-2.ddl b/tools/testfiles/tattr-2.ddl index e4d40bd..79ba8c3 100644 --- a/tools/testfiles/tattr-2.ddl +++ b/tools/testfiles/tattr-2.ddl @@ -16,11 +16,11 @@ ATTRIBUTE "/attr4" { } ATTRIBUTE "/attr5" { DATATYPE H5T_STRING { - STRSIZE 17; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 17; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "string attribute" diff --git a/tools/testfiles/tattr-3.ddl b/tools/testfiles/tattr-3.ddl index a44be10..4eee317 100644 --- a/tools/testfiles/tattr-3.ddl +++ b/tools/testfiles/tattr-3.ddl @@ -4,6 +4,6 @@ ATTRIBUTE "/attr2" { DATASPACE SIMPLE { ( 10 ) / ( 10 ) } } ATTRIBUTE "/attr" { - } } -h5dump error: unable to open attribute "/" +} +h5dump error: unable to open attribute "/attr" diff --git a/tools/testfiles/tattr-4_be.ddl b/tools/testfiles/tattr-4_be.ddl index 9f2c547..8b8076e 100644 --- a/tools/testfiles/tattr-4_be.ddl +++ b/tools/testfiles/tattr-4_be.ddl @@ -2,11 +2,11 @@ HDF5 "tattr4_be.h5" { GROUP "/" { ATTRIBUTE "attr0" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -14,11 +14,11 @@ GROUP "/" { } ATTRIBUTE "attr1" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -26,11 +26,11 @@ GROUP "/" { } ATTRIBUTE "attr2" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -38,11 +38,11 @@ GROUP "/" { } ATTRIBUTE "attr3" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -50,11 +50,11 @@ GROUP "/" { } ATTRIBUTE "attr4" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -62,11 +62,11 @@ GROUP "/" { } ATTRIBUTE "attr5" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -74,11 +74,11 @@ GROUP "/" { } ATTRIBUTE "attr6" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -86,11 +86,11 @@ GROUP "/" { } ATTRIBUTE "attr7" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" @@ -98,11 +98,11 @@ GROUP "/" { } ATTRIBUTE "attr8" { DATATYPE H5T_STRING { - STRSIZE 4; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 4; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SCALAR DATA { (0): "1234" diff --git a/tools/testfiles/tattr.h5.xml b/tools/testfiles/tattr.h5.xml index 2d6a6fd..57fa276 100644 --- a/tools/testfiles/tattr.h5.xml +++ b/tools/testfiles/tattr.h5.xml @@ -14,8 +14,30 @@ - 97 116 116 114 105 98 117 116 101 32 111 102 32 114 111 111 116 32 103 - 114 111 117 112 0 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 32 + 111 + 102 + 32 + 114 + 111 + 111 + 116 + 32 + 103 + 114 + 111 + 117 + 112 + 0 @@ -32,7 +54,16 @@ - 1 2 3 4 5 6 7 8 9 10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 @@ -49,7 +80,16 @@ - 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 + 0 + 0.1 + 0.2 + 0.3 + 0.4 + 0.5 + 0.6 + 0.7 + 0.8 + 0.9 diff --git a/tools/testfiles/tattr2.ls b/tools/testfiles/tattr2.ls index eb7c739..3c87360 100644 --- a/tools/testfiles/tattr2.ls +++ b/tools/testfiles/tattr2.ls @@ -1,34 +1,54 @@ Opened "tattr2.h5" with sec2 driver. dset Dataset {2/2} - Attribute: array {2} + Attribute: array {2} Type: [3] 32-bit little-endian integer Data: [1,2,3], [4,5,6] - Attribute: array2D {3, 2} + Attribute: array2D {3, 2} Type: [3] 32-bit little-endian integer Data: - (0,0) [1,2,3], [4,5,6], [7,8,9], [10,11,12], [13,14,15], [16,17,18] - Attribute: array3D {4, 3, 2} + (0,0) [1,2,3], [4,5,6], + (1,0) [7,8,9], [10,11,12], + (2,0) [13,14,15], [16,17,18] + Attribute: array3D {4, 3, 2} Type: [3] 32-bit little-endian integer Data: - (0,0,0) [1,2,3], [4,5,6], [7,8,9], [10,11,12], [13,14,15], - (0,2,1) [16,17,18], [19,20,21], [22,23,24], [25,26,27], [28,29,30], - (1,2,0) [31,32,33], [34,35,36], [37,38,39], [40,41,42], [43,44,45], - (2,1,1) [46,47,48], [49,50,51], [52,53,54], [55,56,57], [58,59,60], - (3,1,0) [61,62,63], [64,65,66], [67,68,69], [70,71,72] - Attribute: bitfield {2} + (0,0,0) [1,2,3], [4,5,6], + (0,1,0) [7,8,9], [10,11,12], + (0,2,0) [13,14,15], [16,17,18], + (1,0,0) [19,20,21], [22,23,24], + (1,1,0) [25,26,27], [28,29,30], + (1,2,0) [31,32,33], [34,35,36], + (2,0,0) [37,38,39], [40,41,42], + (2,1,0) [43,44,45], [46,47,48], + (2,2,0) [49,50,51], [52,53,54], + (3,0,0) [55,56,57], [58,59,60], + (3,1,0) [61,62,63], [64,65,66], + (3,2,0) [67,68,69], [70,71,72] + Attribute: bitfield {2} Type: 8-bit bitfield Data: 0x01, 0x02 Attribute: bitfield2D {3, 2} Type: 8-bit bitfield Data: - (0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 + (0,0) 0x01, 0x02, + (1,0) 0x03, 0x04, + (2,0) 0x05, 0x06 Attribute: bitfield3D {4, 3, 2} Type: 8-bit bitfield Data: - (0,0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, - (1,2,0) 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, - (3,1,0) 0x15, 0x16, 0x17, 0x18 - Attribute: compound {2} + (0,0,0) 0x01, 0x02, + (0,1,0) 0x03, 0x04, + (0,2,0) 0x05, 0x06, + (1,0,0) 0x07, 0x08, + (1,1,0) 0x09, 0x0a, + (1,2,0) 0x0b, 0x0c, + (2,0,0) 0x0d, 0x0e, + (2,1,0) 0x0f, 0x10, + (2,2,0) 0x11, 0x12, + (3,0,0) 0x13, 0x14, + (3,1,0) 0x15, 0x16, + (3,2,0) 0x17, 0x18 + Attribute: compound {2} Type: struct { "a" +0 8-bit integer "b" +4 IEEE 64-bit little-endian float @@ -40,160 +60,264 @@ dset Dataset {2/2} "b" +4 IEEE 64-bit little-endian float } 12 bytes Data: - (0,0) {1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12} + (0,0) {1, 2}, {3, 4}, + (1,0) {5, 6}, {7, 8}, + (2,0) {9, 10}, {11, 12} Attribute: compound3D {4, 3, 2} Type: struct { "a" +0 8-bit integer "b" +4 IEEE 64-bit little-endian float } 12 bytes Data: - (0,0,0) {1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}, {13, - (1,0,0) 14}, {15, 16}, {17, 18}, {19, 20}, {21, 22}, {23, 24}, - (2,0,0) {25, 26}, {27, 28}, {29, 30}, {31, 32}, {33, 34}, {35, 36}, - (3,0,0) {37, 38}, {39, 40}, {41, 42}, {43, 44}, {45, 46}, {47, 48} - Attribute: enum {2} + (0,0,0) {1, 2}, {3, 4}, + (0,1,0) {5, 6}, {7, 8}, + (0,2,0) {9, 10}, {11, 12}, + (1,0,0) {13, 14}, {15, 16}, + (1,1,0) {17, 18}, {19, 20}, + (1,2,0) {21, 22}, {23, 24}, + (2,0,0) {25, 26}, {27, 28}, + (2,1,0) {29, 30}, {31, 32}, + (2,2,0) {33, 34}, {35, 36}, + (3,0,0) {37, 38}, {39, 40}, + (3,1,0) {41, 42}, {43, 44}, + (3,2,0) {45, 46}, {47, 48} + Attribute: enum {2} Type: enum 32-bit little-endian integer { RED = 0 GREEN = 1 } Data: RED, RED - Attribute: enum2D {3, 2} + Attribute: enum2D {3, 2} Type: enum 32-bit little-endian integer { RED = 0 GREEN = 1 } Data: - (0,0) RED, RED, RED, RED, RED, RED - Attribute: enum3D {4, 3, 2} + (0,0) RED, RED, + (1,0) RED, RED, + (2,0) RED, RED + Attribute: enum3D {4, 3, 2} Type: enum 32-bit little-endian integer { RED = 0 GREEN = 1 } Data: - (0,0,0) RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, - (2,0,0) RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED - Attribute: float {2} + (0,0,0) RED, RED, + (0,1,0) RED, RED, + (0,2,0) RED, RED, + (1,0,0) RED, RED, + (1,1,0) RED, RED, + (1,2,0) RED, RED, + (2,0,0) RED, RED, + (2,1,0) RED, RED, + (2,2,0) RED, RED, + (3,0,0) RED, RED, + (3,1,0) RED, RED, + (3,2,0) RED, RED + Attribute: float {2} Type: IEEE 32-bit little-endian float Data: 1, 2 - Attribute: float2D {3, 2} + Attribute: float2D {3, 2} Type: IEEE 32-bit little-endian float Data: - (0,0) 1, 2, 3, 4, 5, 6 - Attribute: float3D {4, 3, 2} + (0,0) 1, 2, + (1,0) 3, 4, + (2,0) 5, 6 + Attribute: float3D {4, 3, 2} Type: IEEE 32-bit little-endian float Data: - (0,0,0) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (2,2,1) 18, 19, 20, 21, 22, 23, 24 - Attribute: integer {2} + (0,0,0) 1, 2, + (0,1,0) 3, 4, + (0,2,0) 5, 6, + (1,0,0) 7, 8, + (1,1,0) 9, 10, + (1,2,0) 11, 12, + (2,0,0) 13, 14, + (2,1,0) 15, 16, + (2,2,0) 17, 18, + (3,0,0) 19, 20, + (3,1,0) 21, 22, + (3,2,0) 23, 24 + Attribute: integer {2} Type: 32-bit little-endian integer Data: 1, 2 Attribute: integer2D {3, 2} Type: 32-bit little-endian integer Data: - (0,0) 1, 2, 3, 4, 5, 6 + (0,0) 1, 2, + (1,0) 3, 4, + (2,0) 5, 6 Attribute: integer3D {4, 3, 2} Type: 32-bit little-endian integer Data: - (0,0,0) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (2,2,1) 18, 19, 20, 21, 22, 23, 24 - Attribute: opaque {2} + (0,0,0) 1, 2, + (0,1,0) 3, 4, + (0,2,0) 5, 6, + (1,0,0) 7, 8, + (1,1,0) 9, 10, + (1,2,0) 11, 12, + (2,0,0) 13, 14, + (2,1,0) 15, 16, + (2,2,0) 17, 18, + (3,0,0) 19, 20, + (3,1,0) 21, 22, + (3,2,0) 23, 24 + Attribute: opaque {2} Type: 1-byte opaque type (tag = "1-byte opaque type") Data: 0x01, 0x02 - Attribute: opaque2D {3, 2} + Attribute: opaque2D {3, 2} Type: 1-byte opaque type (tag = "1-byte opaque type") Data: - (0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 - Attribute: opaque3D {4, 3, 2} + (0,0) 0x01, 0x02, + (1,0) 0x03, 0x04, + (2,0) 0x05, 0x06 + Attribute: opaque3D {4, 3, 2} Type: 1-byte opaque type (tag = "1-byte opaque type") Data: - (0,0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, - (1,2,0) 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, - (3,1,0) 0x15, 0x16, 0x17, 0x18 + (0,0,0) 0x01, 0x02, + (0,1,0) 0x03, 0x04, + (0,2,0) 0x05, 0x06, + (1,0,0) 0x07, 0x08, + (1,1,0) 0x09, 0x0a, + (1,2,0) 0x0b, 0x0c, + (2,0,0) 0x0d, 0x0e, + (2,1,0) 0x0f, 0x10, + (2,2,0) 0x11, 0x12, + (3,0,0) 0x13, 0x14, + (3,1,0) 0x15, 0x16, + (3,2,0) 0x17, 0x18 Attribute: reference {2} Type: object reference Data: DATASET-1:976, DATASET-1:976 Attribute: reference2D {3, 2} Type: object reference Data: - (0,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976, + (0,0) DATASET-1:976, DATASET-1:976, + (1,0) DATASET-1:976, DATASET-1:976, (2,0) DATASET-1:976, DATASET-1:976 Attribute: reference3D {4, 3, 2} Type: object reference Data: - (0,0,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976, - (0,2,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976, - (1,1,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976, - (2,0,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976, - (2,2,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976, - (3,1,0) DATASET-1:976, DATASET-1:976, DATASET-1:976, DATASET-1:976 - Attribute: string {2} + (0,0,0) DATASET-1:976, DATASET-1:976, + (0,1,0) DATASET-1:976, DATASET-1:976, + (0,2,0) DATASET-1:976, DATASET-1:976, + (1,0,0) DATASET-1:976, DATASET-1:976, + (1,1,0) DATASET-1:976, DATASET-1:976, + (1,2,0) DATASET-1:976, DATASET-1:976, + (2,0,0) DATASET-1:976, DATASET-1:976, + (2,1,0) DATASET-1:976, DATASET-1:976, + (2,2,0) DATASET-1:976, DATASET-1:976, + (3,0,0) DATASET-1:976, DATASET-1:976, + (3,1,0) DATASET-1:976, DATASET-1:976, + (3,2,0) DATASET-1:976, DATASET-1:976 + Attribute: string {2} Type: 2-byte null-terminated ASCII string Data: "ab", "de" - Attribute: string2D {3, 2} + Attribute: string2D {3, 2} Type: 2-byte null-terminated ASCII string Data: - (0,0) "ab", "cd", "ef", "gh", "ij", "kl" - Attribute: string3D {4, 3, 2} + (0,0) "ab", "cd", + (1,0) "ef", "gh", + (2,0) "ij", "kl" + Attribute: string3D {4, 3, 2} Type: 2-byte null-terminated ASCII string Data: - (0,0,0) "ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", - (1,2,0) "vw", "xz", "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", - (3,1,0) "RS", "TU", "VW", "XZ" - Attribute: vlen {2} + (0,0,0) "ab", "cd", + (0,1,0) "ef", "gh", + (0,2,0) "ij", "kl", + (1,0,0) "mn", "pq", + (1,1,0) "rs", "tu", + (1,2,0) "vw", "xz", + (2,0,0) "AB", "CD", + (2,1,0) "EF", "GH", + (2,2,0) "IJ", "KL", + (3,0,0) "MN", "PQ", + (3,1,0) "RS", "TU", + (3,2,0) "VW", "XZ" + Attribute: vlen {2} Type: variable length of 32-bit little-endian integer Data: (1), (2,3) - Attribute: vlen2D {3, 2} + Attribute: vlen2D {3, 2} Type: variable length of 32-bit little-endian integer Data: - (0,0) (0), (1), (2,3), (4,5), (6,7,8), (9,10,11) - Attribute: vlen3D {4, 3, 2} + (0,0) (0), (1), + (1,0) (2,3), (4,5), + (2,0) (6,7,8), (9,10,11) + Attribute: vlen3D {4, 3, 2} Type: variable length of 32-bit little-endian integer Data: - (0,0,0) (0), (1), (2), (3), (4), (5), (6,7), (8,9), (10,11), - (1,1,1) (12,13), (14,15), (16,17), (18,19,20), (21,22,23), - (2,1,0) (24,25,26), (27,28,29), (30,31,32), (33,34,35), - (3,0,0) (36,37,38,39), (40,41,42,43), (44,45,46,47), (48,49,50,51), + (0,0,0) (0), (1), + (0,1,0) (2), (3), + (0,2,0) (4), (5), + (1,0,0) (6,7), (8,9), + (1,1,0) (10,11), (12,13), + (1,2,0) (14,15), (16,17), + (2,0,0) (18,19,20), (21,22,23), + (2,1,0) (24,25,26), (27,28,29), + (2,2,0) (30,31,32), (33,34,35), + (3,0,0) (36,37,38,39), (40,41,42,43), + (3,1,0) (44,45,46,47), (48,49,50,51), (3,2,0) (52,53,54,55), (56,57,58,59) Location: 1:976 Links: 1 Storage: 8 logical bytes, 0 allocated bytes Type: 32-bit little-endian integer g1 Group - Attribute: array {2} + Attribute: array {2} Type: [3] 32-bit little-endian integer Data: [1,2,3], [4,5,6] - Attribute: array2D {3, 2} + Attribute: array2D {3, 2} Type: [3] 32-bit little-endian integer Data: - (0,0) [1,2,3], [4,5,6], [7,8,9], [10,11,12], [13,14,15], [16,17,18] - Attribute: array3D {4, 3, 2} + (0,0) [1,2,3], [4,5,6], + (1,0) [7,8,9], [10,11,12], + (2,0) [13,14,15], [16,17,18] + Attribute: array3D {4, 3, 2} Type: [3] 32-bit little-endian integer Data: - (0,0,0) [1,2,3], [4,5,6], [7,8,9], [10,11,12], [13,14,15], - (0,2,1) [16,17,18], [19,20,21], [22,23,24], [25,26,27], [28,29,30], - (1,2,0) [31,32,33], [34,35,36], [37,38,39], [40,41,42], [43,44,45], - (2,1,1) [46,47,48], [49,50,51], [52,53,54], [55,56,57], [58,59,60], - (3,1,0) [61,62,63], [64,65,66], [67,68,69], [70,71,72] - Attribute: bitfield {2} + (0,0,0) [1,2,3], [4,5,6], + (0,1,0) [7,8,9], [10,11,12], + (0,2,0) [13,14,15], [16,17,18], + (1,0,0) [19,20,21], [22,23,24], + (1,1,0) [25,26,27], [28,29,30], + (1,2,0) [31,32,33], [34,35,36], + (2,0,0) [37,38,39], [40,41,42], + (2,1,0) [43,44,45], [46,47,48], + (2,2,0) [49,50,51], [52,53,54], + (3,0,0) [55,56,57], [58,59,60], + (3,1,0) [61,62,63], [64,65,66], + (3,2,0) [67,68,69], [70,71,72] + Attribute: bitfield {2} Type: 8-bit bitfield Data: 0x01, 0x02 Attribute: bitfield2D {3, 2} Type: 8-bit bitfield Data: - (0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 + (0,0) 0x01, 0x02, + (1,0) 0x03, 0x04, + (2,0) 0x05, 0x06 Attribute: bitfield3D {4, 3, 2} Type: 8-bit bitfield Data: - (0,0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, - (1,2,0) 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, - (3,1,0) 0x15, 0x16, 0x17, 0x18 - Attribute: compound {2} + (0,0,0) 0x01, 0x02, + (0,1,0) 0x03, 0x04, + (0,2,0) 0x05, 0x06, + (1,0,0) 0x07, 0x08, + (1,1,0) 0x09, 0x0a, + (1,2,0) 0x0b, 0x0c, + (2,0,0) 0x0d, 0x0e, + (2,1,0) 0x0f, 0x10, + (2,2,0) 0x11, 0x12, + (3,0,0) 0x13, 0x14, + (3,1,0) 0x15, 0x16, + (3,2,0) 0x17, 0x18 + Attribute: compound {2} Type: struct { "a" +0 8-bit integer "b" +4 IEEE 64-bit little-endian float @@ -205,108 +329,185 @@ g1 Group "b" +4 IEEE 64-bit little-endian float } 12 bytes Data: - (0,0) {1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12} + (0,0) {1, 2}, {3, 4}, + (1,0) {5, 6}, {7, 8}, + (2,0) {9, 10}, {11, 12} Attribute: compound3D {4, 3, 2} Type: struct { "a" +0 8-bit integer "b" +4 IEEE 64-bit little-endian float } 12 bytes Data: - (0,0,0) {1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}, {13, - (1,0,0) 14}, {15, 16}, {17, 18}, {19, 20}, {21, 22}, {23, 24}, - (2,0,0) {25, 26}, {27, 28}, {29, 30}, {31, 32}, {33, 34}, {35, 36}, - (3,0,0) {37, 38}, {39, 40}, {41, 42}, {43, 44}, {45, 46}, {47, 48} - Attribute: enum {2} + (0,0,0) {1, 2}, {3, 4}, + (0,1,0) {5, 6}, {7, 8}, + (0,2,0) {9, 10}, {11, 12}, + (1,0,0) {13, 14}, {15, 16}, + (1,1,0) {17, 18}, {19, 20}, + (1,2,0) {21, 22}, {23, 24}, + (2,0,0) {25, 26}, {27, 28}, + (2,1,0) {29, 30}, {31, 32}, + (2,2,0) {33, 34}, {35, 36}, + (3,0,0) {37, 38}, {39, 40}, + (3,1,0) {41, 42}, {43, 44}, + (3,2,0) {45, 46}, {47, 48} + Attribute: enum {2} Type: enum 32-bit little-endian integer { RED = 0 GREEN = 1 } Data: RED, RED - Attribute: enum2D {3, 2} + Attribute: enum2D {3, 2} Type: enum 32-bit little-endian integer { RED = 0 GREEN = 1 } Data: - (0,0) RED, RED, RED, RED, RED, RED - Attribute: enum3D {4, 3, 2} + (0,0) RED, RED, + (1,0) RED, RED, + (2,0) RED, RED + Attribute: enum3D {4, 3, 2} Type: enum 32-bit little-endian integer { RED = 0 GREEN = 1 } Data: - (0,0,0) RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, - (2,0,0) RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED - Attribute: float {2} + (0,0,0) RED, RED, + (0,1,0) RED, RED, + (0,2,0) RED, RED, + (1,0,0) RED, RED, + (1,1,0) RED, RED, + (1,2,0) RED, RED, + (2,0,0) RED, RED, + (2,1,0) RED, RED, + (2,2,0) RED, RED, + (3,0,0) RED, RED, + (3,1,0) RED, RED, + (3,2,0) RED, RED + Attribute: float {2} Type: IEEE 32-bit little-endian float Data: 1, 2 - Attribute: float2D {3, 2} + Attribute: float2D {3, 2} Type: IEEE 32-bit little-endian float Data: - (0,0) 1, 2, 3, 4, 5, 6 - Attribute: float3D {4, 3, 2} + (0,0) 1, 2, + (1,0) 3, 4, + (2,0) 5, 6 + Attribute: float3D {4, 3, 2} Type: IEEE 32-bit little-endian float Data: - (0,0,0) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (2,2,1) 18, 19, 20, 21, 22, 23, 24 - Attribute: integer {2} + (0,0,0) 1, 2, + (0,1,0) 3, 4, + (0,2,0) 5, 6, + (1,0,0) 7, 8, + (1,1,0) 9, 10, + (1,2,0) 11, 12, + (2,0,0) 13, 14, + (2,1,0) 15, 16, + (2,2,0) 17, 18, + (3,0,0) 19, 20, + (3,1,0) 21, 22, + (3,2,0) 23, 24 + Attribute: integer {2} Type: 32-bit little-endian integer Data: 1, 2 Attribute: integer2D {3, 2} Type: 32-bit little-endian integer Data: - (0,0) 1, 2, 3, 4, 5, 6 + (0,0) 1, 2, + (1,0) 3, 4, + (2,0) 5, 6 Attribute: integer3D {4, 3, 2} Type: 32-bit little-endian integer Data: - (0,0,0) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - (2,2,1) 18, 19, 20, 21, 22, 23, 24 - Attribute: opaque {2} + (0,0,0) 1, 2, + (0,1,0) 3, 4, + (0,2,0) 5, 6, + (1,0,0) 7, 8, + (1,1,0) 9, 10, + (1,2,0) 11, 12, + (2,0,0) 13, 14, + (2,1,0) 15, 16, + (2,2,0) 17, 18, + (3,0,0) 19, 20, + (3,1,0) 21, 22, + (3,2,0) 23, 24 + Attribute: opaque {2} Type: 1-byte opaque type (tag = "1-byte opaque type") Data: 0x01, 0x02 - Attribute: opaque2D {3, 2} + Attribute: opaque2D {3, 2} Type: 1-byte opaque type (tag = "1-byte opaque type") Data: - (0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 - Attribute: opaque3D {4, 3, 2} + (0,0) 0x01, 0x02, + (1,0) 0x03, 0x04, + (2,0) 0x05, 0x06 + Attribute: opaque3D {4, 3, 2} Type: 1-byte opaque type (tag = "1-byte opaque type") Data: - (0,0,0) 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, - (1,2,0) 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, - (3,1,0) 0x15, 0x16, 0x17, 0x18 - Attribute: string {2} + (0,0,0) 0x01, 0x02, + (0,1,0) 0x03, 0x04, + (0,2,0) 0x05, 0x06, + (1,0,0) 0x07, 0x08, + (1,1,0) 0x09, 0x0a, + (1,2,0) 0x0b, 0x0c, + (2,0,0) 0x0d, 0x0e, + (2,1,0) 0x0f, 0x10, + (2,2,0) 0x11, 0x12, + (3,0,0) 0x13, 0x14, + (3,1,0) 0x15, 0x16, + (3,2,0) 0x17, 0x18 + Attribute: string {2} Type: 2-byte null-terminated ASCII string Data: "ab", "de" - Attribute: string2D {3, 2} + Attribute: string2D {3, 2} Type: 2-byte null-terminated ASCII string Data: - (0,0) "ab", "cd", "ef", "gh", "ij", "kl" - Attribute: string3D {4, 3, 2} + (0,0) "ab", "cd", + (1,0) "ef", "gh", + (2,0) "ij", "kl" + Attribute: string3D {4, 3, 2} Type: 2-byte null-terminated ASCII string Data: - (0,0,0) "ab", "cd", "ef", "gh", "ij", "kl", "mn", "pq", "rs", "tu", - (1,2,0) "vw", "xz", "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "PQ", - (3,1,0) "RS", "TU", "VW", "XZ" - Attribute: vlen {2} + (0,0,0) "ab", "cd", + (0,1,0) "ef", "gh", + (0,2,0) "ij", "kl", + (1,0,0) "mn", "pq", + (1,1,0) "rs", "tu", + (1,2,0) "vw", "xz", + (2,0,0) "AB", "CD", + (2,1,0) "EF", "GH", + (2,2,0) "IJ", "KL", + (3,0,0) "MN", "PQ", + (3,1,0) "RS", "TU", + (3,2,0) "VW", "XZ" + Attribute: vlen {2} Type: variable length of 32-bit little-endian integer Data: (1), (2,3) - Attribute: vlen2D {3, 2} + Attribute: vlen2D {3, 2} Type: variable length of 32-bit little-endian integer Data: - (0,0) (0), (1), (2,3), (4,5), (6,7,8), (9,10,11) - Attribute: vlen3D {4, 3, 2} + (0,0) (0), (1), + (1,0) (2,3), (4,5), + (2,0) (6,7,8), (9,10,11) + Attribute: vlen3D {4, 3, 2} Type: variable length of 32-bit little-endian integer Data: - (0,0,0) (0), (1), (2), (3), (4), (5), (6,7), (8,9), (10,11), - (1,1,1) (12,13), (14,15), (16,17), (18,19,20), (21,22,23), - (2,1,0) (24,25,26), (27,28,29), (30,31,32), (33,34,35), - (3,0,0) (36,37,38,39), (40,41,42,43), (44,45,46,47), (48,49,50,51), + (0,0,0) (0), (1), + (0,1,0) (2), (3), + (0,2,0) (4), (5), + (1,0,0) (6,7), (8,9), + (1,1,0) (10,11), (12,13), + (1,2,0) (14,15), (16,17), + (2,0,0) (18,19,20), (21,22,23), + (2,1,0) (24,25,26), (27,28,29), + (2,2,0) (30,31,32), (33,34,35), + (3,0,0) (36,37,38,39), (40,41,42,43), + (3,1,0) (44,45,46,47), (48,49,50,51), (3,2,0) (52,53,54,55), (56,57,58,59) Location: 1:2176 Links: 1 diff --git a/tools/testfiles/tattrregR.ddl b/tools/testfiles/tattrregR.ddl index 9e6b421..1c661e4 100644 --- a/tools/testfiles/tattrregR.ddl +++ b/tools/testfiles/tattrregR.ddl @@ -22,7 +22,7 @@ GROUP "/" { (7,2): 216, 219, 222, 225, 228, 231 (0): } (0): } - (1): DATASET /Dataset2 { + (1): DATASET /Dataset2 { (1): REGION_TYPE POINT (6,9), (2,2), (8,4), (1,6), (2,8), (1): (3,2), (0,4), (9,0), (7,1), (3,3) (1): DATATYPE H5T_STD_U8BE diff --git a/tools/testfiles/tattrreg_be.ls b/tools/testfiles/tattrreg_be.ls index 46b30ac..8307f35 100644 --- a/tools/testfiles/tattrreg_be.ls +++ b/tools/testfiles/tattrreg_be.ls @@ -10,6 +10,7 @@ Dataset1 Dataset {NULL} Storage: 0 logical bytes, 0 allocated bytes Type: 32-bit little-endian integer Data: + Dataset2 Dataset {10/10, 10/10} Location: 1:800 Links: 1 diff --git a/tools/testfiles/tattrreg_le.ls b/tools/testfiles/tattrreg_le.ls index 2eafc07..dd0be49 100644 --- a/tools/testfiles/tattrreg_le.ls +++ b/tools/testfiles/tattrreg_le.ls @@ -10,6 +10,7 @@ Dataset1 Dataset {NULL} Storage: 0 logical bytes, 0 allocated bytes Type: native int Data: + Dataset2 Dataset {10/10, 10/10} Location: 1:800 Links: 1 diff --git a/tools/testfiles/tbitfields.h5.xml b/tools/testfiles/tbitfields.h5.xml index 62efbce..73365f0 100644 --- a/tools/testfiles/tbitfields.h5.xml +++ b/tools/testfiles/tbitfields.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -23,9 +23,38 @@ - 0xff 0xfe 0xfd 0xfc 0xfb 0xfa 0xf9 0xf8 0xf7 0xf6 0xf5 0xf4 0xf3 - 0xf2 0xf1 0xf0 0xef 0xee 0xed 0xec 0xeb 0xea 0xe9 0xe8 0xe7 0xe6 - 0xe5 0xe4 0xe3 0xe2 0xe1 0xe0 + 0xff + 0xfe + 0xfd + 0xfc + 0xfb + 0xfa + 0xf9 + 0xf8 + 0xf7 + 0xf6 + 0xf5 + 0xf4 + 0xf3 + 0xf2 + 0xf1 + 0xf0 + 0xef + 0xee + 0xed + 0xec + 0xeb + 0xea + 0xe9 + 0xe8 + 0xe7 + 0xe6 + 0xe5 + 0xe4 + 0xe3 + 0xe2 + 0xe1 + 0xe0 @@ -33,9 +62,9 @@ - + - + @@ -50,8 +79,22 @@ - ff:fe fd:fc fb:fa f9:f8 f7:f6 f5:f4 f3:f2 f1:f0 ef:ee ed:ec eb:ea - e9:e8 e7:e6 e5:e4 e3:e2 e1:e0 + ff:fe + fd:fc + fb:fa + f9:f8 + f7:f6 + f5:f4 + f3:f2 + f1:f0 + ef:ee + ed:ec + eb:ea + e9:e8 + e7:e6 + e5:e4 + e3:e2 + e1:e0 diff --git a/tools/testfiles/tboot1.ddl b/tools/testfiles/tboot1.ddl index d4c8f4c..2140743 100644 --- a/tools/testfiles/tboot1.ddl +++ b/tools/testfiles/tboot1.ddl @@ -9,9 +9,9 @@ SUPER_BLOCK { BTREE_RANK 16 BTREE_LEAF 4 ISTORE_K 32 -} -USER_BLOCK { - USERBLOCK_SIZE 0 + USER_BLOCK { + USERBLOCK_SIZE 0 + } } DATASET "dset" { DATATYPE H5T_STD_I32BE diff --git a/tools/testfiles/tboot2.ddl b/tools/testfiles/tboot2.ddl index 774215e..4b77b44 100644 --- a/tools/testfiles/tboot2.ddl +++ b/tools/testfiles/tboot2.ddl @@ -9,9 +9,9 @@ SUPER_BLOCK { BTREE_RANK 16 BTREE_LEAF 4 ISTORE_K 32 -} -USER_BLOCK { - USERBLOCK_SIZE 0 + USER_BLOCK { + USERBLOCK_SIZE 0 + } } GROUP "/" { } diff --git a/tools/testfiles/tchar1.ddl b/tools/testfiles/tchar1.ddl index a84906f..78acaf0 100644 --- a/tools/testfiles/tchar1.ddl +++ b/tools/testfiles/tchar1.ddl @@ -4,11 +4,11 @@ GROUP "/" { DATATYPE H5T_STD_I8LE DATASPACE SIMPLE { ( 308 ) / ( 308 ) } DATA { - "Four score and seven years ago our forefathers brought forth on this " - "continent a new nation, conceived in liberty and dedicated to the pro" - "position that all men are created equal. Now we are engaged in a grea" - "t civil war, testing whether that nation or any nation so conceived a" - "nd so dedicated can long endure." + "Four score and seven years ago our forefathers brought forth on th" + "is continent a new nation, conceived in liberty and dedicated to t" + "he proposition that all men are created equal. Now we are engaged " + "in a great civil war, testing whether that nation or any nation so" + " conceived and so dedicated can long endure." } } } diff --git a/tools/testfiles/tchunked.ddl b/tools/testfiles/tchunked.ddl index 2af1c0c..b68b233 100644 --- a/tools/testfiles/tchunked.ddl +++ b/tools/testfiles/tchunked.ddl @@ -6,13 +6,13 @@ COMMENT "This is a dataset with chunked storage" STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 800 - } + } FILTERS { NONE } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tcompact.ddl b/tools/testfiles/tcompact.ddl index c9066a8..918e2eb 100644 --- a/tools/testfiles/tcompact.ddl +++ b/tools/testfiles/tcompact.ddl @@ -12,7 +12,7 @@ COMMENT "This is a dataset with compact storage" } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_EARLY diff --git a/tools/testfiles/tcompound.h5.xml b/tools/testfiles/tcompound.h5.xml index 6d7d7c8..10ef36e 100644 --- a/tools/testfiles/tcompound.h5.xml +++ b/tools/testfiles/tcompound.h5.xml @@ -25,9 +25,9 @@ - + - + @@ -63,7 +63,11 @@ - 0 0 1 1 1 0.5 2 4 0.333333 3 9 0.25 4 16 0.2 + 0 0 1 + 1 1 0.5 + 2 4 0.333333 + 3 9 0.25 + 4 16 0.2 @@ -72,9 +76,9 @@ - + - + @@ -86,7 +90,11 @@ - 0 0 1 1.1 2 2.2 3 3.3 4 4.4 + 0 0 + 1 1.1 + 2 2.2 + 3 3.3 + 4 4.4 @@ -94,9 +102,9 @@ - + - + @@ -109,96 +117,24 @@ - 0 1 2 3 1 2 3 4 5 6 - 2 3 4 5 6 7 - 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 1 2 3 4 2 3 4 5 6 7 - 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 2 3 4 5 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 3 4 5 6 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 4 5 6 7 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 5 6 7 8 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 10 11 12 13 14 15 - 1 2 3 4 2 3 4 5 6 7 - 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 2 3 4 5 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 3 4 5 6 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 4 5 6 7 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 5 6 7 8 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 10 11 12 13 14 15 - 6 7 8 9 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 10 11 12 13 14 15 - 11 12 13 14 15 16 - 2 3 4 5 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 3 4 5 6 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 4 5 6 7 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 5 6 7 8 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 10 11 12 13 14 15 - 6 7 8 9 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 - 10 11 12 13 14 15 - 11 12 13 14 15 16 - 7 8 9 10 8 9 10 11 12 13 - 9 10 11 12 13 14 - 10 11 12 13 14 15 - 11 12 13 14 15 16 - 12 13 14 15 16 17 + 0 1 2 3 1 2 3 4 5 6 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 + 1 2 3 4 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 + 2 3 4 5 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 + 3 4 5 6 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 + 4 5 6 7 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 + 5 6 7 8 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 10 11 12 13 14 15 + 1 2 3 4 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 + 2 3 4 5 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 + 3 4 5 6 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 + 4 5 6 7 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 + 5 6 7 8 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 10 11 12 13 14 15 + 6 7 8 9 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 10 11 12 13 14 15 11 12 13 14 15 16 + 2 3 4 5 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 + 3 4 5 6 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 + 4 5 6 7 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 + 5 6 7 8 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 10 11 12 13 14 15 + 6 7 8 9 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 10 11 12 13 14 15 11 12 13 14 15 16 + 7 8 9 10 8 9 10 11 12 13 9 10 11 12 13 14 10 11 12 13 14 15 11 12 13 14 15 16 12 13 14 15 16 17 @@ -206,9 +142,9 @@ - + - + @@ -220,7 +156,11 @@ - 0 3 1 4 2 5 3 6 4 7 + 0 3 + 1 4 + 2 5 + 3 6 + 4 7 @@ -250,9 +190,9 @@ - + - + @@ -264,7 +204,11 @@ - 0 0 1 0.1 2 0.2 3 0.3 4 0.4 + 0 0 + 1 0.1 + 2 0.2 + 3 0.3 + 4 0.4 diff --git a/tools/testfiles/tcompound2.h5.xml b/tools/testfiles/tcompound2.h5.xml index 6db1785..ac139d9 100644 --- a/tools/testfiles/tcompound2.h5.xml +++ b/tools/testfiles/tcompound2.h5.xml @@ -31,7 +31,7 @@ - + @@ -67,7 +67,12 @@ - 0 0 1 1 1 0.5 2 4 0.333333 3 9 0.25 4 16 0.2 5 25 0.166667 + 0 0 1 + 1 1 0.5 + 2 4 0.333333 + 3 9 0.25 + 4 16 0.2 + 5 25 0.166667 @@ -82,7 +87,7 @@ - + @@ -94,7 +99,12 @@ - 0 0 1 1.1 2 2.2 3 3.3 4 4.4 5 5.5 + 0 0 + 1 1.1 + 2 2.2 + 3 3.3 + 4 4.4 + 5 5.5 @@ -108,7 +118,7 @@ - + @@ -120,7 +130,12 @@ - 0 0 1 1 2 2 3 3 4 4 5 5 + 0 0 + 1 1 + 2 2 + 3 3 + 4 4 + 5 5 @@ -156,7 +171,7 @@ - + @@ -168,7 +183,12 @@ - 0 0 1 1 2 2 3 3 4 4 5 5 + 0 0 + 1 1 + 2 2 + 3 3 + 4 4 + 5 5 diff --git a/tools/testfiles/tcompound_complex.h5.xml b/tools/testfiles/tcompound_complex.h5.xml index bda8c94..b35193a 100644 --- a/tools/testfiles/tcompound_complex.h5.xml +++ b/tools/testfiles/tcompound_complex.h5.xml @@ -5,12 +5,12 @@ - + - - - - + + + + @@ -90,36 +90,12 @@ - 0 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 0 1 2 3 4 5 - 1 2 3 4 5 6 - 2 3 4 5 6 7 - 3 4 5 6 7 8 - 4 5 6 7 8 9 0 0 0 0 0 0 0 0 0 0 0 109 - 1 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 1 2 3 4 5 6 - 2 3 4 5 6 7 - 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 0.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 109 - 2 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 2 3 4 5 6 7 - 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 1.92 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 109 - 3 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 3 4 5 6 7 8 - 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 2.88 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 109 - 4 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 4 5 6 7 8 9 - 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 3.84 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 109 - 5 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 5 6 7 8 9 10 - 6 7 8 9 10 11 - 7 8 9 10 11 12 - 8 9 10 11 12 13 - 9 10 11 12 13 14 4.8 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 109 + 0 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 0 1 2 3 4 5 1 2 3 4 5 6 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 0 0 0 0 0 0 0 0 0 0 0 109 + 1 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 1 2 3 4 5 6 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 0.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 1024.96 109 + 2 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 1.92 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 2049.93 109 + 3 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 2.88 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 3074.89 109 + 4 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 4 5 6 7 8 9 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 3.84 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 4099.85 109 + 5 "A fight is a contract that takes two people to honor." "A combative stance means that you've accepted the contract." "In which case, you deserve what you get." " -- Professor Cheng Man-ch'ing" "Hello!" 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 8 9 10 11 12 13 9 10 11 12 13 14 4.8 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 5124.82 109 diff --git a/tools/testfiles/tcontiguos.ddl b/tools/testfiles/tcontiguos.ddl index 8800617..bda7ef7 100644 --- a/tools/testfiles/tcontiguos.ddl +++ b/tools/testfiles/tcontiguos.ddl @@ -13,7 +13,7 @@ COMMENT "This is a dataset with contiguous storage" } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE diff --git a/tools/testfiles/tdatareg.h5.xml b/tools/testfiles/tdatareg.h5.xml index 03188b8..327e213 100644 --- a/tools/testfiles/tdatareg.h5.xml +++ b/tools/testfiles/tdatareg.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -31,9 +31,9 @@ - + - + @@ -49,16 +49,106 @@ - 0 3 6 9 12 15 18 21 24 27 - 30 33 36 39 42 45 48 51 54 57 - 60 63 66 69 72 75 78 81 84 87 - 90 93 96 99 102 105 108 111 114 117 - 120 123 126 129 132 135 138 141 144 147 - 150 153 156 159 162 165 168 171 174 177 - 180 183 186 189 192 195 198 201 204 207 - 210 213 216 219 222 225 228 231 234 237 - 240 243 246 249 252 255 2 5 8 11 - 14 17 20 23 26 29 32 35 38 41 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 30 + 33 + 36 + 39 + 42 + 45 + 48 + 51 + 54 + 57 + 60 + 63 + 66 + 69 + 72 + 75 + 78 + 81 + 84 + 87 + 90 + 93 + 96 + 99 + 102 + 105 + 108 + 111 + 114 + 117 + 120 + 123 + 126 + 129 + 132 + 135 + 138 + 141 + 144 + 147 + 150 + 153 + 156 + 159 + 162 + 165 + 168 + 171 + 174 + 177 + 180 + 183 + 186 + 189 + 192 + 195 + 198 + 201 + 204 + 207 + 210 + 213 + 216 + 219 + 222 + 225 + 228 + 231 + 234 + 237 + 240 + 243 + 246 + 249 + 252 + 255 + 2 + 5 + 8 + 11 + 14 + 17 + 20 + 23 + 26 + 29 + 32 + 35 + 38 + 41 diff --git a/tools/testfiles/tdataregR.ddl b/tools/testfiles/tdataregR.ddl index 0f613dc..aaac92c 100644 --- a/tools/testfiles/tdataregR.ddl +++ b/tools/testfiles/tdataregR.ddl @@ -17,7 +17,7 @@ GROUP "/" { (7,2): 216, 219, 222, 225, 228, 231 (0): } (0): } - (1): DATASET /Dataset2 { + (1): DATASET /Dataset2 { (1): REGION_TYPE POINT (6,9), (2,2), (8,4), (1,6), (2,8), (3,2), (1): (0,4), (9,0), (7,1), (3,3) (1): DATATYPE H5T_STD_U8BE diff --git a/tools/testfiles/tdeflate.ddl b/tools/testfiles/tdeflate.ddl index e59d392..5603911 100644 --- a/tools/testfiles/tdeflate.ddl +++ b/tools/testfiles/tdeflate.ddl @@ -5,13 +5,13 @@ DATASET "deflate" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 385 (2.078:1 COMPRESSION) - } + } FILTERS { COMPRESSION DEFLATE { LEVEL 9 } } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tdset.h5.xml b/tools/testfiles/tdset.h5.xml index 59719d3..e914bf6 100644 --- a/tools/testfiles/tdset.h5.xml +++ b/tools/testfiles/tdset.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -23,16 +23,206 @@ - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 - 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 - 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 - 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 - 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 - 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 - 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 - 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 - 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 @@ -40,9 +230,9 @@ - + - + @@ -58,86 +248,606 @@ - 0 0.0001 0.0002 0.0003 0.0004 0.0005 0.0006 0.0007 0.0008 0.0009 0.001 - 0.0011 0.0012 0.0013 0.0014 0.0015 0.0016 0.0017 0.0018 0.0019 - 1 1.0001 1.0002 1.0003 1.0004 1.0005 1.0006 1.0007 1.0008 1.0009 1.001 - 1.0011 1.0012 1.0013 1.0014 1.0015 1.0016 1.0017 1.0018 1.0019 - 2 2.0001 2.0002 2.0003 2.0004 2.0005 2.0006 2.0007 2.0008 2.0009 2.001 - 2.0011 2.0012 2.0013 2.0014 2.0015 2.0016 2.0017 2.0018 2.0019 - 3 3.0001 3.0002 3.0003 3.0004 3.0005 3.0006 3.0007 3.0008 3.0009 3.001 - 3.0011 3.0012 3.0013 3.0014 3.0015 3.0016 3.0017 3.0018 3.0019 - 4 4.0001 4.0002 4.0003 4.0004 4.0005 4.0006 4.0007 4.0008 4.0009 4.001 - 4.0011 4.0012 4.0013 4.0014 4.0015 4.0016 4.0017 4.0018 4.0019 - 5 5.0001 5.0002 5.0003 5.0004 5.0005 5.0006 5.0007 5.0008 5.0009 5.001 - 5.0011 5.0012 5.0013 5.0014 5.0015 5.0016 5.0017 5.0018 5.0019 - 6 6.0001 6.0002 6.0003 6.0004 6.0005 6.0006 6.0007 6.0008 6.0009 6.001 - 6.0011 6.0012 6.0013 6.0014 6.0015 6.0016 6.0017 6.0018 6.0019 - 7 7.0001 7.0002 7.0003 7.0004 7.0005 7.0006 7.0007 7.0008 7.0009 7.001 - 7.0011 7.0012 7.0013 7.0014 7.0015 7.0016 7.0017 7.0018 7.0019 - 8 8.0001 8.0002 8.0003 8.0004 8.0005 8.0006 8.0007 8.0008 8.0009 8.001 - 8.0011 8.0012 8.0013 8.0014 8.0015 8.0016 8.0017 8.0018 8.0019 - 9 9.0001 9.0002 9.0003 9.0004 9.0005 9.0006 9.0007 9.0008 9.0009 9.001 - 9.0011 9.0012 9.0013 9.0014 9.0015 9.0016 9.0017 9.0018 9.0019 - 10 10.0001 10.0002 10.0003 10.0004 10.0005 10.0006 10.0007 10.0008 - 10.0009 10.001 10.0011 10.0012 10.0013 10.0014 10.0015 10.0016 10.0017 - 10.0018 10.0019 - 11 11.0001 11.0002 11.0003 11.0004 11.0005 11.0006 11.0007 11.0008 - 11.0009 11.001 11.0011 11.0012 11.0013 11.0014 11.0015 11.0016 11.0017 - 11.0018 11.0019 - 12 12.0001 12.0002 12.0003 12.0004 12.0005 12.0006 12.0007 12.0008 - 12.0009 12.001 12.0011 12.0012 12.0013 12.0014 12.0015 12.0016 12.0017 - 12.0018 12.0019 - 13 13.0001 13.0002 13.0003 13.0004 13.0005 13.0006 13.0007 13.0008 - 13.0009 13.001 13.0011 13.0012 13.0013 13.0014 13.0015 13.0016 13.0017 - 13.0018 13.0019 - 14 14.0001 14.0002 14.0003 14.0004 14.0005 14.0006 14.0007 14.0008 - 14.0009 14.001 14.0011 14.0012 14.0013 14.0014 14.0015 14.0016 14.0017 - 14.0018 14.0019 - 15 15.0001 15.0002 15.0003 15.0004 15.0005 15.0006 15.0007 15.0008 - 15.0009 15.001 15.0011 15.0012 15.0013 15.0014 15.0015 15.0016 15.0017 - 15.0018 15.0019 - 16 16.0001 16.0002 16.0003 16.0004 16.0005 16.0006 16.0007 16.0008 - 16.0009 16.001 16.0011 16.0012 16.0013 16.0014 16.0015 16.0016 16.0017 - 16.0018 16.0019 - 17 17.0001 17.0002 17.0003 17.0004 17.0005 17.0006 17.0007 17.0008 - 17.0009 17.001 17.0011 17.0012 17.0013 17.0014 17.0015 17.0016 17.0017 - 17.0018 17.0019 - 18 18.0001 18.0002 18.0003 18.0004 18.0005 18.0006 18.0007 18.0008 - 18.0009 18.001 18.0011 18.0012 18.0013 18.0014 18.0015 18.0016 18.0017 - 18.0018 18.0019 - 19 19.0001 19.0002 19.0003 19.0004 19.0005 19.0006 19.0007 19.0008 - 19.0009 19.001 19.0011 19.0012 19.0013 19.0014 19.0015 19.0016 19.0017 - 19.0018 19.0019 - 20 20.0001 20.0002 20.0003 20.0004 20.0005 20.0006 20.0007 20.0008 - 20.0009 20.001 20.0011 20.0012 20.0013 20.0014 20.0015 20.0016 20.0017 - 20.0018 20.0019 - 21 21.0001 21.0002 21.0003 21.0004 21.0005 21.0006 21.0007 21.0008 - 21.0009 21.001 21.0011 21.0012 21.0013 21.0014 21.0015 21.0016 21.0017 - 21.0018 21.0019 - 22 22.0001 22.0002 22.0003 22.0004 22.0005 22.0006 22.0007 22.0008 - 22.0009 22.001 22.0011 22.0012 22.0013 22.0014 22.0015 22.0016 22.0017 - 22.0018 22.0019 - 23 23.0001 23.0002 23.0003 23.0004 23.0005 23.0006 23.0007 23.0008 - 23.0009 23.001 23.0011 23.0012 23.0013 23.0014 23.0015 23.0016 23.0017 - 23.0018 23.0019 - 24 24.0001 24.0002 24.0003 24.0004 24.0005 24.0006 24.0007 24.0008 - 24.0009 24.001 24.0011 24.0012 24.0013 24.0014 24.0015 24.0016 24.0017 - 24.0018 24.0019 - 25 25.0001 25.0002 25.0003 25.0004 25.0005 25.0006 25.0007 25.0008 - 25.0009 25.001 25.0011 25.0012 25.0013 25.0014 25.0015 25.0016 25.0017 - 25.0018 25.0019 - 26 26.0001 26.0002 26.0003 26.0004 26.0005 26.0006 26.0007 26.0008 - 26.0009 26.001 26.0011 26.0012 26.0013 26.0014 26.0015 26.0016 26.0017 - 26.0018 26.0019 - 27 27.0001 27.0002 27.0003 27.0004 27.0005 27.0006 27.0007 27.0008 - 27.0009 27.001 27.0011 27.0012 27.0013 27.0014 27.0015 27.0016 27.0017 - 27.0018 27.0019 - 28 28.0001 28.0002 28.0003 28.0004 28.0005 28.0006 28.0007 28.0008 - 28.0009 28.001 28.0011 28.0012 28.0013 28.0014 28.0015 28.0016 28.0017 - 28.0018 28.0019 - 29 29.0001 29.0002 29.0003 29.0004 29.0005 29.0006 29.0007 29.0008 - 29.0009 29.001 29.0011 29.0012 29.0013 29.0014 29.0015 29.0016 29.0017 - 29.0018 29.0019 + 0 + 0.0001 + 0.0002 + 0.0003 + 0.0004 + 0.0005 + 0.0006 + 0.0007 + 0.0008 + 0.0009 + 0.001 + 0.0011 + 0.0012 + 0.0013 + 0.0014 + 0.0015 + 0.0016 + 0.0017 + 0.0018 + 0.0019 + 1 + 1.0001 + 1.0002 + 1.0003 + 1.0004 + 1.0005 + 1.0006 + 1.0007 + 1.0008 + 1.0009 + 1.001 + 1.0011 + 1.0012 + 1.0013 + 1.0014 + 1.0015 + 1.0016 + 1.0017 + 1.0018 + 1.0019 + 2 + 2.0001 + 2.0002 + 2.0003 + 2.0004 + 2.0005 + 2.0006 + 2.0007 + 2.0008 + 2.0009 + 2.001 + 2.0011 + 2.0012 + 2.0013 + 2.0014 + 2.0015 + 2.0016 + 2.0017 + 2.0018 + 2.0019 + 3 + 3.0001 + 3.0002 + 3.0003 + 3.0004 + 3.0005 + 3.0006 + 3.0007 + 3.0008 + 3.0009 + 3.001 + 3.0011 + 3.0012 + 3.0013 + 3.0014 + 3.0015 + 3.0016 + 3.0017 + 3.0018 + 3.0019 + 4 + 4.0001 + 4.0002 + 4.0003 + 4.0004 + 4.0005 + 4.0006 + 4.0007 + 4.0008 + 4.0009 + 4.001 + 4.0011 + 4.0012 + 4.0013 + 4.0014 + 4.0015 + 4.0016 + 4.0017 + 4.0018 + 4.0019 + 5 + 5.0001 + 5.0002 + 5.0003 + 5.0004 + 5.0005 + 5.0006 + 5.0007 + 5.0008 + 5.0009 + 5.001 + 5.0011 + 5.0012 + 5.0013 + 5.0014 + 5.0015 + 5.0016 + 5.0017 + 5.0018 + 5.0019 + 6 + 6.0001 + 6.0002 + 6.0003 + 6.0004 + 6.0005 + 6.0006 + 6.0007 + 6.0008 + 6.0009 + 6.001 + 6.0011 + 6.0012 + 6.0013 + 6.0014 + 6.0015 + 6.0016 + 6.0017 + 6.0018 + 6.0019 + 7 + 7.0001 + 7.0002 + 7.0003 + 7.0004 + 7.0005 + 7.0006 + 7.0007 + 7.0008 + 7.0009 + 7.001 + 7.0011 + 7.0012 + 7.0013 + 7.0014 + 7.0015 + 7.0016 + 7.0017 + 7.0018 + 7.0019 + 8 + 8.0001 + 8.0002 + 8.0003 + 8.0004 + 8.0005 + 8.0006 + 8.0007 + 8.0008 + 8.0009 + 8.001 + 8.0011 + 8.0012 + 8.0013 + 8.0014 + 8.0015 + 8.0016 + 8.0017 + 8.0018 + 8.0019 + 9 + 9.0001 + 9.0002 + 9.0003 + 9.0004 + 9.0005 + 9.0006 + 9.0007 + 9.0008 + 9.0009 + 9.001 + 9.0011 + 9.0012 + 9.0013 + 9.0014 + 9.0015 + 9.0016 + 9.0017 + 9.0018 + 9.0019 + 10 + 10.0001 + 10.0002 + 10.0003 + 10.0004 + 10.0005 + 10.0006 + 10.0007 + 10.0008 + 10.0009 + 10.001 + 10.0011 + 10.0012 + 10.0013 + 10.0014 + 10.0015 + 10.0016 + 10.0017 + 10.0018 + 10.0019 + 11 + 11.0001 + 11.0002 + 11.0003 + 11.0004 + 11.0005 + 11.0006 + 11.0007 + 11.0008 + 11.0009 + 11.001 + 11.0011 + 11.0012 + 11.0013 + 11.0014 + 11.0015 + 11.0016 + 11.0017 + 11.0018 + 11.0019 + 12 + 12.0001 + 12.0002 + 12.0003 + 12.0004 + 12.0005 + 12.0006 + 12.0007 + 12.0008 + 12.0009 + 12.001 + 12.0011 + 12.0012 + 12.0013 + 12.0014 + 12.0015 + 12.0016 + 12.0017 + 12.0018 + 12.0019 + 13 + 13.0001 + 13.0002 + 13.0003 + 13.0004 + 13.0005 + 13.0006 + 13.0007 + 13.0008 + 13.0009 + 13.001 + 13.0011 + 13.0012 + 13.0013 + 13.0014 + 13.0015 + 13.0016 + 13.0017 + 13.0018 + 13.0019 + 14 + 14.0001 + 14.0002 + 14.0003 + 14.0004 + 14.0005 + 14.0006 + 14.0007 + 14.0008 + 14.0009 + 14.001 + 14.0011 + 14.0012 + 14.0013 + 14.0014 + 14.0015 + 14.0016 + 14.0017 + 14.0018 + 14.0019 + 15 + 15.0001 + 15.0002 + 15.0003 + 15.0004 + 15.0005 + 15.0006 + 15.0007 + 15.0008 + 15.0009 + 15.001 + 15.0011 + 15.0012 + 15.0013 + 15.0014 + 15.0015 + 15.0016 + 15.0017 + 15.0018 + 15.0019 + 16 + 16.0001 + 16.0002 + 16.0003 + 16.0004 + 16.0005 + 16.0006 + 16.0007 + 16.0008 + 16.0009 + 16.001 + 16.0011 + 16.0012 + 16.0013 + 16.0014 + 16.0015 + 16.0016 + 16.0017 + 16.0018 + 16.0019 + 17 + 17.0001 + 17.0002 + 17.0003 + 17.0004 + 17.0005 + 17.0006 + 17.0007 + 17.0008 + 17.0009 + 17.001 + 17.0011 + 17.0012 + 17.0013 + 17.0014 + 17.0015 + 17.0016 + 17.0017 + 17.0018 + 17.0019 + 18 + 18.0001 + 18.0002 + 18.0003 + 18.0004 + 18.0005 + 18.0006 + 18.0007 + 18.0008 + 18.0009 + 18.001 + 18.0011 + 18.0012 + 18.0013 + 18.0014 + 18.0015 + 18.0016 + 18.0017 + 18.0018 + 18.0019 + 19 + 19.0001 + 19.0002 + 19.0003 + 19.0004 + 19.0005 + 19.0006 + 19.0007 + 19.0008 + 19.0009 + 19.001 + 19.0011 + 19.0012 + 19.0013 + 19.0014 + 19.0015 + 19.0016 + 19.0017 + 19.0018 + 19.0019 + 20 + 20.0001 + 20.0002 + 20.0003 + 20.0004 + 20.0005 + 20.0006 + 20.0007 + 20.0008 + 20.0009 + 20.001 + 20.0011 + 20.0012 + 20.0013 + 20.0014 + 20.0015 + 20.0016 + 20.0017 + 20.0018 + 20.0019 + 21 + 21.0001 + 21.0002 + 21.0003 + 21.0004 + 21.0005 + 21.0006 + 21.0007 + 21.0008 + 21.0009 + 21.001 + 21.0011 + 21.0012 + 21.0013 + 21.0014 + 21.0015 + 21.0016 + 21.0017 + 21.0018 + 21.0019 + 22 + 22.0001 + 22.0002 + 22.0003 + 22.0004 + 22.0005 + 22.0006 + 22.0007 + 22.0008 + 22.0009 + 22.001 + 22.0011 + 22.0012 + 22.0013 + 22.0014 + 22.0015 + 22.0016 + 22.0017 + 22.0018 + 22.0019 + 23 + 23.0001 + 23.0002 + 23.0003 + 23.0004 + 23.0005 + 23.0006 + 23.0007 + 23.0008 + 23.0009 + 23.001 + 23.0011 + 23.0012 + 23.0013 + 23.0014 + 23.0015 + 23.0016 + 23.0017 + 23.0018 + 23.0019 + 24 + 24.0001 + 24.0002 + 24.0003 + 24.0004 + 24.0005 + 24.0006 + 24.0007 + 24.0008 + 24.0009 + 24.001 + 24.0011 + 24.0012 + 24.0013 + 24.0014 + 24.0015 + 24.0016 + 24.0017 + 24.0018 + 24.0019 + 25 + 25.0001 + 25.0002 + 25.0003 + 25.0004 + 25.0005 + 25.0006 + 25.0007 + 25.0008 + 25.0009 + 25.001 + 25.0011 + 25.0012 + 25.0013 + 25.0014 + 25.0015 + 25.0016 + 25.0017 + 25.0018 + 25.0019 + 26 + 26.0001 + 26.0002 + 26.0003 + 26.0004 + 26.0005 + 26.0006 + 26.0007 + 26.0008 + 26.0009 + 26.001 + 26.0011 + 26.0012 + 26.0013 + 26.0014 + 26.0015 + 26.0016 + 26.0017 + 26.0018 + 26.0019 + 27 + 27.0001 + 27.0002 + 27.0003 + 27.0004 + 27.0005 + 27.0006 + 27.0007 + 27.0008 + 27.0009 + 27.001 + 27.0011 + 27.0012 + 27.0013 + 27.0014 + 27.0015 + 27.0016 + 27.0017 + 27.0018 + 27.0019 + 28 + 28.0001 + 28.0002 + 28.0003 + 28.0004 + 28.0005 + 28.0006 + 28.0007 + 28.0008 + 28.0009 + 28.001 + 28.0011 + 28.0012 + 28.0013 + 28.0014 + 28.0015 + 28.0016 + 28.0017 + 28.0018 + 28.0019 + 29 + 29.0001 + 29.0002 + 29.0003 + 29.0004 + 29.0005 + 29.0006 + 29.0007 + 29.0008 + 29.0009 + 29.001 + 29.0011 + 29.0012 + 29.0013 + 29.0014 + 29.0015 + 29.0016 + 29.0017 + 29.0018 + 29.0019 diff --git a/tools/testfiles/tdset2.h5.xml b/tools/testfiles/tdset2.h5.xml index a407ae8..34f43e1 100644 --- a/tools/testfiles/tdset2.h5.xml +++ b/tools/testfiles/tdset2.h5.xml @@ -12,7 +12,7 @@ - + @@ -28,16 +28,206 @@ - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 - 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 @@ -52,7 +242,7 @@ - + @@ -68,36 +258,306 @@ - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 diff --git a/tools/testfiles/tempty-dtd-2.h5.xml b/tools/testfiles/tempty-dtd-2.h5.xml index cff16fd..a9b1d4f 100644 --- a/tools/testfiles/tempty-dtd-2.h5.xml +++ b/tools/testfiles/tempty-dtd-2.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -28,7 +28,10 @@ - + + + + @@ -36,9 +39,9 @@ - + - + @@ -53,7 +56,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -61,9 +67,9 @@ - + - + @@ -78,7 +84,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -86,9 +95,9 @@ - + - + @@ -108,7 +117,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -116,9 +128,9 @@ - + - + @@ -154,7 +166,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-dtd-uri.h5.xml b/tools/testfiles/tempty-dtd-uri.h5.xml index 76beb0f..d3c5e81 100644 --- a/tools/testfiles/tempty-dtd-uri.h5.xml +++ b/tools/testfiles/tempty-dtd-uri.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -28,7 +28,10 @@ - + + + + @@ -36,9 +39,9 @@ - + - + @@ -53,7 +56,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -61,9 +67,9 @@ - + - + @@ -78,7 +84,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -86,9 +95,9 @@ - + - + @@ -108,7 +117,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -116,9 +128,9 @@ - + - + @@ -154,7 +166,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-dtd.h5.xml b/tools/testfiles/tempty-dtd.h5.xml index cff16fd..a9b1d4f 100644 --- a/tools/testfiles/tempty-dtd.h5.xml +++ b/tools/testfiles/tempty-dtd.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -28,7 +28,10 @@ - + + + + @@ -36,9 +39,9 @@ - + - + @@ -53,7 +56,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -61,9 +67,9 @@ - + - + @@ -78,7 +84,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -86,9 +95,9 @@ - + - + @@ -108,7 +117,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -116,9 +128,9 @@ - + - + @@ -154,7 +166,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-nons-2.h5.xml b/tools/testfiles/tempty-nons-2.h5.xml index c43c163..219dbfd 100644 --- a/tools/testfiles/tempty-nons-2.h5.xml +++ b/tools/testfiles/tempty-nons-2.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - + + + + @@ -35,9 +38,9 @@ - + - + @@ -52,7 +55,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -60,9 +66,9 @@ - + - + @@ -77,7 +83,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -85,9 +94,9 @@ - + - + @@ -107,7 +116,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -115,9 +127,9 @@ - + - + @@ -153,7 +165,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-nons-uri.h5.xml b/tools/testfiles/tempty-nons-uri.h5.xml index 28df2e6..032de41 100644 --- a/tools/testfiles/tempty-nons-uri.h5.xml +++ b/tools/testfiles/tempty-nons-uri.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - + + + + @@ -35,9 +38,9 @@ - + - + @@ -52,7 +55,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -60,9 +66,9 @@ - + - + @@ -77,7 +83,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -85,9 +94,9 @@ - + - + @@ -107,7 +116,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -115,9 +127,9 @@ - + - + @@ -153,7 +165,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-nons.h5.xml b/tools/testfiles/tempty-nons.h5.xml index c43c163..219dbfd 100644 --- a/tools/testfiles/tempty-nons.h5.xml +++ b/tools/testfiles/tempty-nons.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - + + + + @@ -35,9 +38,9 @@ - + - + @@ -52,7 +55,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -60,9 +66,9 @@ - + - + @@ -77,7 +83,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -85,9 +94,9 @@ - + - + @@ -107,7 +116,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -115,9 +127,9 @@ - + - + @@ -153,7 +165,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-ns-2.h5.xml b/tools/testfiles/tempty-ns-2.h5.xml index 4504115..3476b60 100644 --- a/tools/testfiles/tempty-ns-2.h5.xml +++ b/tools/testfiles/tempty-ns-2.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - + + + + @@ -35,9 +38,9 @@ - + - + @@ -52,7 +55,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -60,9 +66,9 @@ - + - + @@ -77,7 +83,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -85,9 +94,9 @@ - + - + @@ -107,7 +116,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -115,9 +127,9 @@ - + - + @@ -153,7 +165,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty-ns.h5.xml b/tools/testfiles/tempty-ns.h5.xml index 4504115..3476b60 100644 --- a/tools/testfiles/tempty-ns.h5.xml +++ b/tools/testfiles/tempty-ns.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - + + + + @@ -35,9 +38,9 @@ - + - + @@ -52,7 +55,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -60,9 +66,9 @@ - + - + @@ -77,7 +83,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -85,9 +94,9 @@ - + - + @@ -107,7 +116,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -115,9 +127,9 @@ - + - + @@ -153,7 +165,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tempty.h5.xml b/tools/testfiles/tempty.h5.xml index e6981a5..d75bc70 100644 --- a/tools/testfiles/tempty.h5.xml +++ b/tools/testfiles/tempty.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - + + + + @@ -35,9 +38,9 @@ - + - + @@ -52,7 +55,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -60,9 +66,9 @@ - + - + @@ -77,7 +83,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -85,9 +94,9 @@ - + - + @@ -107,7 +116,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 @@ -115,9 +127,9 @@ - + - + @@ -153,7 +165,10 @@ - 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 + 0 0 0 diff --git a/tools/testfiles/tenum.h5.xml b/tools/testfiles/tenum.h5.xml index 93cbfc8..ecc7804 100644 --- a/tools/testfiles/tenum.h5.xml +++ b/tools/testfiles/tenum.h5.xml @@ -49,9 +49,9 @@ green - + - + @@ -62,10 +62,26 @@ green - RED GREEN\ngreen BLUE blue GREEN\ngreen WHITE \"white\" WHITE \"white\" - BLACK \'black\' GREEN\ngreen BLUE blue RED RED BLUE blue GREEN\ngreen - BLACK \'black\' WHITE \"white\" RED WHITE \"white\" GREEN\ngreen - GREEN\ngreen BLUE blue + RED + GREEN\ngreen + BLUE blue + GREEN\ngreen + WHITE \"white\" + WHITE \"white\" + BLACK \'black\' + GREEN\ngreen + BLUE blue + RED + RED + BLUE blue + GREEN\ngreen + BLACK \'black\' + WHITE \"white\" + RED + WHITE \"white\" + GREEN\ngreen + GREEN\ngreen + BLUE blue diff --git a/tools/testfiles/texternal.ddl b/tools/testfiles/texternal.ddl index 7f7b69a..279831a 100644 --- a/tools/testfiles/texternal.ddl +++ b/tools/testfiles/texternal.ddl @@ -14,7 +14,7 @@ DATASET "external" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE diff --git a/tools/testfiles/textlinkfar.ddl b/tools/testfiles/textlinkfar.ddl index 45f2145..32b2b49 100644 --- a/tools/testfiles/textlinkfar.ddl +++ b/tools/testfiles/textlinkfar.ddl @@ -66,7 +66,6 @@ GROUP "/" { TARGETFILE "textlinktar.h5" TARGETPATH "type" DATATYPE "type" H5T_STD_I32LE; - } EXTERNAL_LINK "ext_link4" { TARGETFILE "textlinktar.h5" diff --git a/tools/testfiles/textlinksrc.ddl b/tools/testfiles/textlinksrc.ddl index 942477e..6ef0b44 100644 --- a/tools/testfiles/textlinksrc.ddl +++ b/tools/testfiles/textlinksrc.ddl @@ -59,7 +59,6 @@ GROUP "/" { TARGETFILE "textlinktar.h5" TARGETPATH "type" DATATYPE "type" H5T_STD_I32LE; - } EXTERNAL_LINK "ext_link4" { TARGETFILE "textlinktar.h5" diff --git a/tools/testfiles/tfill.ddl b/tools/testfiles/tfill.ddl index 87f9ae5..45497fd 100644 --- a/tools/testfiles/tfill.ddl +++ b/tools/testfiles/tfill.ddl @@ -13,7 +13,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE [ 0, 0, 0 ] + VALUE [ 0, 0, 0 ] } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -39,9 +39,9 @@ GROUP "/" { FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET VALUE { - 1, - 2 - } + 1, + 2 + } } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -70,7 +70,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_ALLOC - VALUE -99 + VALUE -99 } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -92,7 +92,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE -99 + VALUE -99 } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -114,7 +114,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_NEVER - VALUE -99 + VALUE -99 } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -136,7 +136,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_ALLOC - VALUE () + VALUE () } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -158,7 +158,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE diff --git a/tools/testfiles/tfletcher32.ddl b/tools/testfiles/tfletcher32.ddl index 0b7b1b8..072ef23 100644 --- a/tools/testfiles/tfletcher32.ddl +++ b/tools/testfiles/tfletcher32.ddl @@ -5,13 +5,13 @@ DATASET "fletcher32" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 816 - } + } FILTERS { CHECKSUM FLETCHER32 } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tfpformat.ddl b/tools/testfiles/tfpformat.ddl index 6f0281b..2830ad5 100644 --- a/tools/testfiles/tfpformat.ddl +++ b/tools/testfiles/tfpformat.ddl @@ -4,14 +4,24 @@ GROUP "/" { DATATYPE H5T_IEEE_F64LE DATASPACE SIMPLE { ( 6 ) / ( 6 ) } DATA { - (0): -0.1234567, 0.1234567, 0.0000000, 0.0000000, 0.0000000, 0.0000000 + (0): -0.1234567, + (1): 0.1234567, + (2): 0.0000000, + (3): 0.0000000, + (4): 0.0000000, + (5): 0.0000000 } } DATASET "float" { DATATYPE H5T_IEEE_F32LE DATASPACE SIMPLE { ( 6 ) / ( 6 ) } DATA { - (0): -0.1234567, 0.1234567, 0.0000000, 0.0000000, 0.0000000, 0.0000000 + (0): -0.1234567, + (1): 0.1234567, + (2): 0.0000000, + (3): 0.0000000, + (4): 0.0000000, + (5): 0.0000000 } } } diff --git a/tools/testfiles/tfpformat.h5.xml b/tools/testfiles/tfpformat.h5.xml index 34af79a..c2bd96f 100644 --- a/tools/testfiles/tfpformat.h5.xml +++ b/tools/testfiles/tfpformat.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -23,7 +23,12 @@ - -0.1234567 0.1234567 0.0000000 0.0000000 0.0000000 0.0000000 + -0.1234567 + 0.1234567 + 0.0000000 + 0.0000000 + 0.0000000 + 0.0000000 @@ -31,9 +36,9 @@ - + - + @@ -48,7 +53,12 @@ - -0.1234567 0.1234567 0.0000000 0.0000000 0.0000000 0.0000000 + -0.1234567 + 0.1234567 + 0.0000000 + 0.0000000 + 0.0000000 + 0.0000000 diff --git a/tools/testfiles/thlink.h5.xml b/tools/testfiles/thlink.h5.xml index b726087..65d7f8a 100644 --- a/tools/testfiles/thlink.h5.xml +++ b/tools/testfiles/thlink.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -22,7 +22,11 @@ - 0 1 2 3 4 + 0 + 1 + 2 + 3 + 4 @@ -37,10 +41,10 @@ - + - + diff --git a/tools/testfiles/tloop.h5.xml b/tools/testfiles/tloop.h5.xml index 4be3290..36e8f1b 100644 --- a/tools/testfiles/tloop.h5.xml +++ b/tools/testfiles/tloop.h5.xml @@ -4,12 +4,12 @@ - + - + diff --git a/tools/testfiles/tloop2.h5.xml b/tools/testfiles/tloop2.h5.xml index ffaf089..185e08b 100644 --- a/tools/testfiles/tloop2.h5.xml +++ b/tools/testfiles/tloop2.h5.xml @@ -7,7 +7,7 @@ - + diff --git a/tools/testfiles/tmany.h5.xml b/tools/testfiles/tmany.h5.xml index 8fc5e59..8056783 100644 --- a/tools/testfiles/tmany.h5.xml +++ b/tools/testfiles/tmany.h5.xml @@ -13,7 +13,7 @@ - + @@ -83,7 +83,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -101,8 +110,10 @@ - 0 1 - 2 3 + 0 + 1 + 2 + 3 @@ -119,145 +130,28 @@ - 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 + 0 + 0.1 + 0.2 + 0.3 + 0.4 + 0.5 + 0.6 + 0.7 + 0.8 + 0.9 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 0 1 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 - 0 1 6 7 - 6 7 - 6 7 - 6 7 - 6 7 - 6 7 - 6 7 - 6 7 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 1 2 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 - 1 2 7 8 - 7 8 - 7 8 - 7 8 - 7 8 - 7 8 - 7 8 - 7 8 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 2 3 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 - 2 3 8 9 - 8 9 - 8 9 - 8 9 - 8 9 - 8 9 - 8 9 - 8 9 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 3 4 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 - 3 4 9 10 - 9 10 - 9 10 - 9 10 - 9 10 - 9 10 - 9 10 - 9 10 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 4 5 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 - 4 5 10 11 - 10 11 - 10 11 - 10 11 - 10 11 - 10 11 - 10 11 - 10 11 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 5 6 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 - 5 6 11 12 - 11 12 - 11 12 - 11 12 - 11 12 - 11 12 - 11 12 - 11 12 + 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 + 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 + 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 + 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 + 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 10 11 10 11 10 11 10 11 10 11 10 11 10 11 10 11 + 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 11 12 11 12 11 12 11 12 11 12 11 12 11 12 11 12 @@ -276,9 +170,9 @@ - + - + @@ -294,16 +188,106 @@ - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 - 0 1 2 3 4 5 6 7 8 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 @@ -321,9 +305,9 @@ - + - + @@ -339,16 +323,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 1 1 1 1 1 1 1 1 1 1 - 2 2 2 2 2 2 2 2 2 2 - 3 3 3 3 3 3 3 3 3 3 - 4 4 4 4 4 4 4 4 4 4 - 5 5 5 5 5 5 5 5 5 5 - 6 6 6 6 6 6 6 6 6 6 - 7 7 7 7 7 7 7 7 7 7 - 8 8 8 8 8 8 8 8 8 8 - 9 9 9 9 9 9 9 9 9 9 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 6 + 7 + 7 + 7 + 7 + 7 + 7 + 7 + 7 + 7 + 7 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 diff --git a/tools/testfiles/tname-amp.h5.xml b/tools/testfiles/tname-amp.h5.xml index 0893511..f28cdc5 100644 --- a/tools/testfiles/tname-amp.h5.xml +++ b/tools/testfiles/tname-amp.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -23,9 +32,9 @@ - + - + @@ -41,16 +50,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 diff --git a/tools/testfiles/tname-apos.h5.xml b/tools/testfiles/tname-apos.h5.xml index 47f55a2..2194971 100644 --- a/tools/testfiles/tname-apos.h5.xml +++ b/tools/testfiles/tname-apos.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -23,9 +32,9 @@ - + - + @@ -41,16 +50,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 diff --git a/tools/testfiles/tname-gt.h5.xml b/tools/testfiles/tname-gt.h5.xml index e21909e..6a56587 100644 --- a/tools/testfiles/tname-gt.h5.xml +++ b/tools/testfiles/tname-gt.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -23,9 +32,9 @@ - + - + @@ -41,16 +50,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 diff --git a/tools/testfiles/tname-lt.h5.xml b/tools/testfiles/tname-lt.h5.xml index 3738de9..a6d2480 100644 --- a/tools/testfiles/tname-lt.h5.xml +++ b/tools/testfiles/tname-lt.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -23,9 +32,9 @@ - + - + @@ -41,16 +50,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 diff --git a/tools/testfiles/tname-quot.h5.xml b/tools/testfiles/tname-quot.h5.xml index 9da93c5..96ad068 100644 --- a/tools/testfiles/tname-quot.h5.xml +++ b/tools/testfiles/tname-quot.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -23,9 +32,9 @@ - + - + @@ -41,16 +50,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 diff --git a/tools/testfiles/tname-sp.h5.xml b/tools/testfiles/tname-sp.h5.xml index 3bdc6a8..d6f8278 100644 --- a/tools/testfiles/tname-sp.h5.xml +++ b/tools/testfiles/tname-sp.h5.xml @@ -14,7 +14,16 @@ - 97 98 99 100 101 102 103 104 105 0 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 0 @@ -23,9 +32,9 @@ - + - + @@ -41,16 +50,106 @@ - 0 0 0 0 0 0 0 0 0 0 - 0 1 2 3 4 5 6 7 8 9 - 0 2 4 6 8 10 12 14 16 18 - 0 3 6 9 12 15 18 21 24 27 - 0 4 8 12 16 20 24 28 32 36 - 0 5 10 15 20 25 30 35 40 45 - 0 6 12 18 24 30 36 42 48 54 - 0 7 14 21 28 35 42 49 56 63 - 0 8 16 24 32 40 48 56 64 72 - 0 9 18 27 36 45 54 63 72 81 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 + 2 + 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 0 + 3 + 6 + 9 + 12 + 15 + 18 + 21 + 24 + 27 + 0 + 4 + 8 + 12 + 16 + 20 + 24 + 28 + 32 + 36 + 0 + 5 + 10 + 15 + 20 + 25 + 30 + 35 + 40 + 45 + 0 + 6 + 12 + 18 + 24 + 30 + 36 + 42 + 48 + 54 + 0 + 7 + 14 + 21 + 28 + 35 + 42 + 49 + 56 + 63 + 0 + 8 + 16 + 24 + 32 + 40 + 48 + 56 + 64 + 72 + 0 + 9 + 18 + 27 + 36 + 45 + 54 + 63 + 72 + 81 diff --git a/tools/testfiles/tnamed_dtype_attr.ddl b/tools/testfiles/tnamed_dtype_attr.ddl index 48afaf8..7cd14ef 100644 --- a/tools/testfiles/tnamed_dtype_attr.ddl +++ b/tools/testfiles/tnamed_dtype_attr.ddl @@ -22,9 +22,7 @@ GROUP "/" { (0): 8 } } - DATATYPE "Link_to_Datatype" HARDLINK "/Datatype" - GROUP "g1" { ATTRIBUTE "Attribute" { DATATYPE "/Datatype" diff --git a/tools/testfiles/tnamed_dtype_attr.h5.xml b/tools/testfiles/tnamed_dtype_attr.h5.xml index aee7915..199211c 100644 --- a/tools/testfiles/tnamed_dtype_attr.h5.xml +++ b/tools/testfiles/tnamed_dtype_attr.h5.xml @@ -5,9 +5,9 @@ - + - + diff --git a/tools/testfiles/tnbit.ddl b/tools/testfiles/tnbit.ddl index 85a0d9a..bd32eaa 100644 --- a/tools/testfiles/tnbit.ddl +++ b/tools/testfiles/tnbit.ddl @@ -5,13 +5,13 @@ DATASET "nbit" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 76 (10.526:1 COMPRESSION) - } + } FILTERS { COMPRESSION NBIT } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tnestedcomp.h5.xml b/tools/testfiles/tnestedcomp.h5.xml index f5f9fea..2cae353 100644 --- a/tools/testfiles/tnestedcomp.h5.xml +++ b/tools/testfiles/tnestedcomp.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -68,11 +68,16 @@ - 0 0 1 "A" -100 100 1 1 0.5 "B" -100 100 2 4 0.333333 "C" -100 100 - 3 9 0.25 "D" -100 100 4 16 0.2 "E" -100 100 - 5 25 0.166667 "F" -100 100 6 36 0.142857 "G" -100 100 - 7 49 0.125 "H" -100 100 8 64 0.111111 "I" -100 100 - 9 81 0.1 "J" -100 100 + 0 0 1 "A" -100 100 + 1 1 0.5 "B" -100 100 + 2 4 0.333333 "C" -100 100 + 3 9 0.25 "D" -100 100 + 4 16 0.2 "E" -100 100 + 5 25 0.166667 "F" -100 100 + 6 36 0.142857 "G" -100 100 + 7 49 0.125 "H" -100 100 + 8 64 0.111111 "I" -100 100 + 9 81 0.1 "J" -100 100 diff --git a/tools/testfiles/tno-subset.ddl b/tools/testfiles/tno-subset.ddl new file mode 100644 index 0000000..11aa264 --- /dev/null +++ b/tools/testfiles/tno-subset.ddl @@ -0,0 +1,9 @@ +HDF5 "tno-subset.h5" { +DATASET "AHFINDERDIRECT::ah_centroid_t[0] it=0 tl=0" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 1, 1 ) / ( 1, 1 ) } + DATA { + (0,0): 0 + } +} +} diff --git a/tools/testfiles/tno-subset.h5 b/tools/testfiles/tno-subset.h5 new file mode 100644 index 0000000..e6b6f57 Binary files /dev/null and b/tools/testfiles/tno-subset.h5 differ diff --git a/tools/testfiles/tnodata.h5.xml b/tools/testfiles/tnodata.h5.xml index dc48c7a..17b4ac9 100644 --- a/tools/testfiles/tnodata.h5.xml +++ b/tools/testfiles/tnodata.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -22,7 +22,11 @@ - 0 0 0 0 0 + 0 + 0 + 0 + 0 + 0 diff --git a/tools/testfiles/tnofilename-with-packed-bits.ddl b/tools/testfiles/tnofilename-with-packed-bits.ddl new file mode 100644 index 0000000..ca16c42 --- /dev/null +++ b/tools/testfiles/tnofilename-with-packed-bits.ddl @@ -0,0 +1,96 @@ +usage: h5dump [OPTIONS] file + OPTIONS + -h, --help Print a usage message and exit + -n, --contents Print a list of the file contents and exit + -B, --superblock Print the content of the super block + -H, --header Print the header only; no data is displayed + -A, --onlyattr Print the header and value of attributes + -i, --object-ids Print the object ids + -r, --string Print 1-byte integer datasets as ASCII + -e, --escape Escape non printing characters + -V, --version Print version number and exit + -a P, --attribute=P Print the specified attribute + -d P, --dataset=P Print the specified dataset + -y, --noindex Do not print array indices with the data + -p, --properties Print dataset filters, storage layout and fill value + -f D, --filedriver=D Specify which driver to open the file with + -g P, --group=P Print the specified group and all members + -l P, --soft-link=P Print the value(s) of the specified soft link + -o F, --output=F Output raw data into file F + -b B, --binary=B Binary file output, of form B + -t P, --datatype=P Print the specified named datatype + -w N, --width=N Set the number of columns of output. A value of 0 (zero) + sets the number of columns to the maximum (65535). + Default width is 80 columns. + -m T, --format=T Set the floating point output format + -q Q, --sort_by=Q Sort groups and attributes by index Q + -z Z, --sort_order=Z Sort groups and attributes by order Z + -M L, --packedbits=L Print packed bits as unsigned integers, using mask + format L for an integer dataset specified with + option -d. L is a list of offset,length values, + separated by commas. Offset is the beginning bit in + the data value and length is the number of bits of + the mask. + -R, --region Print dataset pointed by region references + -x, --xml Output in XML using Schema + -u, --use-dtd Output in XML using DTD + -D U, --xml-dtd=U Use the DTD or schema at U + -X S, --xml-ns=S (XML Schema) Use qualified names n the XML + ":": no namespace, default: "hdf5:" + E.g., to dump a file called `-f', use h5dump -- -f + --enable-error-stack Prints messages from the HDF5 error stack as they + occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. + + Subsetting is available by using the following options with a dataset + attribute. Subsetting is done by selecting a hyperslab from the data. + Thus, the options mirror those for performing a hyperslab selection. + One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting. + The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in + each dimension. START is optional and will default to 0 in each dimension. + + -s START, --start=START Offset of start of subsetting selection + -S STRIDE, --stride=STRIDE Hyperslab stride + -c COUNT, --count=COUNT Number of blocks to include in selection + -k BLOCK, --block=BLOCK Size of block in hyperslab + START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the + number of dimensions in the dataspace being queried + + D - is the file driver to use in opening the file. Acceptable values + are "sec2", "family", "split", "multi", "direct", and "stream". Without + the file driver flag, the file will be opened with each driver in + turn and in the order specified above until one driver succeeds + in opening the file. + F - is a filename. + P - is the full path from the root group to the object. + N - is an integer greater than 1. + T - is a string containing the floating point format, e.g '%.3f' + U - is a URI reference (as defined in [IETF RFC 2396], + updated by [IETF RFC 2732]) + B - is the form of binary output: NATIVE for a memory type, FILE for the + file type, LE or BE for pre-existing little or big endian types. + Must be used with -o (output file) and it is recommended that + -d (dataset) is used. B is an optional argument, defaults to NATIVE + Q - is the sort index type. It can be "creation_order" or "name" (default) + Z - is the sort order type. It can be "descending" or "ascending" (default) + + Examples: + + 1) Attribute foo of the group /bar_none in file quux.h5 + + h5dump -a /bar_none/foo quux.h5 + + 2) Selecting a subset from dataset /foo in file quux.h5 + + h5dump -d /foo -s "0,1" -S "1,1" -c "2,3" -k "2,2" quux.h5 + + 3) Saving dataset 'dset' in file quux.h5 to binary file 'out.bin' + using a little-endian type + + h5dump -d /dset -b LE -o out.bin quux.h5 + + 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset + + h5dump -d /dset -M 0,1,4,3 quux.h5 + diff --git a/tools/testfiles/tnofilename.ddl b/tools/testfiles/tnofilename.ddl deleted file mode 100644 index 9083782..0000000 --- a/tools/testfiles/tnofilename.ddl +++ /dev/null @@ -1,94 +0,0 @@ -usage: h5dump [OPTIONS] file - OPTIONS - -h, --help Print a usage message and exit - -n, --contents Print a list of the file contents and exit - -B, --superblock Print the content of the super block - -H, --header Print the header only; no data is displayed - -A, --onlyattr Print the header and value of attributes - -i, --object-ids Print the object ids - -r, --string Print 1-byte integer datasets as ASCII - -e, --escape Escape non printing characters - -V, --version Print version number and exit - -a P, --attribute=P Print the specified attribute - -d P, --dataset=P Print the specified dataset - -y, --noindex Do not print array indices with the data - -p, --properties Print dataset filters, storage layout and fill value - -f D, --filedriver=D Specify which driver to open the file with - -g P, --group=P Print the specified group and all members - -l P, --soft-link=P Print the value(s) of the specified soft link - -o F, --output=F Output raw data into file F - -b B, --binary=B Binary file output, of form B - -t P, --datatype=P Print the specified named datatype - -w N, --width=N Set the number of columns of output. A value of 0 (zero) - sets the number of columns to the maximum (65535). - Default width is 80 columns. - -m T, --format=T Set the floating point output format - -q Q, --sort_by=Q Sort groups and attributes by index Q - -z Z, --sort_order=Z Sort groups and attributes by order Z - -M L, --packedbits=L Print packed bits as unsigned integers, using mask - format L for an integer dataset specified with - option -d. L is a list of offset,length values, - separated by commas. Offset is the beginning bit in - the data value and length is the number of bits of - the mask. - -R, --region Print dataset pointed by region references - -x, --xml Output in XML using Schema - -u, --use-dtd Output in XML using DTD - -D U, --xml-dtd=U Use the DTD or schema at U - -X S, --xml-ns=S (XML Schema) Use qualified names n the XML - ":": no namespace, default: "hdf5:" - E.g., to dump a file called `-f', use h5dump -- -f - --enable-error-stack Prints messages from the HDF5 error stack as they - occur. - - Subsetting is available by using the following options with a dataset - attribute. Subsetting is done by selecting a hyperslab from the data. - Thus, the options mirror those for performing a hyperslab selection. - One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting. - The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in - each dimension. START is optional and will default to 0 in each dimension. - - -s START, --start=START Offset of start of subsetting selection - -S STRIDE, --stride=STRIDE Hyperslab stride - -c COUNT, --count=COUNT Number of blocks to include in selection - -k BLOCK, --block=BLOCK Size of block in hyperslab - START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the - number of dimensions in the dataspace being queried - - D - is the file driver to use in opening the file. Acceptable values - are "sec2", "family", "split", "multi", "direct", and "stream". Without - the file driver flag, the file will be opened with each driver in - turn and in the order specified above until one driver succeeds - in opening the file. - F - is a filename. - P - is the full path from the root group to the object. - N - is an integer greater than 1. - T - is a string containing the floating point format, e.g '%.3f' - U - is a URI reference (as defined in [IETF RFC 2396], - updated by [IETF RFC 2732]) - B - is the form of binary output: NATIVE for a memory type, FILE for the - file type, LE or BE for pre-existing little or big endian types. - Must be used with -o (output file) and it is recommended that - -d (dataset) is used. B is an optional argument, defaults to NATIVE - Q - is the sort index type. It can be "creation_order" or "name" (default) - Z - is the sort order type. It can be "descending" or "ascending" (default) - - Examples: - - 1) Attribute foo of the group /bar_none in file quux.h5 - - h5dump -a /bar_none/foo quux.h5 - - 2) Selecting a subset from dataset /foo in file quux.h5 - - h5dump -d /foo -s "0,1" -S "1,1" -c "2,3" -k "2,2" quux.h5 - - 3) Saving dataset 'dset' in file quux.h5 to binary file 'out.bin' - using a little-endian type - - h5dump -d /dset -b LE -o out.bin quux.h5 - - 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset - - h5dump -d /dset -M 0,1,4,3 quux.h5 - diff --git a/tools/testfiles/tobjref.h5.xml b/tools/testfiles/tobjref.h5.xml index b8c7fc5..016b298 100644 --- a/tools/testfiles/tobjref.h5.xml +++ b/tools/testfiles/tobjref.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -36,9 +36,9 @@ - + - + @@ -53,7 +53,10 @@ - 0 3 6 9 + 0 + 3 + 6 + 9 @@ -61,9 +64,9 @@ - + - + @@ -78,7 +81,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 diff --git a/tools/testfiles/topaque.h5.xml b/tools/testfiles/topaque.h5.xml index 1e20336..314fd23 100644 --- a/tools/testfiles/topaque.h5.xml +++ b/tools/testfiles/topaque.h5.xml @@ -5,9 +5,9 @@ - + - + diff --git a/tools/testfiles/torderattr1.ddl b/tools/testfiles/torderattr1.ddl index f46354b..fb7fd70 100644 --- a/tools/testfiles/torderattr1.ddl +++ b/tools/testfiles/torderattr1.ddl @@ -85,7 +85,6 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - DATATYPE "tt" H5T_STD_I32LE; ATTRIBUTE "a" { DATATYPE H5T_STD_U8LE @@ -99,6 +98,5 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - } } diff --git a/tools/testfiles/torderattr1.h5.xml b/tools/testfiles/torderattr1.h5.xml index bfba4d0..027cd64 100644 --- a/tools/testfiles/torderattr1.h5.xml +++ b/tools/testfiles/torderattr1.h5.xml @@ -44,9 +44,9 @@ - + - + @@ -104,9 +104,9 @@ - + - + diff --git a/tools/testfiles/torderattr2.ddl b/tools/testfiles/torderattr2.ddl index 6cc1d41..dbf615b 100644 --- a/tools/testfiles/torderattr2.ddl +++ b/tools/testfiles/torderattr2.ddl @@ -25,7 +25,6 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - DATATYPE "t" H5T_STD_I32LE; ATTRIBUTE "c" { DATATYPE H5T_STD_U8LE @@ -39,7 +38,6 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - GROUP "gt" { ATTRIBUTE "c" { DATATYPE H5T_STD_U8LE diff --git a/tools/testfiles/torderattr2.h5.xml b/tools/testfiles/torderattr2.h5.xml index 11f2266..fe441da 100644 --- a/tools/testfiles/torderattr2.h5.xml +++ b/tools/testfiles/torderattr2.h5.xml @@ -140,9 +140,9 @@ - + - + @@ -200,9 +200,9 @@ - + - + diff --git a/tools/testfiles/torderattr3.ddl b/tools/testfiles/torderattr3.ddl index 2956886..a2990f7 100644 --- a/tools/testfiles/torderattr3.ddl +++ b/tools/testfiles/torderattr3.ddl @@ -85,7 +85,6 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - DATATYPE "tt" H5T_STD_I32LE; ATTRIBUTE "c" { DATATYPE H5T_STD_U8LE @@ -99,6 +98,5 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - } } diff --git a/tools/testfiles/torderattr3.h5.xml b/tools/testfiles/torderattr3.h5.xml index 10ea95e..38bbef7 100644 --- a/tools/testfiles/torderattr3.h5.xml +++ b/tools/testfiles/torderattr3.h5.xml @@ -44,9 +44,9 @@ - + - + @@ -104,9 +104,9 @@ - + - + diff --git a/tools/testfiles/torderattr4.ddl b/tools/testfiles/torderattr4.ddl index 090b44b..000a852 100644 --- a/tools/testfiles/torderattr4.ddl +++ b/tools/testfiles/torderattr4.ddl @@ -25,7 +25,6 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - DATATYPE "t" H5T_STD_I32LE; ATTRIBUTE "c" { DATATYPE H5T_STD_U8LE @@ -39,7 +38,6 @@ GROUP "/" { DATATYPE H5T_STD_U8LE DATASPACE SCALAR } - GROUP "gt" { ATTRIBUTE "a" { DATATYPE H5T_STD_U8LE diff --git a/tools/testfiles/torderattr4.h5.xml b/tools/testfiles/torderattr4.h5.xml index 2546b30..0f90b22 100644 --- a/tools/testfiles/torderattr4.h5.xml +++ b/tools/testfiles/torderattr4.h5.xml @@ -140,9 +140,9 @@ - + - + @@ -200,9 +200,9 @@ - + - + diff --git a/tools/testfiles/tpbitsIncomplete.ddl b/tools/testfiles/tpbitsIncomplete.ddl index 4307bed..88dac0a 100644 --- a/tools/testfiles/tpbitsIncomplete.ddl +++ b/tools/testfiles/tpbitsIncomplete.ddl @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsLengthExceeded.ddl b/tools/testfiles/tpbitsLengthExceeded.ddl index 4b50e70..35055f4 100644 --- a/tools/testfiles/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/tpbitsLengthExceeded.ddl @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsLengthPositive.ddl b/tools/testfiles/tpbitsLengthPositive.ddl index c648c02..3daeab4 100644 --- a/tools/testfiles/tpbitsLengthPositive.ddl +++ b/tools/testfiles/tpbitsLengthPositive.ddl @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsMaxExceeded.ddl b/tools/testfiles/tpbitsMaxExceeded.ddl index 8c6e8e1..2b3b68f 100644 --- a/tools/testfiles/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/tpbitsMaxExceeded.ddl @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsOffsetExceeded.ddl b/tools/testfiles/tpbitsOffsetExceeded.ddl index e594d27..6ccdc26 100644 --- a/tools/testfiles/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/tpbitsOffsetExceeded.ddl @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsOffsetNegative.ddl b/tools/testfiles/tpbitsOffsetNegative.ddl index 833e47a..eb41bd7 100644 --- a/tools/testfiles/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/tpbitsOffsetNegative.ddl @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tref-escapes-at.h5.xml b/tools/testfiles/tref-escapes-at.h5.xml index a136651..8126484 100644 --- a/tools/testfiles/tref-escapes-at.h5.xml +++ b/tools/testfiles/tref-escapes-at.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -23,7 +23,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -31,9 +34,9 @@ - + - + @@ -48,7 +51,10 @@ - 0 3 6 9 + 0 + 3 + 6 + 9 @@ -56,9 +62,9 @@ - + - + @@ -73,7 +79,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -81,9 +90,9 @@ - + - + @@ -98,7 +107,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -106,9 +118,9 @@ - + - + @@ -123,7 +135,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -131,9 +146,9 @@ - + - + @@ -148,7 +163,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -156,9 +174,9 @@ - + - + @@ -173,7 +191,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -182,9 +203,9 @@ - + - + @@ -210,11 +231,11 @@ - - - "/Group1/Dataset&amp" - - + + + "/Group1/Dataset&amp" + + @@ -229,11 +250,11 @@ - - - "/Group1/Dataset'apos" - - + + + "/Group1/Dataset'apos" + + @@ -248,11 +269,11 @@ - - - "/Group1/Dataset>gt" - - + + + "/Group1/Dataset>gt" + + @@ -267,11 +288,11 @@ - - - "/Group1/Dataset<lt" - - + + + "/Group1/Dataset<lt" + + @@ -286,11 +307,11 @@ - - - "/Group1/Dataset\"quote" - - + + + "/Group1/Dataset\"quote" + + @@ -305,11 +326,11 @@ - - - "/Group1/Dataset\\slash" - - + + + "/Group1/Dataset\\slash" + + @@ -324,11 +345,11 @@ - - - "/Group1/Dataset space" - - + + + "/Group1/Dataset space" + + diff --git a/tools/testfiles/tref-escapes.h5.xml b/tools/testfiles/tref-escapes.h5.xml index c70793f..6c6455b 100644 --- a/tools/testfiles/tref-escapes.h5.xml +++ b/tools/testfiles/tref-escapes.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -23,7 +23,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -31,9 +34,9 @@ - + - + @@ -48,7 +51,10 @@ - 0 3 6 9 + 0 + 3 + 6 + 9 @@ -56,9 +62,9 @@ - + - + @@ -73,7 +79,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -81,9 +90,9 @@ - + - + @@ -98,7 +107,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -106,9 +118,9 @@ - + - + @@ -123,7 +135,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -131,9 +146,9 @@ - + - + @@ -148,7 +163,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -156,9 +174,9 @@ - + - + @@ -173,7 +191,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -182,9 +203,9 @@ - + - + diff --git a/tools/testfiles/tref.h5.xml b/tools/testfiles/tref.h5.xml index e70e0c2..7ff360e 100644 --- a/tools/testfiles/tref.h5.xml +++ b/tools/testfiles/tref.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -23,7 +23,10 @@ - 0 3 6 9 + 0 + 3 + 6 + 9 @@ -31,9 +34,9 @@ - + - + @@ -48,7 +51,10 @@ - 0 0 0 0 + 0 + 0 + 0 + 0 @@ -57,9 +63,9 @@ - + - + diff --git a/tools/testfiles/treference.ddl b/tools/testfiles/treference.ddl index d99dc6f..4683ce5 100644 --- a/tools/testfiles/treference.ddl +++ b/tools/testfiles/treference.ddl @@ -225,10 +225,10 @@ GROUP "/" { } ATTRIBUTE "enum" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): RED, RED @@ -236,10 +236,10 @@ GROUP "/" { } ATTRIBUTE "enum2D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): RED, RED, @@ -249,10 +249,10 @@ GROUP "/" { } ATTRIBUTE "enum3D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): RED, RED, @@ -338,20 +338,18 @@ GROUP "/" { } } ATTRIBUTE "opaque" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): 0x01, 0x02 } } ATTRIBUTE "opaque2D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): 0x01, 0x02, @@ -360,10 +358,9 @@ GROUP "/" { } } ATTRIBUTE "opaque3D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): 0x01, 0x02, @@ -382,11 +379,11 @@ GROUP "/" { } ATTRIBUTE "string" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): "ab", "de" @@ -394,11 +391,11 @@ GROUP "/" { } ATTRIBUTE "string2D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): "ab", "cd", @@ -408,11 +405,11 @@ GROUP "/" { } ATTRIBUTE "string3D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): "ab", "cd", @@ -694,10 +691,10 @@ GROUP "/" { } ATTRIBUTE "enum" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): RED, RED @@ -705,10 +702,10 @@ GROUP "/" { } ATTRIBUTE "enum2D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): RED, RED, @@ -718,10 +715,10 @@ GROUP "/" { } ATTRIBUTE "enum3D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): RED, RED, @@ -807,20 +804,18 @@ GROUP "/" { } } ATTRIBUTE "opaque" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): 0x01, 0x02 } } ATTRIBUTE "opaque2D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): 0x01, 0x02, @@ -829,10 +824,9 @@ GROUP "/" { } } ATTRIBUTE "opaque3D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): 0x01, 0x02, @@ -885,11 +879,11 @@ GROUP "/" { } ATTRIBUTE "string" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): "ab", "de" @@ -897,11 +891,11 @@ GROUP "/" { } ATTRIBUTE "string2D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): "ab", "cd", @@ -911,11 +905,11 @@ GROUP "/" { } ATTRIBUTE "string3D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): "ab", "cd", @@ -1193,10 +1187,10 @@ GROUP "/" { } ATTRIBUTE "enum" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): RED, RED @@ -1204,10 +1198,10 @@ GROUP "/" { } ATTRIBUTE "enum2D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): RED, RED, @@ -1217,10 +1211,10 @@ GROUP "/" { } ATTRIBUTE "enum3D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): RED, RED, @@ -1306,20 +1300,18 @@ GROUP "/" { } } ATTRIBUTE "opaque" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): 0x01, 0x02 } } ATTRIBUTE "opaque2D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): 0x01, 0x02, @@ -1328,10 +1320,9 @@ GROUP "/" { } } ATTRIBUTE "opaque3D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): 0x01, 0x02, @@ -1350,11 +1341,11 @@ GROUP "/" { } ATTRIBUTE "string" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): "ab", "de" @@ -1362,11 +1353,11 @@ GROUP "/" { } ATTRIBUTE "string2D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): "ab", "cd", @@ -1376,11 +1367,11 @@ GROUP "/" { } ATTRIBUTE "string3D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): "ab", "cd", @@ -1658,10 +1649,10 @@ GROUP "/" { } DATASET "enum" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): RED, RED @@ -1669,10 +1660,10 @@ GROUP "/" { } DATASET "enum2D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): RED, RED, @@ -1682,10 +1673,10 @@ GROUP "/" { } DATASET "enum3D" { DATATYPE H5T_ENUM { - H5T_STD_I32LE; - "RED" 0; - "GREEN" 1; - } + H5T_STD_I32LE; + "RED" 0; + "GREEN" 1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): RED, RED, @@ -1771,20 +1762,18 @@ GROUP "/" { } } DATASET "opaque" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): 0x01, 0x02 } } DATASET "opaque2D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): 0x01, 0x02, @@ -1793,10 +1782,9 @@ GROUP "/" { } } DATASET "opaque3D" { - DATATYPE - H5T_OPAQUE; + DATATYPE H5T_OPAQUE { OPAQUE_TAG "1-byte opaque type"; - + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): 0x01, 0x02, @@ -1849,11 +1837,11 @@ GROUP "/" { } DATASET "string" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { (0): "ab", "de" @@ -1861,11 +1849,11 @@ GROUP "/" { } DATASET "string2D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) } DATA { (0,0): "ab", "cd", @@ -1875,11 +1863,11 @@ GROUP "/" { } DATASET "string3D" { DATATYPE H5T_STRING { - STRSIZE 2; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 2; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) } DATA { (0,0,0): "ab", "cd", diff --git a/tools/testfiles/tsaf.h5.xml b/tools/testfiles/tsaf.h5.xml index 6b7f5c5..8da41b9 100644 --- a/tools/testfiles/tsaf.h5.xml +++ b/tools/testfiles/tsaf.h5.xml @@ -11,7 +11,7 @@ - + @@ -26,281 +26,5925 @@ - 47 32 67 79 78 84 65 73 78 69 82 10 47 46 97 116 116 114 105 98 117 116 - 101 115 32 67 79 78 84 65 73 78 69 82 10 47 46 97 116 116 114 105 98 - 117 116 101 115 47 100 97 116 97 98 97 115 101 32 67 79 78 84 65 73 78 - 69 82 10 47 46 97 116 116 114 105 98 117 116 101 115 47 100 97 116 97 - 98 97 115 101 47 46 83 65 70 95 68 98 80 114 111 112 115 32 68 65 84 65 - 83 69 84 32 115 116 114 117 99 116 32 83 65 70 95 68 98 80 114 111 112 - 115 123 105 110 116 32 109 97 103 105 99 59 99 104 97 114 32 83 70 105 - 108 101 68 105 114 91 49 48 50 52 93 59 99 104 97 114 32 73 109 112 111 - 114 116 70 105 108 101 91 49 48 50 52 93 59 105 110 116 32 112 97 114 - 97 108 108 101 108 59 115 116 114 117 99 116 32 83 65 70 95 86 101 114 - 115 105 111 110 73 110 102 111 123 105 110 116 32 118 109 97 106 111 - 114 59 105 110 116 32 118 109 105 110 111 114 59 105 110 116 32 114 101 - 108 59 99 104 97 114 32 97 110 110 111 116 91 49 48 93 59 125 115 97 - 102 97 112 105 59 115 116 114 117 99 116 32 83 65 70 95 86 101 114 115 - 105 111 110 73 110 102 111 123 105 110 116 32 118 109 97 106 111 114 59 - 105 110 116 32 118 109 105 110 111 114 59 105 110 116 32 114 101 108 59 - 99 104 97 114 32 97 110 110 111 116 91 49 48 93 59 125 115 97 102 108 - 105 98 59 115 116 114 117 99 116 32 83 65 70 95 86 101 114 115 105 111 - 110 73 110 102 111 123 105 110 116 32 118 109 97 106 111 114 59 105 110 - 116 32 118 109 105 110 111 114 59 105 110 116 32 114 101 108 59 99 104 - 97 114 32 97 110 110 111 116 91 49 48 93 59 125 118 98 116 59 115 116 - 114 117 99 116 32 83 65 70 95 86 101 114 115 105 111 110 73 110 102 111 - 123 105 110 116 32 118 109 97 106 111 114 59 105 110 116 32 118 109 105 - 110 111 114 59 105 110 116 32 114 101 108 59 99 104 97 114 32 97 110 - 110 111 116 91 49 48 93 59 125 100 115 108 59 115 116 114 117 99 116 32 - 83 65 70 95 86 101 114 115 105 111 110 73 110 102 111 123 105 110 116 - 32 118 109 97 106 111 114 59 105 110 116 32 118 109 105 110 111 114 59 - 105 110 116 32 114 101 108 59 99 104 97 114 32 97 110 110 111 116 91 49 - 48 93 59 125 104 100 102 53 59 115 116 114 117 99 116 32 83 65 70 95 86 - 101 114 115 105 111 110 73 110 102 111 123 105 110 116 32 118 109 97 - 106 111 114 59 105 110 116 32 118 109 105 110 111 114 59 105 110 116 32 - 114 101 108 59 99 104 97 114 32 97 110 110 111 116 91 49 48 93 59 125 - 109 112 105 59 105 110 116 32 68 111 84 111 99 59 105 110 116 32 82 101 - 97 100 79 110 108 121 59 105 110 116 32 67 108 111 98 98 101 114 59 105 - 110 116 32 79 83 77 111 100 101 115 59 125 59 10 47 115 115 114 101 108 - 45 95 48 48 48 48 32 68 65 84 65 83 69 84 32 105 110 116 59 10 47 115 - 115 114 101 108 45 95 48 48 48 49 32 68 65 84 65 83 69 84 32 105 110 - 116 59 10 47 115 115 114 101 108 45 95 48 48 48 50 32 68 65 84 65 83 69 - 84 32 105 110 116 59 10 47 115 115 114 101 108 45 95 48 48 48 51 32 68 - 65 84 65 83 69 84 32 105 110 116 59 10 47 115 115 114 101 108 45 95 48 - 48 48 52 32 68 65 84 65 83 69 84 32 105 110 116 59 10 47 115 115 114 - 101 108 45 95 48 48 48 53 32 68 65 84 65 83 69 84 32 105 110 116 59 10 - 47 115 115 114 101 108 45 95 48 48 48 54 32 68 65 84 65 83 69 84 32 105 - 110 116 59 10 47 115 115 114 101 108 45 95 48 48 48 55 32 68 65 84 65 - 83 69 84 32 105 110 116 59 10 47 115 115 114 101 108 45 95 48 48 48 56 - 32 68 65 84 65 83 69 84 32 105 110 116 59 10 47 115 115 114 101 108 45 - 95 48 48 48 57 32 68 65 84 65 83 69 84 32 105 110 116 59 10 47 115 115 - 114 101 108 45 95 48 48 49 48 32 68 65 84 65 83 69 84 32 105 110 116 59 - 10 47 115 115 114 101 108 45 95 48 48 49 49 32 68 65 84 65 83 69 84 32 - 105 110 116 59 10 47 115 115 114 101 108 45 95 48 48 49 50 32 68 65 84 - 65 83 69 84 32 105 110 116 59 10 47 116 111 112 111 114 101 108 45 95 - 48 48 49 55 32 68 65 84 65 83 69 84 32 105 110 116 59 10 47 116 111 112 - 111 114 101 108 45 95 48 48 49 56 32 68 65 84 65 83 69 84 32 105 110 - 116 59 10 47 116 111 112 111 114 101 108 45 95 48 48 49 57 32 68 65 84 - 65 83 69 84 32 105 110 116 59 10 47 116 111 112 111 114 101 108 45 95 - 48 48 50 48 32 68 65 84 65 83 69 84 32 105 110 116 59 10 47 102 105 101 - 108 100 45 99 111 111 114 100 115 95 48 48 48 50 32 68 65 84 65 83 69 - 84 32 102 108 111 97 116 59 10 47 102 105 101 108 100 45 100 105 115 - 116 114 105 98 117 116 105 111 110 95 102 97 99 116 111 114 115 95 48 - 48 48 51 32 68 65 84 65 83 69 84 32 102 108 111 97 116 59 10 47 102 105 - 101 108 100 45 116 101 109 112 101 114 97 116 117 114 101 95 48 48 48 - 52 32 68 65 84 65 83 69 84 32 102 108 111 97 116 59 10 47 102 105 101 - 108 100 45 100 105 115 112 108 97 99 101 109 101 110 116 115 95 48 48 - 48 55 32 68 65 84 65 83 69 84 32 102 108 111 97 116 59 10 47 102 105 - 101 108 100 45 115 116 114 101 115 115 95 48 48 49 49 32 68 65 84 65 83 - 69 84 32 102 108 111 97 116 59 10 47 102 105 101 108 100 45 116 101 109 - 112 101 114 97 116 117 114 101 95 48 48 49 50 32 68 65 84 65 83 69 84 - 32 102 108 111 97 116 59 10 47 102 105 101 108 100 45 112 114 101 115 - 115 117 114 101 95 48 48 49 51 32 68 65 84 65 83 69 84 32 102 108 111 - 97 116 59 10 47 66 108 111 98 32 68 65 84 65 83 69 84 32 115 116 114 - 117 99 116 32 66 108 111 98 123 68 83 76 95 79 102 102 115 101 116 32 - 102 105 108 101 95 105 100 59 68 83 76 95 79 102 102 115 101 116 32 100 - 97 116 97 115 101 116 95 105 100 59 68 83 76 95 79 102 102 115 101 116 - 32 111 102 102 115 101 116 59 68 83 76 95 79 102 102 115 101 116 32 115 - 116 114 105 100 101 59 68 83 76 95 79 102 102 115 101 116 32 99 111 117 - 110 116 59 68 83 76 95 79 102 102 115 101 116 32 98 97 115 101 95 105 - 100 59 68 83 76 95 79 102 102 115 101 116 32 110 117 109 95 114 101 99 - 115 59 125 59 10 47 73 110 100 101 120 83 112 101 99 32 68 65 84 65 83 - 69 84 32 115 116 114 117 99 116 32 73 110 100 101 120 83 112 101 99 123 - 105 110 116 32 110 100 105 109 115 59 105 110 116 32 111 114 105 103 - 105 110 115 91 56 93 59 105 110 116 32 115 105 122 101 115 91 56 93 59 - 105 110 116 32 111 114 100 101 114 91 56 93 59 101 110 117 109 32 73 - 110 100 101 120 84 121 112 101 123 86 66 84 95 73 78 68 69 88 95 84 89 - 80 69 95 67 95 79 82 68 69 82 61 48 44 86 66 84 95 73 78 68 69 88 95 84 - 89 80 69 95 70 95 79 82 68 69 82 61 49 44 86 66 84 95 73 78 68 69 88 95 - 84 89 80 69 95 65 78 89 61 45 49 44 86 66 84 95 73 78 68 69 88 95 84 89 - 80 69 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 95 73 78 68 69 88 95 - 84 89 80 69 95 78 65 61 45 51 44 86 66 84 95 73 78 68 69 88 95 84 89 80 - 69 95 85 78 75 78 79 87 78 61 45 52 125 105 110 100 101 120 95 116 121 - 112 101 59 68 83 76 95 79 102 102 115 101 116 32 98 97 115 101 95 105 - 100 59 68 83 76 95 79 102 102 115 101 116 32 110 117 109 95 114 101 99 - 115 59 125 59 10 47 67 97 116 32 68 65 84 65 83 69 84 32 115 116 114 - 117 99 116 32 67 97 116 123 99 104 97 114 32 110 97 109 101 91 54 52 93 - 59 101 110 117 109 32 82 111 108 101 123 86 66 84 95 82 79 76 69 95 84 - 79 80 79 61 48 44 86 66 84 95 82 79 76 69 95 66 78 68 61 49 44 86 66 84 - 95 82 79 76 69 95 80 82 79 67 61 50 44 86 66 84 95 82 79 76 69 95 68 79 - 77 78 61 51 44 86 66 84 95 82 79 76 69 95 66 76 79 67 75 61 52 44 86 66 - 84 95 82 79 76 69 95 65 83 83 89 61 53 44 86 66 84 95 82 79 76 69 95 77 - 65 84 61 54 44 86 66 84 95 82 79 76 69 95 88 80 82 79 68 61 55 44 86 66 - 84 95 82 79 76 69 95 85 83 69 82 68 61 56 44 86 66 84 95 82 79 76 69 95 - 65 78 89 61 45 49 44 86 66 84 95 82 79 76 69 95 73 78 86 65 76 73 68 61 - 45 50 44 86 66 84 95 82 79 76 69 95 78 65 61 45 51 44 86 66 84 95 82 79 - 76 69 95 85 78 75 78 79 87 78 61 45 52 125 114 111 108 101 59 105 110 - 116 32 116 100 105 109 59 68 83 76 95 79 102 102 115 101 116 32 98 97 - 115 101 95 105 100 59 68 83 76 95 79 102 102 115 101 116 32 110 117 109 - 95 114 101 99 115 59 125 59 10 47 83 101 116 32 68 65 84 65 83 69 84 32 - 115 116 114 117 99 116 32 83 101 116 123 105 110 116 32 117 115 101 114 - 95 105 100 59 99 104 97 114 32 110 97 109 101 91 54 52 93 59 105 110 - 116 32 116 100 105 109 59 101 110 117 109 32 83 105 108 82 111 108 101 - 123 86 66 84 95 83 82 79 76 69 95 84 73 77 69 61 48 44 86 66 84 95 83 - 82 79 76 69 95 83 80 65 67 69 61 49 44 86 66 84 95 83 82 79 76 69 95 83 - 84 65 84 69 61 50 44 86 66 84 95 83 82 79 76 69 95 80 65 82 65 77 61 51 - 44 86 66 84 95 83 82 79 76 69 95 67 84 89 80 69 61 52 44 86 66 84 95 83 - 82 79 76 69 95 65 84 89 80 69 61 53 44 86 66 84 95 83 82 79 76 69 95 85 - 83 69 82 68 61 54 44 86 66 84 95 83 82 79 76 69 95 65 78 89 61 45 49 44 - 86 66 84 95 83 82 79 76 69 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 - 95 83 82 79 76 69 95 78 65 61 45 51 44 86 66 84 95 83 82 79 76 69 95 85 - 78 75 78 79 87 78 61 45 52 125 115 114 111 108 101 59 68 83 76 95 79 - 102 102 115 101 116 32 99 111 108 108 95 105 100 115 91 49 54 93 59 105 - 110 116 32 105 115 95 116 111 112 59 105 110 116 32 105 115 95 101 120 - 116 101 110 100 105 98 108 101 59 68 83 76 95 79 102 102 115 101 116 32 - 100 102 108 116 95 99 111 111 114 100 102 108 100 95 105 100 59 68 83 - 76 95 79 102 102 115 101 116 32 98 110 100 95 115 101 116 95 105 100 59 - 68 83 76 95 79 102 102 115 101 116 32 98 97 115 101 95 105 100 59 68 83 - 76 95 79 102 102 115 101 116 32 110 117 109 95 114 101 99 115 59 125 59 - 10 47 67 111 108 108 101 99 116 105 111 110 32 68 65 84 65 83 69 84 32 - 115 116 114 117 99 116 32 67 111 108 108 101 99 116 105 111 110 123 68 - 83 76 95 79 102 102 115 101 116 32 99 111 110 116 97 105 110 105 110 - 103 95 115 101 116 95 105 100 59 68 83 76 95 79 102 102 115 101 116 32 - 99 97 116 95 105 100 59 101 110 117 109 32 67 101 108 108 84 121 112 - 101 123 86 66 84 95 67 69 76 76 95 84 89 80 69 95 78 79 78 69 61 48 44 - 86 66 84 95 67 69 76 76 95 84 89 80 69 95 80 79 73 78 84 61 49 44 86 66 - 84 95 67 69 76 76 95 84 89 80 69 95 76 73 78 69 61 50 44 86 66 84 95 67 - 69 76 76 95 84 89 80 69 95 84 82 73 61 51 44 86 66 84 95 67 69 76 76 95 - 84 89 80 69 95 81 85 65 68 61 52 44 86 66 84 95 67 69 76 76 95 84 89 80 - 69 95 84 69 84 61 53 44 86 66 84 95 67 69 76 76 95 84 89 80 69 95 80 89 - 82 65 77 73 68 61 54 44 86 66 84 95 67 69 76 76 95 84 89 80 69 95 80 82 - 73 83 77 61 55 44 86 66 84 95 67 69 76 76 95 84 89 80 69 95 72 69 88 61 - 56 44 86 66 84 95 67 69 76 76 95 84 89 80 69 95 77 73 88 69 68 61 57 44 - 86 66 84 95 67 69 76 76 95 84 89 80 69 95 65 82 66 61 49 48 44 86 66 84 - 95 67 69 76 76 95 84 89 80 69 95 49 66 65 76 76 61 49 49 44 86 66 84 95 - 67 69 76 76 95 84 89 80 69 95 50 66 65 76 76 61 49 50 44 86 66 84 95 67 - 69 76 76 95 84 89 80 69 95 51 66 65 76 76 61 49 51 44 86 66 84 95 67 69 - 76 76 95 84 89 80 69 95 49 83 72 69 76 76 61 49 52 44 86 66 84 95 67 69 - 76 76 95 84 89 80 69 95 50 83 72 69 76 76 61 49 53 44 86 66 84 95 67 69 - 76 76 95 84 89 80 69 95 65 78 89 61 45 49 44 86 66 84 95 67 69 76 76 95 - 84 89 80 69 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 95 67 69 76 76 - 95 84 89 80 69 95 78 65 61 45 51 44 86 66 84 95 67 69 76 76 95 84 89 80 - 69 95 85 78 75 78 79 87 78 61 45 52 125 99 101 108 108 95 116 121 112 - 101 59 105 110 116 32 99 111 117 110 116 59 68 83 76 95 79 102 102 115 - 101 116 32 105 110 100 101 120 105 110 103 95 105 100 59 105 110 116 32 - 105 115 95 100 101 99 111 109 112 59 68 83 76 95 79 102 102 115 101 116 - 32 109 101 109 98 101 114 115 95 98 108 111 98 95 105 100 59 68 83 76 - 95 79 102 102 115 101 116 32 98 97 115 101 95 105 100 59 68 83 76 95 79 - 102 102 115 101 116 32 110 117 109 95 114 101 99 115 59 125 59 10 47 82 - 101 108 97 116 105 111 110 32 68 65 84 65 83 69 84 32 115 116 114 117 - 99 116 32 82 101 108 97 116 105 111 110 123 68 83 76 95 79 102 102 115 - 101 116 32 115 117 98 95 105 100 59 68 83 76 95 79 102 102 115 101 116 - 32 115 117 98 95 99 97 116 95 105 100 59 68 83 76 95 79 102 102 115 101 - 116 32 115 117 98 95 100 101 99 111 109 112 95 99 97 116 95 105 100 59 - 68 83 76 95 79 102 102 115 101 116 32 115 117 112 95 105 100 59 68 83 - 76 95 79 102 102 115 101 116 32 115 117 112 95 99 97 116 95 105 100 59 - 68 83 76 95 79 102 102 115 101 116 32 115 117 112 95 100 101 99 111 109 - 112 95 99 97 116 95 105 100 59 101 110 117 109 32 82 101 108 75 105 110 - 100 123 86 66 84 95 82 69 76 75 73 78 68 95 83 85 66 83 69 84 61 48 44 - 86 66 84 95 82 69 76 75 73 78 68 95 83 85 80 83 69 84 61 49 44 86 66 84 - 95 82 69 76 75 73 78 68 95 66 79 85 78 68 61 50 44 86 66 84 95 82 69 76 - 75 73 78 68 95 80 69 82 77 85 84 69 61 51 44 86 66 84 95 82 69 76 75 73 - 78 68 95 78 69 73 71 72 66 79 82 61 52 44 86 66 84 95 82 69 76 75 73 78 - 68 95 67 79 80 89 61 53 44 86 66 84 95 82 69 76 75 73 78 68 95 69 81 85 - 65 76 61 54 44 86 66 84 95 82 69 76 75 73 78 68 95 65 78 89 61 45 49 44 - 86 66 84 95 82 69 76 75 73 78 68 95 73 78 86 65 76 73 68 61 45 50 44 86 - 66 84 95 82 69 76 75 73 78 68 95 78 65 61 45 51 44 86 66 84 95 82 69 76 - 75 73 78 68 95 85 78 75 78 79 87 78 61 45 52 125 107 105 110 100 59 101 - 110 117 109 32 82 101 108 82 101 112 123 86 66 84 95 82 69 76 82 69 80 - 95 73 68 69 78 84 73 84 89 61 48 44 86 66 84 95 82 69 76 82 69 80 95 72 - 76 73 83 84 61 49 44 86 66 84 95 82 69 76 82 69 80 95 84 76 73 83 84 61 - 50 44 86 66 84 95 82 69 76 82 69 80 95 84 76 73 83 84 95 49 61 51 44 86 - 66 84 95 82 69 76 82 69 80 95 69 76 73 83 84 61 52 44 86 66 84 95 82 69 - 76 82 69 80 95 83 84 82 85 67 84 85 82 69 68 61 53 44 86 66 84 95 82 69 - 76 82 69 80 95 85 78 83 84 82 85 67 84 85 82 69 68 61 54 44 86 66 84 95 - 82 69 76 82 69 80 95 65 82 66 73 84 82 65 82 89 95 82 61 55 44 86 66 84 - 95 82 69 76 82 69 80 95 65 82 66 73 84 82 65 82 89 95 68 82 61 56 44 86 - 66 84 95 82 69 76 82 69 80 95 65 78 89 61 45 49 44 86 66 84 95 82 69 76 - 82 69 80 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 95 82 69 76 82 69 - 80 95 78 65 61 45 51 44 86 66 84 95 82 69 76 82 69 80 95 85 78 75 78 79 - 87 78 61 45 52 125 114 101 112 95 116 121 112 101 59 68 83 76 95 79 102 - 102 115 101 116 32 100 95 98 108 111 98 95 105 100 59 68 83 76 95 79 - 102 102 115 101 116 32 114 95 98 108 111 98 95 105 100 59 68 83 76 95 - 79 102 102 115 101 116 32 98 97 115 101 95 105 100 59 68 83 76 95 79 - 102 102 115 101 116 32 110 117 109 95 114 101 99 115 59 125 59 10 47 70 - 105 101 108 100 84 109 112 108 32 68 65 84 65 83 69 84 32 115 116 114 - 117 99 116 32 70 105 101 108 100 84 109 112 108 123 99 104 97 114 32 - 110 97 109 101 91 54 52 93 59 68 83 76 95 79 102 102 115 101 116 32 98 - 97 115 101 95 115 112 97 99 101 95 105 100 59 101 110 117 109 32 65 108 - 103 101 98 114 97 105 99 84 121 112 101 123 86 66 84 95 65 76 71 69 66 - 82 65 73 67 95 84 89 80 69 95 67 79 78 83 84 65 78 84 61 48 44 86 66 84 - 95 65 76 71 69 66 82 65 73 67 95 84 89 80 69 95 67 79 77 80 79 78 69 78 - 84 61 49 44 86 66 84 95 65 76 71 69 66 82 65 73 67 95 84 89 80 69 95 83 - 67 65 76 65 82 61 50 44 86 66 84 95 65 76 71 69 66 82 65 73 67 95 84 89 - 80 69 95 86 69 67 84 79 82 61 51 44 86 66 84 95 65 76 71 69 66 82 65 73 - 67 95 84 89 80 69 95 84 69 78 83 79 82 61 52 44 86 66 84 95 65 76 71 69 - 66 82 65 73 67 95 84 89 80 69 95 83 89 77 95 84 69 78 83 79 82 61 53 44 - 86 66 84 95 65 76 71 69 66 82 65 73 67 95 84 89 80 69 95 70 73 69 76 68 - 61 54 44 86 66 84 95 65 76 71 69 66 82 65 73 67 95 84 89 80 69 95 83 84 - 65 84 69 61 55 44 86 66 84 95 65 76 71 69 66 82 65 73 67 95 84 89 80 69 - 95 84 85 80 76 69 61 56 44 86 66 84 95 65 76 71 69 66 82 65 73 67 95 84 - 89 80 69 95 65 78 89 61 45 49 44 86 66 84 95 65 76 71 69 66 82 65 73 67 - 95 84 89 80 69 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 95 65 76 71 - 69 66 82 65 73 67 95 84 89 80 69 95 78 65 61 45 51 44 86 66 84 95 65 76 - 71 69 66 82 65 73 67 95 84 89 80 69 95 85 78 75 78 79 87 78 61 45 52 - 125 97 108 103 95 116 121 112 101 59 101 110 117 109 32 66 97 115 105 - 115 84 121 112 101 123 86 66 84 95 66 65 83 73 83 95 84 89 80 69 95 85 - 78 73 84 89 61 48 44 86 66 84 95 66 65 83 73 83 95 84 89 80 69 95 67 65 - 82 84 69 83 73 65 78 61 49 44 86 66 84 95 66 65 83 73 83 95 84 89 80 69 - 95 83 80 72 69 82 73 67 65 76 61 50 44 86 66 84 95 66 65 83 73 83 95 84 - 89 80 69 95 67 89 76 73 78 68 82 73 67 65 76 61 51 44 86 66 84 95 66 65 - 83 73 83 95 84 89 80 69 95 85 80 80 69 82 95 84 82 73 61 52 44 86 66 84 - 95 66 65 83 73 83 95 84 89 80 69 95 70 79 85 82 73 69 82 61 53 44 86 66 - 84 95 66 65 83 73 83 95 84 89 80 69 95 86 65 82 73 65 66 76 69 61 54 44 - 86 66 84 95 66 65 83 73 83 95 84 89 80 69 95 65 78 89 61 45 49 44 86 66 - 84 95 66 65 83 73 83 95 84 89 80 69 95 73 78 86 65 76 73 68 61 45 50 44 - 86 66 84 95 66 65 83 73 83 95 84 89 80 69 95 78 65 61 45 51 44 86 66 84 - 95 66 65 83 73 83 95 84 89 80 69 95 85 78 75 78 79 87 78 61 45 52 125 - 98 97 115 105 115 59 68 83 76 95 79 102 102 115 101 116 32 113 117 97 - 110 116 105 116 121 95 105 100 59 105 110 116 32 110 117 109 95 99 111 - 109 112 115 59 68 83 76 95 79 102 102 115 101 116 32 102 116 109 112 - 108 95 105 100 115 95 98 108 111 98 95 105 100 59 68 83 76 95 79 102 - 102 115 101 116 32 98 97 115 101 95 105 100 59 68 83 76 95 79 102 102 - 115 101 116 32 110 117 109 95 114 101 99 115 59 125 59 10 47 70 105 101 - 108 100 32 68 65 84 65 83 69 84 32 115 116 114 117 99 116 32 70 105 101 - 108 100 123 68 83 76 95 79 102 102 115 101 116 32 102 116 109 112 108 - 95 105 100 59 99 104 97 114 32 110 97 109 101 91 54 52 93 59 68 83 76 - 95 79 102 102 115 101 116 32 117 110 105 116 115 95 105 100 59 68 83 76 - 95 79 102 102 115 101 116 32 115 116 111 114 97 103 101 95 100 101 99 - 111 109 112 95 99 97 116 95 105 100 59 101 110 117 109 32 73 110 116 - 101 114 108 101 97 118 101 123 86 66 84 95 73 78 84 69 82 76 69 65 86 - 69 95 67 79 77 80 79 78 69 78 84 61 48 44 86 66 84 95 73 78 84 69 82 76 - 69 65 86 69 95 86 69 67 84 79 82 61 49 44 86 66 84 95 73 78 84 69 82 76 - 69 65 86 69 95 73 78 68 69 80 69 78 68 69 78 84 61 50 44 86 66 84 95 73 - 78 84 69 82 76 69 65 86 69 95 78 79 78 69 61 51 44 86 66 84 95 73 78 84 - 69 82 76 69 65 86 69 95 65 78 89 61 45 49 44 86 66 84 95 73 78 84 69 82 - 76 69 65 86 69 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 95 73 78 84 - 69 82 76 69 65 86 69 95 78 65 61 45 51 44 86 66 84 95 73 78 84 69 82 76 - 69 65 86 69 95 85 78 75 78 79 87 78 61 45 52 125 99 111 109 112 95 105 - 110 116 108 118 59 68 83 76 95 79 102 102 115 101 116 32 105 110 100 - 101 120 105 110 103 95 105 100 59 68 83 76 95 79 102 102 115 101 116 32 - 100 111 102 95 97 115 115 111 99 95 99 97 116 95 105 100 59 105 110 116 - 32 97 115 115 111 99 95 114 97 116 105 111 59 68 83 76 95 79 102 102 - 115 101 116 32 101 118 97 108 95 100 101 99 111 109 112 95 99 97 116 95 - 105 100 59 101 110 117 109 32 69 118 97 108 70 117 110 99 123 86 66 84 - 95 69 86 65 76 95 70 85 78 67 95 67 79 78 83 84 65 78 84 61 48 44 86 66 - 84 95 69 86 65 76 95 70 85 78 67 95 85 78 73 70 79 82 77 61 49 44 86 66 - 84 95 69 86 65 76 95 70 85 78 67 95 80 87 67 79 78 83 84 61 50 44 86 66 - 84 95 69 86 65 76 95 70 85 78 67 95 80 87 76 73 78 69 65 82 61 51 44 86 - 66 84 95 69 86 65 76 95 70 85 78 67 95 65 78 89 61 45 49 44 86 66 84 95 - 69 86 65 76 95 70 85 78 67 95 73 78 86 65 76 73 68 61 45 50 44 86 66 84 - 95 69 86 65 76 95 70 85 78 67 95 78 65 61 45 51 44 86 66 84 95 69 86 65 - 76 95 70 85 78 67 95 85 78 75 78 79 87 78 61 45 52 125 101 118 97 108 - 95 102 117 110 99 59 105 110 116 32 105 115 95 104 111 109 111 103 101 - 110 101 111 117 115 59 105 110 116 32 105 115 95 99 111 111 114 100 95 - 102 105 101 108 100 59 68 83 76 95 79 102 102 115 101 116 32 99 111 109 - 112 95 105 100 115 95 98 108 111 98 95 105 100 59 68 83 76 95 79 102 - 102 115 101 116 32 99 111 109 112 95 111 114 100 101 114 95 98 108 111 - 98 95 105 100 59 68 83 76 95 79 102 102 115 101 116 32 118 98 97 115 - 105 115 95 98 108 111 98 95 105 100 59 68 83 76 95 79 102 102 115 101 - 116 32 100 111 102 95 98 108 111 98 95 105 100 59 68 83 76 95 79 102 - 102 115 101 116 32 98 97 115 101 95 105 100 59 68 83 76 95 79 102 102 - 115 101 116 32 110 117 109 95 114 101 99 115 59 125 59 10 47 109 101 - 116 97 98 108 111 98 48 48 48 48 48 46 105 110 100 101 120 32 68 65 84 - 65 83 69 84 32 115 116 114 117 99 116 32 73 110 100 101 120 80 97 105 - 114 123 68 83 76 95 79 102 102 115 101 116 32 105 110 100 101 120 59 - 105 110 116 32 108 101 110 103 116 104 59 125 59 10 47 109 101 116 97 - 98 108 111 98 48 48 48 48 48 46 98 108 111 98 32 68 65 84 65 83 69 84 - 32 68 83 76 95 79 102 102 115 101 116 59 10 + 47 + 32 + 67 + 79 + 78 + 84 + 65 + 73 + 78 + 69 + 82 + 10 + 47 + 46 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 115 + 32 + 67 + 79 + 78 + 84 + 65 + 73 + 78 + 69 + 82 + 10 + 47 + 46 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 115 + 47 + 100 + 97 + 116 + 97 + 98 + 97 + 115 + 101 + 32 + 67 + 79 + 78 + 84 + 65 + 73 + 78 + 69 + 82 + 10 + 47 + 46 + 97 + 116 + 116 + 114 + 105 + 98 + 117 + 116 + 101 + 115 + 47 + 100 + 97 + 116 + 97 + 98 + 97 + 115 + 101 + 47 + 46 + 83 + 65 + 70 + 95 + 68 + 98 + 80 + 114 + 111 + 112 + 115 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 68 + 98 + 80 + 114 + 111 + 112 + 115 + 123 + 105 + 110 + 116 + 32 + 109 + 97 + 103 + 105 + 99 + 59 + 99 + 104 + 97 + 114 + 32 + 83 + 70 + 105 + 108 + 101 + 68 + 105 + 114 + 91 + 49 + 48 + 50 + 52 + 93 + 59 + 99 + 104 + 97 + 114 + 32 + 73 + 109 + 112 + 111 + 114 + 116 + 70 + 105 + 108 + 101 + 91 + 49 + 48 + 50 + 52 + 93 + 59 + 105 + 110 + 116 + 32 + 112 + 97 + 114 + 97 + 108 + 108 + 101 + 108 + 59 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 86 + 101 + 114 + 115 + 105 + 111 + 110 + 73 + 110 + 102 + 111 + 123 + 105 + 110 + 116 + 32 + 118 + 109 + 97 + 106 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 118 + 109 + 105 + 110 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 114 + 101 + 108 + 59 + 99 + 104 + 97 + 114 + 32 + 97 + 110 + 110 + 111 + 116 + 91 + 49 + 48 + 93 + 59 + 125 + 115 + 97 + 102 + 97 + 112 + 105 + 59 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 86 + 101 + 114 + 115 + 105 + 111 + 110 + 73 + 110 + 102 + 111 + 123 + 105 + 110 + 116 + 32 + 118 + 109 + 97 + 106 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 118 + 109 + 105 + 110 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 114 + 101 + 108 + 59 + 99 + 104 + 97 + 114 + 32 + 97 + 110 + 110 + 111 + 116 + 91 + 49 + 48 + 93 + 59 + 125 + 115 + 97 + 102 + 108 + 105 + 98 + 59 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 86 + 101 + 114 + 115 + 105 + 111 + 110 + 73 + 110 + 102 + 111 + 123 + 105 + 110 + 116 + 32 + 118 + 109 + 97 + 106 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 118 + 109 + 105 + 110 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 114 + 101 + 108 + 59 + 99 + 104 + 97 + 114 + 32 + 97 + 110 + 110 + 111 + 116 + 91 + 49 + 48 + 93 + 59 + 125 + 118 + 98 + 116 + 59 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 86 + 101 + 114 + 115 + 105 + 111 + 110 + 73 + 110 + 102 + 111 + 123 + 105 + 110 + 116 + 32 + 118 + 109 + 97 + 106 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 118 + 109 + 105 + 110 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 114 + 101 + 108 + 59 + 99 + 104 + 97 + 114 + 32 + 97 + 110 + 110 + 111 + 116 + 91 + 49 + 48 + 93 + 59 + 125 + 100 + 115 + 108 + 59 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 86 + 101 + 114 + 115 + 105 + 111 + 110 + 73 + 110 + 102 + 111 + 123 + 105 + 110 + 116 + 32 + 118 + 109 + 97 + 106 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 118 + 109 + 105 + 110 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 114 + 101 + 108 + 59 + 99 + 104 + 97 + 114 + 32 + 97 + 110 + 110 + 111 + 116 + 91 + 49 + 48 + 93 + 59 + 125 + 104 + 100 + 102 + 53 + 59 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 65 + 70 + 95 + 86 + 101 + 114 + 115 + 105 + 111 + 110 + 73 + 110 + 102 + 111 + 123 + 105 + 110 + 116 + 32 + 118 + 109 + 97 + 106 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 118 + 109 + 105 + 110 + 111 + 114 + 59 + 105 + 110 + 116 + 32 + 114 + 101 + 108 + 59 + 99 + 104 + 97 + 114 + 32 + 97 + 110 + 110 + 111 + 116 + 91 + 49 + 48 + 93 + 59 + 125 + 109 + 112 + 105 + 59 + 105 + 110 + 116 + 32 + 68 + 111 + 84 + 111 + 99 + 59 + 105 + 110 + 116 + 32 + 82 + 101 + 97 + 100 + 79 + 110 + 108 + 121 + 59 + 105 + 110 + 116 + 32 + 67 + 108 + 111 + 98 + 98 + 101 + 114 + 59 + 105 + 110 + 116 + 32 + 79 + 83 + 77 + 111 + 100 + 101 + 115 + 59 + 125 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 48 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 49 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 50 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 51 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 52 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 53 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 54 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 55 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 56 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 48 + 57 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 49 + 48 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 49 + 49 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 115 + 115 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 49 + 50 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 116 + 111 + 112 + 111 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 49 + 55 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 116 + 111 + 112 + 111 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 49 + 56 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 116 + 111 + 112 + 111 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 49 + 57 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 116 + 111 + 112 + 111 + 114 + 101 + 108 + 45 + 95 + 48 + 48 + 50 + 48 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 105 + 110 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 99 + 111 + 111 + 114 + 100 + 115 + 95 + 48 + 48 + 48 + 50 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 100 + 105 + 115 + 116 + 114 + 105 + 98 + 117 + 116 + 105 + 111 + 110 + 95 + 102 + 97 + 99 + 116 + 111 + 114 + 115 + 95 + 48 + 48 + 48 + 51 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 116 + 101 + 109 + 112 + 101 + 114 + 97 + 116 + 117 + 114 + 101 + 95 + 48 + 48 + 48 + 52 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 100 + 105 + 115 + 112 + 108 + 97 + 99 + 101 + 109 + 101 + 110 + 116 + 115 + 95 + 48 + 48 + 48 + 55 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 115 + 116 + 114 + 101 + 115 + 115 + 95 + 48 + 48 + 49 + 49 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 116 + 101 + 109 + 112 + 101 + 114 + 97 + 116 + 117 + 114 + 101 + 95 + 48 + 48 + 49 + 50 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 102 + 105 + 101 + 108 + 100 + 45 + 112 + 114 + 101 + 115 + 115 + 117 + 114 + 101 + 95 + 48 + 48 + 49 + 51 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 102 + 108 + 111 + 97 + 116 + 59 + 10 + 47 + 66 + 108 + 111 + 98 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 66 + 108 + 111 + 98 + 123 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 102 + 105 + 108 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 100 + 97 + 116 + 97 + 115 + 101 + 116 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 111 + 102 + 102 + 115 + 101 + 116 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 116 + 114 + 105 + 100 + 101 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 99 + 111 + 117 + 110 + 116 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 73 + 110 + 100 + 101 + 120 + 83 + 112 + 101 + 99 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 73 + 110 + 100 + 101 + 120 + 83 + 112 + 101 + 99 + 123 + 105 + 110 + 116 + 32 + 110 + 100 + 105 + 109 + 115 + 59 + 105 + 110 + 116 + 32 + 111 + 114 + 105 + 103 + 105 + 110 + 115 + 91 + 56 + 93 + 59 + 105 + 110 + 116 + 32 + 115 + 105 + 122 + 101 + 115 + 91 + 56 + 93 + 59 + 105 + 110 + 116 + 32 + 111 + 114 + 100 + 101 + 114 + 91 + 56 + 93 + 59 + 101 + 110 + 117 + 109 + 32 + 73 + 110 + 100 + 101 + 120 + 84 + 121 + 112 + 101 + 123 + 86 + 66 + 84 + 95 + 73 + 78 + 68 + 69 + 88 + 95 + 84 + 89 + 80 + 69 + 95 + 67 + 95 + 79 + 82 + 68 + 69 + 82 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 68 + 69 + 88 + 95 + 84 + 89 + 80 + 69 + 95 + 70 + 95 + 79 + 82 + 68 + 69 + 82 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 68 + 69 + 88 + 95 + 84 + 89 + 80 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 68 + 69 + 88 + 95 + 84 + 89 + 80 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 68 + 69 + 88 + 95 + 84 + 89 + 80 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 68 + 69 + 88 + 95 + 84 + 89 + 80 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 105 + 110 + 100 + 101 + 120 + 95 + 116 + 121 + 112 + 101 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 67 + 97 + 116 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 67 + 97 + 116 + 123 + 99 + 104 + 97 + 114 + 32 + 110 + 97 + 109 + 101 + 91 + 54 + 52 + 93 + 59 + 101 + 110 + 117 + 109 + 32 + 82 + 111 + 108 + 101 + 123 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 84 + 79 + 80 + 79 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 66 + 78 + 68 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 80 + 82 + 79 + 67 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 68 + 79 + 77 + 78 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 66 + 76 + 79 + 67 + 75 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 65 + 83 + 83 + 89 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 77 + 65 + 84 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 88 + 80 + 82 + 79 + 68 + 61 + 55 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 85 + 83 + 69 + 82 + 68 + 61 + 56 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 82 + 79 + 76 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 114 + 111 + 108 + 101 + 59 + 105 + 110 + 116 + 32 + 116 + 100 + 105 + 109 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 83 + 101 + 116 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 83 + 101 + 116 + 123 + 105 + 110 + 116 + 32 + 117 + 115 + 101 + 114 + 95 + 105 + 100 + 59 + 99 + 104 + 97 + 114 + 32 + 110 + 97 + 109 + 101 + 91 + 54 + 52 + 93 + 59 + 105 + 110 + 116 + 32 + 116 + 100 + 105 + 109 + 59 + 101 + 110 + 117 + 109 + 32 + 83 + 105 + 108 + 82 + 111 + 108 + 101 + 123 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 84 + 73 + 77 + 69 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 83 + 80 + 65 + 67 + 69 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 83 + 84 + 65 + 84 + 69 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 80 + 65 + 82 + 65 + 77 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 67 + 84 + 89 + 80 + 69 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 65 + 84 + 89 + 80 + 69 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 85 + 83 + 69 + 82 + 68 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 83 + 82 + 79 + 76 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 115 + 114 + 111 + 108 + 101 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 99 + 111 + 108 + 108 + 95 + 105 + 100 + 115 + 91 + 49 + 54 + 93 + 59 + 105 + 110 + 116 + 32 + 105 + 115 + 95 + 116 + 111 + 112 + 59 + 105 + 110 + 116 + 32 + 105 + 115 + 95 + 101 + 120 + 116 + 101 + 110 + 100 + 105 + 98 + 108 + 101 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 100 + 102 + 108 + 116 + 95 + 99 + 111 + 111 + 114 + 100 + 102 + 108 + 100 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 110 + 100 + 95 + 115 + 101 + 116 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 67 + 111 + 108 + 108 + 101 + 99 + 116 + 105 + 111 + 110 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 67 + 111 + 108 + 108 + 101 + 99 + 116 + 105 + 111 + 110 + 123 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 99 + 111 + 110 + 116 + 97 + 105 + 110 + 105 + 110 + 103 + 95 + 115 + 101 + 116 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 101 + 110 + 117 + 109 + 32 + 67 + 101 + 108 + 108 + 84 + 121 + 112 + 101 + 123 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 78 + 79 + 78 + 69 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 80 + 79 + 73 + 78 + 84 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 76 + 73 + 78 + 69 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 84 + 82 + 73 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 81 + 85 + 65 + 68 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 84 + 69 + 84 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 80 + 89 + 82 + 65 + 77 + 73 + 68 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 80 + 82 + 73 + 83 + 77 + 61 + 55 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 72 + 69 + 88 + 61 + 56 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 77 + 73 + 88 + 69 + 68 + 61 + 57 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 65 + 82 + 66 + 61 + 49 + 48 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 49 + 66 + 65 + 76 + 76 + 61 + 49 + 49 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 50 + 66 + 65 + 76 + 76 + 61 + 49 + 50 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 51 + 66 + 65 + 76 + 76 + 61 + 49 + 51 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 49 + 83 + 72 + 69 + 76 + 76 + 61 + 49 + 52 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 50 + 83 + 72 + 69 + 76 + 76 + 61 + 49 + 53 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 67 + 69 + 76 + 76 + 95 + 84 + 89 + 80 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 99 + 101 + 108 + 108 + 95 + 116 + 121 + 112 + 101 + 59 + 105 + 110 + 116 + 32 + 99 + 111 + 117 + 110 + 116 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 105 + 110 + 100 + 101 + 120 + 105 + 110 + 103 + 95 + 105 + 100 + 59 + 105 + 110 + 116 + 32 + 105 + 115 + 95 + 100 + 101 + 99 + 111 + 109 + 112 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 109 + 101 + 109 + 98 + 101 + 114 + 115 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 82 + 101 + 108 + 97 + 116 + 105 + 111 + 110 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 82 + 101 + 108 + 97 + 116 + 105 + 111 + 110 + 123 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 117 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 117 + 98 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 117 + 98 + 95 + 100 + 101 + 99 + 111 + 109 + 112 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 117 + 112 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 117 + 112 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 117 + 112 + 95 + 100 + 101 + 99 + 111 + 109 + 112 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 101 + 110 + 117 + 109 + 32 + 82 + 101 + 108 + 75 + 105 + 110 + 100 + 123 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 83 + 85 + 66 + 83 + 69 + 84 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 83 + 85 + 80 + 83 + 69 + 84 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 66 + 79 + 85 + 78 + 68 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 80 + 69 + 82 + 77 + 85 + 84 + 69 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 78 + 69 + 73 + 71 + 72 + 66 + 79 + 82 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 67 + 79 + 80 + 89 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 69 + 81 + 85 + 65 + 76 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 75 + 73 + 78 + 68 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 107 + 105 + 110 + 100 + 59 + 101 + 110 + 117 + 109 + 32 + 82 + 101 + 108 + 82 + 101 + 112 + 123 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 73 + 68 + 69 + 78 + 84 + 73 + 84 + 89 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 72 + 76 + 73 + 83 + 84 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 84 + 76 + 73 + 83 + 84 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 84 + 76 + 73 + 83 + 84 + 95 + 49 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 69 + 76 + 73 + 83 + 84 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 83 + 84 + 82 + 85 + 67 + 84 + 85 + 82 + 69 + 68 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 85 + 78 + 83 + 84 + 82 + 85 + 67 + 84 + 85 + 82 + 69 + 68 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 65 + 82 + 66 + 73 + 84 + 82 + 65 + 82 + 89 + 95 + 82 + 61 + 55 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 65 + 82 + 66 + 73 + 84 + 82 + 65 + 82 + 89 + 95 + 68 + 82 + 61 + 56 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 82 + 69 + 76 + 82 + 69 + 80 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 114 + 101 + 112 + 95 + 116 + 121 + 112 + 101 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 100 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 114 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 70 + 105 + 101 + 108 + 100 + 84 + 109 + 112 + 108 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 70 + 105 + 101 + 108 + 100 + 84 + 109 + 112 + 108 + 123 + 99 + 104 + 97 + 114 + 32 + 110 + 97 + 109 + 101 + 91 + 54 + 52 + 93 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 115 + 112 + 97 + 99 + 101 + 95 + 105 + 100 + 59 + 101 + 110 + 117 + 109 + 32 + 65 + 108 + 103 + 101 + 98 + 114 + 97 + 105 + 99 + 84 + 121 + 112 + 101 + 123 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 67 + 79 + 78 + 83 + 84 + 65 + 78 + 84 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 67 + 79 + 77 + 80 + 79 + 78 + 69 + 78 + 84 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 83 + 67 + 65 + 76 + 65 + 82 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 86 + 69 + 67 + 84 + 79 + 82 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 84 + 69 + 78 + 83 + 79 + 82 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 83 + 89 + 77 + 95 + 84 + 69 + 78 + 83 + 79 + 82 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 70 + 73 + 69 + 76 + 68 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 83 + 84 + 65 + 84 + 69 + 61 + 55 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 84 + 85 + 80 + 76 + 69 + 61 + 56 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 65 + 76 + 71 + 69 + 66 + 82 + 65 + 73 + 67 + 95 + 84 + 89 + 80 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 97 + 108 + 103 + 95 + 116 + 121 + 112 + 101 + 59 + 101 + 110 + 117 + 109 + 32 + 66 + 97 + 115 + 105 + 115 + 84 + 121 + 112 + 101 + 123 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 85 + 78 + 73 + 84 + 89 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 67 + 65 + 82 + 84 + 69 + 83 + 73 + 65 + 78 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 83 + 80 + 72 + 69 + 82 + 73 + 67 + 65 + 76 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 67 + 89 + 76 + 73 + 78 + 68 + 82 + 73 + 67 + 65 + 76 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 85 + 80 + 80 + 69 + 82 + 95 + 84 + 82 + 73 + 61 + 52 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 70 + 79 + 85 + 82 + 73 + 69 + 82 + 61 + 53 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 86 + 65 + 82 + 73 + 65 + 66 + 76 + 69 + 61 + 54 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 66 + 65 + 83 + 73 + 83 + 95 + 84 + 89 + 80 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 98 + 97 + 115 + 105 + 115 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 113 + 117 + 97 + 110 + 116 + 105 + 116 + 121 + 95 + 105 + 100 + 59 + 105 + 110 + 116 + 32 + 110 + 117 + 109 + 95 + 99 + 111 + 109 + 112 + 115 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 102 + 116 + 109 + 112 + 108 + 95 + 105 + 100 + 115 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 70 + 105 + 101 + 108 + 100 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 70 + 105 + 101 + 108 + 100 + 123 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 102 + 116 + 109 + 112 + 108 + 95 + 105 + 100 + 59 + 99 + 104 + 97 + 114 + 32 + 110 + 97 + 109 + 101 + 91 + 54 + 52 + 93 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 117 + 110 + 105 + 116 + 115 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 115 + 116 + 111 + 114 + 97 + 103 + 101 + 95 + 100 + 101 + 99 + 111 + 109 + 112 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 101 + 110 + 117 + 109 + 32 + 73 + 110 + 116 + 101 + 114 + 108 + 101 + 97 + 118 + 101 + 123 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 67 + 79 + 77 + 80 + 79 + 78 + 69 + 78 + 84 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 86 + 69 + 67 + 84 + 79 + 82 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 73 + 78 + 68 + 69 + 80 + 69 + 78 + 68 + 69 + 78 + 84 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 78 + 79 + 78 + 69 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 73 + 78 + 84 + 69 + 82 + 76 + 69 + 65 + 86 + 69 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 99 + 111 + 109 + 112 + 95 + 105 + 110 + 116 + 108 + 118 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 105 + 110 + 100 + 101 + 120 + 105 + 110 + 103 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 100 + 111 + 102 + 95 + 97 + 115 + 115 + 111 + 99 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 105 + 110 + 116 + 32 + 97 + 115 + 115 + 111 + 99 + 95 + 114 + 97 + 116 + 105 + 111 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 101 + 118 + 97 + 108 + 95 + 100 + 101 + 99 + 111 + 109 + 112 + 95 + 99 + 97 + 116 + 95 + 105 + 100 + 59 + 101 + 110 + 117 + 109 + 32 + 69 + 118 + 97 + 108 + 70 + 117 + 110 + 99 + 123 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 67 + 79 + 78 + 83 + 84 + 65 + 78 + 84 + 61 + 48 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 85 + 78 + 73 + 70 + 79 + 82 + 77 + 61 + 49 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 80 + 87 + 67 + 79 + 78 + 83 + 84 + 61 + 50 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 80 + 87 + 76 + 73 + 78 + 69 + 65 + 82 + 61 + 51 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 65 + 78 + 89 + 61 + 45 + 49 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 73 + 78 + 86 + 65 + 76 + 73 + 68 + 61 + 45 + 50 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 78 + 65 + 61 + 45 + 51 + 44 + 86 + 66 + 84 + 95 + 69 + 86 + 65 + 76 + 95 + 70 + 85 + 78 + 67 + 95 + 85 + 78 + 75 + 78 + 79 + 87 + 78 + 61 + 45 + 52 + 125 + 101 + 118 + 97 + 108 + 95 + 102 + 117 + 110 + 99 + 59 + 105 + 110 + 116 + 32 + 105 + 115 + 95 + 104 + 111 + 109 + 111 + 103 + 101 + 110 + 101 + 111 + 117 + 115 + 59 + 105 + 110 + 116 + 32 + 105 + 115 + 95 + 99 + 111 + 111 + 114 + 100 + 95 + 102 + 105 + 101 + 108 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 99 + 111 + 109 + 112 + 95 + 105 + 100 + 115 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 99 + 111 + 109 + 112 + 95 + 111 + 114 + 100 + 101 + 114 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 118 + 98 + 97 + 115 + 105 + 115 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 100 + 111 + 102 + 95 + 98 + 108 + 111 + 98 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 98 + 97 + 115 + 101 + 95 + 105 + 100 + 59 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 110 + 117 + 109 + 95 + 114 + 101 + 99 + 115 + 59 + 125 + 59 + 10 + 47 + 109 + 101 + 116 + 97 + 98 + 108 + 111 + 98 + 48 + 48 + 48 + 48 + 48 + 46 + 105 + 110 + 100 + 101 + 120 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 115 + 116 + 114 + 117 + 99 + 116 + 32 + 73 + 110 + 100 + 101 + 120 + 80 + 97 + 105 + 114 + 123 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 32 + 105 + 110 + 100 + 101 + 120 + 59 + 105 + 110 + 116 + 32 + 108 + 101 + 110 + 103 + 116 + 104 + 59 + 125 + 59 + 10 + 47 + 109 + 101 + 116 + 97 + 98 + 108 + 111 + 98 + 48 + 48 + 48 + 48 + 48 + 46 + 98 + 108 + 111 + 98 + 32 + 68 + 65 + 84 + 65 + 83 + 69 + 84 + 32 + 68 + 83 + 76 + 95 + 79 + 102 + 102 + 115 + 101 + 116 + 59 + 10 @@ -310,9 +5954,9 @@ - + - + @@ -603,7 +6247,7 @@ - + @@ -667,12 +6311,30 @@ - -1 1 0 1 9 0 1 -1 2 0 1 4 1 1 -1 3 0 1 7 2 1 -1 4 0 1 4 3 1 - -1 5 0 1 5 4 1 -1 6 0 1 3 5 1 -1 7 0 1 4 6 1 -1 8 0 1 1 7 1 - -1 9 0 1 10 8 1 -1 10 0 1 4 9 1 -1 11 0 1 3 10 1 -1 12 0 1 5 11 1 - -1 13 0 1 5 12 1 -1 14 0 1 16 13 1 -1 15 0 1 9 14 1 -1 16 0 1 4 15 1 - -1 17 0 1 16 16 1 -1 18 0 1 36 17 1 -1 19 0 1 5 18 1 -1 20 0 1 5 19 1 - -1 21 0 1 36 20 1 -1 22 0 1 12 21 1 -1 23 0 1 7 22 1 -1 24 0 1 2 23 1 + -1 1 0 1 9 0 1 + -1 2 0 1 4 1 1 + -1 3 0 1 7 2 1 + -1 4 0 1 4 3 1 + -1 5 0 1 5 4 1 + -1 6 0 1 3 5 1 + -1 7 0 1 4 6 1 + -1 8 0 1 1 7 1 + -1 9 0 1 10 8 1 + -1 10 0 1 4 9 1 + -1 11 0 1 3 10 1 + -1 12 0 1 5 11 1 + -1 13 0 1 5 12 1 + -1 14 0 1 16 13 1 + -1 15 0 1 9 14 1 + -1 16 0 1 4 15 1 + -1 17 0 1 16 16 1 + -1 18 0 1 36 17 1 + -1 19 0 1 5 18 1 + -1 20 0 1 5 19 1 + -1 21 0 1 36 20 1 + -1 22 0 1 12 21 1 + -1 23 0 1 7 22 1 + -1 24 0 1 2 23 1 @@ -686,7 +6348,7 @@ - + @@ -820,8 +6482,11 @@ - "nodes" TOPO 0 0 1 "elems" TOPO 2 1 1 "edges" USERD 1 2 1 - "blocks" BLOCK 2 3 1 "side_sets" USERD 1 4 1 + "nodes" TOPO 0 0 1 + "elems" TOPO 2 1 1 + "edges" USERD 1 2 1 + "blocks" BLOCK 2 3 1 + "side_sets" USERD 1 4 1 @@ -835,7 +6500,7 @@ - + @@ -1039,15 +6704,30 @@ - 0 0 POINT 18 0 0 -2 0 1 0 1 MIXED 12 1 1 -2 1 1 0 3 NONE 4 2 1 0 2 1 - 0 4 NONE 2 3 0 1 3 1 1 0 POINT 9 4 0 -2 4 1 1 1 QUAD 4 5 1 -2 5 1 - 1 3 NONE 1 6 1 2 6 1 2 0 POINT 7 7 0 -2 7 1 2 1 MIXED 4 8 1 -2 8 1 - 2 3 NONE 2 9 1 3 9 1 3 0 POINT 10 10 0 -2 10 1 3 1 QUAD 4 11 1 -2 11 1 - 3 3 NONE 1 12 1 4 12 1 4 0 POINT 3 13 0 -2 13 1 4 2 LINE 2 14 1 -2 14 1 - 5 0 POINT 5 15 0 -2 15 1 5 2 LINE 4 16 1 -2 16 1 - 6 0 POINT 5 17 1 -2 17 1 7 0 POINT 5 18 0 -2 18 1 - 7 1 TRI 3 19 1 -2 19 1 7 3 NONE 1 20 1 5 20 1 8 0 POINT 4 21 0 -2 21 1 - 8 1 QUAD 1 22 1 -2 22 1 8 3 NONE 1 23 1 6 23 1 + 0 0 POINT 18 0 0 -2 0 1 + 0 1 MIXED 12 1 1 -2 1 1 + 0 3 NONE 4 2 1 0 2 1 + 0 4 NONE 2 3 0 1 3 1 + 1 0 POINT 9 4 0 -2 4 1 + 1 1 QUAD 4 5 1 -2 5 1 + 1 3 NONE 1 6 1 2 6 1 + 2 0 POINT 7 7 0 -2 7 1 + 2 1 MIXED 4 8 1 -2 8 1 + 2 3 NONE 2 9 1 3 9 1 + 3 0 POINT 10 10 0 -2 10 1 + 3 1 QUAD 4 11 1 -2 11 1 + 3 3 NONE 1 12 1 4 12 1 + 4 0 POINT 3 13 0 -2 13 1 + 4 2 LINE 2 14 1 -2 14 1 + 5 0 POINT 5 15 0 -2 15 1 + 5 2 LINE 4 16 1 -2 16 1 + 6 0 POINT 5 17 1 -2 17 1 + 7 0 POINT 5 18 0 -2 18 1 + 7 1 TRI 3 19 1 -2 19 1 + 7 3 NONE 1 20 1 5 20 1 + 8 0 POINT 4 21 0 -2 21 1 + 8 1 QUAD 1 22 1 -2 22 1 + 8 3 NONE 1 23 1 6 23 1 @@ -1061,7 +6741,7 @@ - + @@ -1337,7 +7017,7 @@ - + @@ -1592,7 +7272,7 @@ - + @@ -1731,30 +7411,30 @@ - 1 0 0 0 0 0 0 0 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 0 1 - 1 0 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 1 1 - 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 2 1 - 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 3 1 - 1 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 4 1 - 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 5 1 - 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 6 1 - 1 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 7 1 - 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 8 1 - 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 9 1 - 1 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 10 1 - 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 11 1 - 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 12 1 - 1 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 13 1 - 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 14 1 - 1 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 15 1 - 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 16 1 - 1 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 17 1 - 1 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 18 1 - 1 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 19 1 - 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 20 1 - 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 21 1 - 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 22 1 - 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 23 1 + 1 0 0 0 0 0 0 0 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 0 1 + 1 0 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 1 1 + 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 2 1 + 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 3 1 + 1 0 0 0 0 0 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 4 1 + 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 5 1 + 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 6 1 + 1 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 7 1 + 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 8 1 + 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 9 1 + 1 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 10 1 + 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 11 1 + 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 12 1 + 1 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 13 1 + 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 14 1 + 1 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 15 1 + 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 16 1 + 1 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 17 1 + 1 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 18 1 + 1 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 19 1 + 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 20 1 + 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 21 1 + 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 22 1 + 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C_ORDER 23 1 @@ -1768,7 +7448,7 @@ - + @@ -2023,11 +7703,16 @@ - 1 0 -2 0 0 -2 EQUAL TLIST -2 0 0 1 1 1 -2 0 1 -2 EQUAL TLIST -2 1 1 1 - 2 0 -2 0 0 -2 EQUAL TLIST -2 2 2 1 2 1 -2 0 1 -2 EQUAL TLIST -2 3 3 1 - 7 0 -2 0 0 -2 EQUAL TLIST -2 4 4 1 7 1 -2 0 1 -2 EQUAL TLIST -2 5 5 1 - 8 0 -2 0 0 -2 EQUAL TLIST -2 6 6 1 8 1 -2 0 1 -2 EQUAL TLIST -2 7 7 1 - 3 0 -2 0 0 -2 EQUAL TLIST -2 8 8 1 3 1 -2 0 1 -2 EQUAL TLIST -2 9 9 1 + 1 0 -2 0 0 -2 EQUAL TLIST -2 0 0 1 + 1 1 -2 0 1 -2 EQUAL TLIST -2 1 1 1 + 2 0 -2 0 0 -2 EQUAL TLIST -2 2 2 1 + 2 1 -2 0 1 -2 EQUAL TLIST -2 3 3 1 + 7 0 -2 0 0 -2 EQUAL TLIST -2 4 4 1 + 7 1 -2 0 1 -2 EQUAL TLIST -2 5 5 1 + 8 0 -2 0 0 -2 EQUAL TLIST -2 6 6 1 + 8 1 -2 0 1 -2 EQUAL TLIST -2 7 7 1 + 3 0 -2 0 0 -2 EQUAL TLIST -2 8 8 1 + 3 1 -2 0 1 -2 EQUAL TLIST -2 9 9 1 4 0 -2 0 0 -2 EQUAL TLIST -2 10 10 1 5 0 -2 0 0 -2 EQUAL TLIST -2 11 11 1 6 0 -2 0 0 -2 EQUAL TLIST -2 12 12 1 @@ -2052,7 +7737,7 @@ - + @@ -2227,15 +7912,15 @@ - 0 "TOP_CELL" 2 SPACE 0 1 -2 2 3 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 1 0 -2 -2 0 1 - 0 "CELL_1" 2 SPACE 4 5 -2 6 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 1 1 - 0 "CELL_2" 2 SPACE 7 8 -2 9 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 2 1 - 0 "CELL_3" 2 SPACE 10 11 -2 12 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 3 1 - 0 "SIDE_SET_1" 1 SPACE 13 -2 14 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 4 1 - 0 "SIDE_SET_2" 1 SPACE 15 -2 16 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 5 1 - 0 "NODE_SET_1" 0 SPACE 17 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 6 1 - 0 "CELL_2_TRIS" 2 SPACE 18 19 -2 20 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 7 1 - 0 "CELL_2_QUADS" 2 SPACE 21 22 -2 23 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 8 1 + 0 "TOP_CELL" 2 SPACE 0 1 -2 2 3 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 1 0 -2 -2 0 1 + 0 "CELL_1" 2 SPACE 4 5 -2 6 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 1 1 + 0 "CELL_2" 2 SPACE 7 8 -2 9 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 2 1 + 0 "CELL_3" 2 SPACE 10 11 -2 12 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 3 1 + 0 "SIDE_SET_1" 1 SPACE 13 -2 14 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 4 1 + 0 "SIDE_SET_2" 1 SPACE 15 -2 16 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 5 1 + 0 "NODE_SET_1" 0 SPACE 17 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 6 1 + 0 "CELL_2_TRIS" 2 SPACE 18 19 -2 20 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 7 1 + 0 "CELL_2_QUADS" 2 SPACE 21 22 -2 23 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 0 0 -2 -2 8 1 @@ -2243,9 +7928,9 @@ - + - + @@ -2260,8 +7945,42 @@ - 0 4 1 4 2 4 2.5 4 0 3 1 3 2 3 2.5 3 0 2 1 2 2 2 2.5 2 0 1 2 1 2.5 1 0 0 - 2 0 2.5 0 + 0 + 4 + 1 + 4 + 2 + 4 + 2.5 + 4 + 0 + 3 + 1 + 3 + 2 + 3 + 2.5 + 3 + 0 + 2 + 1 + 2 + 2 + 2 + 2.5 + 2 + 0 + 1 + 2 + 1 + 2.5 + 1 + 0 + 0 + 2 + 0 + 2.5 + 0 @@ -2269,9 +7988,9 @@ - + - + @@ -2286,9 +8005,42 @@ - 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 - 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 - 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 + 0.25 @@ -2296,9 +8048,9 @@ - + - + @@ -2313,7 +8065,11 @@ - 4 3 2 1 0 + 4 + 3 + 2 + 1 + 0 @@ -2321,9 +8077,9 @@ - + - + @@ -2338,7 +8094,8 @@ - 45 55 + 45 + 55 @@ -2346,9 +8103,9 @@ - + - + @@ -2363,7 +8120,18 @@ - 0.5 0.25 0.5 0.5 0.25 0.5 0.5 0.25 0.5 0.5 0.25 0.5 + 0.5 + 0.25 + 0.5 + 0.5 + 0.25 + 0.5 + 0.5 + 0.25 + 0.5 + 0.5 + 0.25 + 0.5 @@ -2371,9 +8139,9 @@ - + - + @@ -2388,7 +8156,11 @@ - 100 150 150 100 75 + 100 + 150 + 150 + 100 + 75 @@ -2396,9 +8168,9 @@ - + - + @@ -2413,7 +8185,13 @@ - 75 95 120 80 115 85 110 + 75 + 95 + 120 + 80 + 115 + 85 + 110 @@ -2427,7 +8205,7 @@ - + @@ -2442,7 +8220,25 @@ - 1 7 8 3 -2 -2 -2 -2 -2 -2 -2 -2 0 1 5 6 8 9 10 + 1 + 7 + 8 + 3 + -2 + -2 + -2 + -2 + -2 + -2 + -2 + -2 + 0 + 1 + 5 + 6 + 8 + 9 + 10 @@ -2456,7 +8252,7 @@ - + @@ -2485,7 +8281,16 @@ - 0 4 4 2 6 1 7 2 9 1 10 1 11 1 12 2 14 2 16 3 + 0 4 + 4 2 + 6 1 + 7 2 + 9 1 + 10 1 + 11 1 + 12 2 + 14 2 + 16 3 @@ -2493,9 +8298,9 @@ - + - + @@ -2510,7 +8315,15 @@ - 1 2 3 5 6 7 9 10 11 + 1 + 2 + 3 + 5 + 6 + 7 + 9 + 10 + 11 @@ -2518,9 +8331,9 @@ - + - + @@ -2535,7 +8348,10 @@ - 1 2 4 5 + 1 + 2 + 4 + 5 @@ -2543,9 +8359,9 @@ - + - + @@ -2560,7 +8376,13 @@ - 9 10 11 13 14 16 17 + 9 + 10 + 11 + 13 + 14 + 16 + 17 @@ -2568,9 +8390,9 @@ - + - + @@ -2585,7 +8407,10 @@ - 7 8 9 11 + 7 + 8 + 9 + 11 @@ -2593,9 +8418,9 @@ - + - + @@ -2610,7 +8435,11 @@ - 9 10 11 13 14 + 9 + 10 + 11 + 13 + 14 @@ -2618,9 +8447,9 @@ - + - + @@ -2635,7 +8464,9 @@ - 7 8 9 + 7 + 8 + 9 @@ -2643,9 +8474,9 @@ - + - + @@ -2660,7 +8491,10 @@ - 13 14 16 17 + 13 + 14 + 16 + 17 @@ -2668,9 +8502,9 @@ - + - + @@ -2693,9 +8527,9 @@ - + - + @@ -2710,7 +8544,16 @@ - 3 4 7 8 11 12 14 15 17 18 + 3 + 4 + 7 + 8 + 11 + 12 + 14 + 15 + 17 + 18 @@ -2718,9 +8561,9 @@ - + - + @@ -2735,7 +8578,10 @@ - 3 6 10 12 + 3 + 6 + 10 + 12 @@ -2743,9 +8589,9 @@ - + - + @@ -2760,7 +8606,9 @@ - 9 10 11 + 9 + 10 + 11 @@ -2768,9 +8616,9 @@ - + - + @@ -2785,7 +8633,11 @@ - 1 5 9 13 16 + 1 + 5 + 9 + 13 + 16 @@ -2793,9 +8645,9 @@ - + - + @@ -2810,7 +8662,11 @@ - 4 8 12 15 18 + 4 + 8 + 12 + 15 + 18 @@ -2818,9 +8674,9 @@ - + - + @@ -2835,7 +8691,22 @@ - 1 2 6 5 2 3 7 6 5 6 10 9 6 7 11 10 + 1 + 2 + 6 + 5 + 2 + 3 + 7 + 6 + 5 + 6 + 10 + 9 + 6 + 7 + 11 + 10 @@ -2843,9 +8714,9 @@ - + - + @@ -2860,7 +8731,15 @@ - 9 10 13 10 14 13 10 11 14 + 9 + 10 + 13 + 10 + 14 + 13 + 10 + 11 + 14 @@ -2868,9 +8747,9 @@ - + - + @@ -2885,7 +8764,10 @@ - 13 14 17 16 + 13 + 14 + 17 + 16 @@ -2893,9 +8775,9 @@ - + - + @@ -2910,7 +8792,22 @@ - 3 4 8 7 7 8 12 11 11 12 15 14 14 15 18 17 + 3 + 4 + 8 + 7 + 7 + 8 + 12 + 11 + 11 + 12 + 15 + 14 + 14 + 15 + 18 + 17 diff --git a/tools/testfiles/tscaleoffset.ddl b/tools/testfiles/tscaleoffset.ddl index 8000ef3..f1891da 100644 --- a/tools/testfiles/tscaleoffset.ddl +++ b/tools/testfiles/tscaleoffset.ddl @@ -5,13 +5,13 @@ DATASET "scaleoffset" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 152 (5.263:1 COMPRESSION) - } + } FILTERS { COMPRESSION SCALEOFFSET { MIN BITS 4 } } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tshuffle.ddl b/tools/testfiles/tshuffle.ddl index 4f9559b..cd1b5f8 100644 --- a/tools/testfiles/tshuffle.ddl +++ b/tools/testfiles/tshuffle.ddl @@ -5,13 +5,13 @@ DATASET "shuffle" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 800 - } + } FILTERS { PREPROCESSING SHUFFLE } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tsplit_file.ddl b/tools/testfiles/tsplit_file.ddl index 7e1c812..9a1e22d 100644 --- a/tools/testfiles/tsplit_file.ddl +++ b/tools/testfiles/tsplit_file.ddl @@ -2,11 +2,11 @@ HDF5 "tsplit_file" { GROUP "/" { ATTRIBUTE "Metadata" { DATATYPE H5T_STRING { - STRSIZE 35; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 35; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 1 ) / ( 1 ) } DATA { (0): "this is some metadata on this file" diff --git a/tools/testfiles/tstr-1.ddl b/tools/testfiles/tstr-1.ddl index 4d1905b..e43b732 100644 --- a/tools/testfiles/tstr-1.ddl +++ b/tools/testfiles/tstr-1.ddl @@ -250,11 +250,11 @@ GROUP "/" { } DATASET "string1" { DATATYPE H5T_STRING { - STRSIZE 5; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 5; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3, 4 ) / ( 3, 4 ) } DATA { (0,0): "s1", "s2", "s3", "s4", @@ -264,11 +264,11 @@ GROUP "/" { } DATASET "string2" { DATATYPE H5T_STRING { - STRSIZE 11; - STRPAD H5T_STR_SPACEPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 11; + STRPAD H5T_STR_SPACEPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 20 ) / ( 20 ) } DATA { (0): "ab cd ef1 ", "ab cd ef2 ", "ab cd ef3 ", "ab cd ef4 ", @@ -280,11 +280,11 @@ GROUP "/" { } DATASET "string3" { DATATYPE H5T_STRING { - STRSIZE 8; - STRPAD H5T_STR_NULLPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 8; + STRPAD H5T_STR_NULLPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 27 ) / ( 27 ) } DATA { (0): "abcd0\000\000\000", "abcd1\000\000\000", "abcd2\000\000\000", @@ -300,11 +300,11 @@ GROUP "/" { } DATASET "string4" { DATATYPE H5T_STRING { - STRSIZE 168; - STRPAD H5T_STR_SPACEPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 168; + STRPAD H5T_STR_SPACEPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3 ) / ( 3 ) } DATA { (0): "s1234567890123456789 ", diff --git a/tools/testfiles/tstr-2.ddl b/tools/testfiles/tstr-2.ddl index e887581..26425f6 100644 --- a/tools/testfiles/tstr-2.ddl +++ b/tools/testfiles/tstr-2.ddl @@ -3,11 +3,11 @@ GROUP "/" { GROUP "g1" { DATASET "dset1" { DATATYPE H5T_STRING { - STRSIZE 50; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 50; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { (0): "This is row 0 of type H5T_STR_NULLTERM of", @@ -23,11 +23,11 @@ GROUP "/" { } ATTRIBUTE "attr1" { DATATYPE H5T_STRING { - STRSIZE 11; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 11; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 3 ) / ( 3 ) } DATA { (0): "0123456789", "abcdefghij", "ABCDEFGHIJ" @@ -38,11 +38,11 @@ GROUP "/" { GROUP "g2" { DATASET "dset2" { DATATYPE H5T_STRING { - STRSIZE 50; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 50; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { (0): "This is row 0 of type H5T_STR_NULLTERM of string ", @@ -61,11 +61,11 @@ GROUP "/" { GROUP "g3" { DATASET "dset3" { DATATYPE H5T_STRING { - STRSIZE 50; - STRPAD H5T_STR_NULLPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 50; + STRPAD H5T_STR_NULLPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { (0): "This is row 0 of type H5T_STR_NULLPAD of\000\000\000\000\000\000\000\000\000\000", @@ -84,11 +84,11 @@ GROUP "/" { GROUP "g4" { DATASET "dset4" { DATATYPE H5T_STRING { - STRSIZE 50; - STRPAD H5T_STR_NULLPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 50; + STRPAD H5T_STR_NULLPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { (0): "This is row 0 of type H5T_STR_NULLPAD of string ar", @@ -107,11 +107,11 @@ GROUP "/" { GROUP "g5" { DATASET "dset5" { DATATYPE H5T_STRING { - STRSIZE 50; - STRPAD H5T_STR_SPACEPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 50; + STRPAD H5T_STR_SPACEPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { (0): "This is row 0 of type H5T_STR_SPACEPAD of ", @@ -130,11 +130,11 @@ GROUP "/" { GROUP "g6" { DATASET "dset6" { DATATYPE H5T_STRING { - STRSIZE 50; - STRPAD H5T_STR_SPACEPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 50; + STRPAD H5T_STR_SPACEPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 10 ) / ( 10 ) } DATA { (0): "This is row 0 of type H5T_STR_SPACEPAD of string a", diff --git a/tools/testfiles/tstr.h5.xml b/tools/testfiles/tstr.h5.xml index ac9e268..d7214fd 100644 --- a/tools/testfiles/tstr.h5.xml +++ b/tools/testfiles/tstr.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -49,186 +49,24 @@ - 0 1 4 9 16 25 36 49 64 81 - 1 4 9 16 25 36 49 64 81 100 - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 1 4 9 16 25 36 49 64 81 100 - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 - 121 144 169 196 225 256 289 324 361 400 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 - 121 144 169 196 225 256 289 324 361 400 - 144 169 196 225 256 289 324 361 400 441 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 0 1 4 9 16 25 36 49 64 81 - 1 4 9 16 25 36 49 64 81 100 - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 1 4 9 16 25 36 49 64 81 100 - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 - 121 144 169 196 225 256 289 324 361 400 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 - 121 144 169 196 225 256 289 324 361 400 - 144 169 196 225 256 289 324 361 400 441 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 0 1 4 9 16 25 36 49 64 81 - 1 4 9 16 25 36 49 64 81 100 - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 1 4 9 16 25 36 49 64 81 100 - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 4 9 16 25 36 49 64 81 100 121 - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 9 16 25 36 49 64 81 100 121 144 - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 16 25 36 49 64 81 100 121 144 169 - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 - 121 144 169 196 225 256 289 324 361 400 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - 25 36 49 64 81 100 121 144 169 196 - 36 49 64 81 100 121 144 169 196 225 - 49 64 81 100 121 144 169 196 225 256 - 64 81 100 121 144 169 196 225 256 289 - 81 100 121 144 169 196 225 256 289 324 - 100 121 144 169 196 225 256 289 324 361 - 121 144 169 196 225 256 289 324 361 400 - 144 169 196 225 256 289 324 361 400 441 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" - "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 0 1 4 9 16 25 36 49 64 81 1 4 9 16 25 36 49 64 81 100 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 1 4 9 16 25 36 49 64 81 100 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 121 144 169 196 225 256 289 324 361 400 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 121 144 169 196 225 256 289 324 361 400 144 169 196 225 256 289 324 361 400 441 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 0 1 4 9 16 25 36 49 64 81 1 4 9 16 25 36 49 64 81 100 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 1 4 9 16 25 36 49 64 81 100 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 121 144 169 196 225 256 289 324 361 400 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 121 144 169 196 225 256 289 324 361 400 144 169 196 225 256 289 324 361 400 441 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 0 1 4 9 16 25 36 49 64 81 1 4 9 16 25 36 49 64 81 100 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 1 4 9 16 25 36 49 64 81 100 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 4 9 16 25 36 49 64 81 100 121 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 9 16 25 36 49 64 81 100 121 144 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 16 25 36 49 64 81 100 121 144 169 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 121 144 169 196 225 256 289 324 361 400 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" + 25 36 49 64 81 100 121 144 169 196 36 49 64 81 100 121 144 169 196 225 49 64 81 100 121 144 169 196 225 256 64 81 100 121 144 169 196 225 256 289 81 100 121 144 169 196 225 256 289 324 100 121 144 169 196 225 256 289 324 361 121 144 169 196 225 256 289 324 361 400 144 169 196 225 256 289 324 361 400 441 "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" "abcdefgh12345678abcdefgh12345678" @@ -236,9 +74,9 @@ - + - + @@ -273,9 +111,9 @@ - + - + @@ -317,9 +155,9 @@ - + - + @@ -368,9 +206,9 @@ - + - + diff --git a/tools/testfiles/tstr2.h5.xml b/tools/testfiles/tstr2.h5.xml index 3f691aa..26758b3 100644 --- a/tools/testfiles/tstr2.h5.xml +++ b/tools/testfiles/tstr2.h5.xml @@ -6,9 +6,9 @@ - + - + @@ -61,9 +61,9 @@ - + - + @@ -97,9 +97,9 @@ - + - + @@ -133,9 +133,9 @@ - + - + @@ -169,9 +169,9 @@ - + - + @@ -205,9 +205,9 @@ - + - + diff --git a/tools/testfiles/tstring-at.h5.xml b/tools/testfiles/tstring-at.h5.xml index b2bc39d..1962610 100644 --- a/tools/testfiles/tstring-at.h5.xml +++ b/tools/testfiles/tstring-at.h5.xml @@ -5,9 +5,9 @@ - + - + diff --git a/tools/testfiles/tstring.ddl b/tools/testfiles/tstring.ddl index 3469de7..398bf33 100644 --- a/tools/testfiles/tstring.ddl +++ b/tools/testfiles/tstring.ddl @@ -2,11 +2,11 @@ HDF5 "tstr3.h5" { GROUP "/" { DATASET "str1" { DATATYPE H5T_STRING { - STRSIZE 73; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 73; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 1 ) / ( 1 ) } DATA { (0): "quote " backspace form feed new line @@ -16,11 +16,11 @@ GROUP "/" { } DATASET "str2" { DATATYPE H5T_STRING { - STRSIZE H5T_VARIABLE; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE H5T_VARIABLE; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4 ) / ( 4 ) } DATA { (0): "Four score and seven diff --git a/tools/testfiles/tstring.h5.xml b/tools/testfiles/tstring.h5.xml index 4f9d7b5..ebd0a3c 100644 --- a/tools/testfiles/tstring.h5.xml +++ b/tools/testfiles/tstring.h5.xml @@ -5,9 +5,9 @@ - + - + diff --git a/tools/testfiles/tstring2.ddl b/tools/testfiles/tstring2.ddl index 88996fd..cda2ed5 100644 --- a/tools/testfiles/tstring2.ddl +++ b/tools/testfiles/tstring2.ddl @@ -3,9 +3,9 @@ DATASET "str4" { DATATYPE H5T_STD_I8LE DATASPACE SIMPLE { ( 93 ) / ( 93 ) } DATA { - "Four score and seven + "Four score and seven years ago our forefathers brought fo" - "rth on this continent a new nation\000" + "rth on this continent a new nation\000" } } } diff --git a/tools/testfiles/tstringe.ddl b/tools/testfiles/tstringe.ddl index f7efcbf..d3f5181 100644 --- a/tools/testfiles/tstringe.ddl +++ b/tools/testfiles/tstringe.ddl @@ -2,11 +2,11 @@ HDF5 "tstr3.h5" { GROUP "/" { DATASET "str1" { DATATYPE H5T_STRING { - STRSIZE 73; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE 73; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 1 ) / ( 1 ) } DATA { (0): "quote \" backspace\b form feed\f new line\n tab\t new line\n carriage return\r" @@ -14,11 +14,11 @@ GROUP "/" { } DATASET "str2" { DATATYPE H5T_STRING { - STRSIZE H5T_VARIABLE; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE H5T_VARIABLE; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4 ) / ( 4 ) } DATA { (0): "Four score and seven\n years ago our forefathers brought forth on this continent a new nation,", diff --git a/tools/testfiles/tszip.ddl b/tools/testfiles/tszip.ddl index 08b714b..6fdd92f 100644 --- a/tools/testfiles/tszip.ddl +++ b/tools/testfiles/tszip.ddl @@ -5,7 +5,7 @@ DATASET "szip" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 372 (2.151:1 COMPRESSION) - } + } FILTERS { COMPRESSION SZIP { PIXELS_PER_BLOCK 4 @@ -17,7 +17,7 @@ DATASET "szip" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE 0 } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tuserfilter.ddl b/tools/testfiles/tuserfilter.ddl index 29660a7..07b478f 100644 --- a/tools/testfiles/tuserfilter.ddl +++ b/tools/testfiles/tuserfilter.ddl @@ -5,19 +5,20 @@ DATASET "myfilter" { STORAGE_LAYOUT { CHUNKED ( 10, 5 ) SIZE 800 - } + } FILTERS { UNKNOWN_FILTER { FILTER_ID 405 COMMENT myfilter PARAMS { 5 6 } } - FILLVALUE { - FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 - } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_INCR + } +} } diff --git a/tools/testfiles/tvldtypes1.h5.xml b/tools/testfiles/tvldtypes1.h5.xml index 3ccd3b4..9c519f0 100644 --- a/tools/testfiles/tvldtypes1.h5.xml +++ b/tools/testfiles/tvldtypes1.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -27,7 +27,10 @@ - 0 10 11 20 21 22 30 31 32 33 + 0 + 10 11 + 20 21 22 + 30 31 32 33 @@ -35,9 +38,9 @@ - + - + @@ -57,7 +60,10 @@ - 0 10 10.1 20 20.1 20.2 30 30.1 30.2 30.3 + 0 + 10 10.1 + 20 20.1 20.2 + 30 30.1 30.2 30.3 @@ -65,9 +71,9 @@ - + - + diff --git a/tools/testfiles/tvldtypes2.h5.xml b/tools/testfiles/tvldtypes2.h5.xml index e0b44f3..9cabfdf 100644 --- a/tools/testfiles/tvldtypes2.h5.xml +++ b/tools/testfiles/tvldtypes2.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -31,7 +31,9 @@ - 0 100 110 111 200 210 211 220 221 222 + 0 + 100 110 111 + 200 210 211 220 221 222 300 310 311 320 321 322 330 331 332 333 diff --git a/tools/testfiles/tvldtypes3.h5.xml b/tools/testfiles/tvldtypes3.h5.xml index 902de03..811d536 100644 --- a/tools/testfiles/tvldtypes3.h5.xml +++ b/tools/testfiles/tvldtypes3.h5.xml @@ -5,9 +5,9 @@ - + - + @@ -47,7 +47,10 @@ - 0 0 0 10 6.66667 10 11 20 13.3333 20 21 22 30 20 30 31 32 33 + 0 0 0 + 10 6.66667 10 11 + 20 13.3333 20 21 22 + 30 20 30 31 32 33 diff --git a/tools/testfiles/tvldtypes4.h5.xml b/tools/testfiles/tvldtypes4.h5.xml index 34cd2be..1d368ce 100644 --- a/tools/testfiles/tvldtypes4.h5.xml +++ b/tools/testfiles/tvldtypes4.h5.xml @@ -5,12 +5,12 @@ - + - - - - + + + + @@ -43,7 +43,9 @@ - 0 0 10 6.66667 11 7 20 13.3333 21 13.6667 22 14 + 0 0 + 10 6.66667 11 7 + 20 13.3333 21 13.6667 22 14 30 20 31 20.3333 32 20.6667 33 21 diff --git a/tools/testfiles/tvldtypes5.h5.xml b/tools/testfiles/tvldtypes5.h5.xml index d2d2bf6..d6ed774 100644 --- a/tools/testfiles/tvldtypes5.h5.xml +++ b/tools/testfiles/tvldtypes5.h5.xml @@ -5,12 +5,12 @@ - + - - - - + + + + @@ -30,7 +30,10 @@ - 0 2 4 6 8 0 2 4 6 8 10 12 + 0 2 4 6 8 + + 0 2 4 6 8 10 12 + diff --git a/tools/testfiles/tvlstr.ddl b/tools/testfiles/tvlstr.ddl index 2f1318c..dfce2eb 100644 --- a/tools/testfiles/tvlstr.ddl +++ b/tools/testfiles/tvlstr.ddl @@ -9,11 +9,11 @@ GROUP "/" { } DATASET "Dataset1" { DATATYPE H5T_STRING { - STRSIZE H5T_VARIABLE; - STRPAD H5T_STR_NULLTERM; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - } + STRSIZE H5T_VARIABLE; + STRPAD H5T_STR_NULLTERM; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + } DATASPACE SIMPLE { ( 4 ) / ( 4 ) } DATA { (0): "Four score and seven years ago our forefathers brought forth on this continent a new nation,", @@ -22,11 +22,10 @@ GROUP "/" { } } DATATYPE "vl_string_type" H5T_STRING { - STRSIZE H5T_VARIABLE; - STRPAD H5T_STR_NULLPAD; - CSET H5T_CSET_ASCII; - CTYPE H5T_C_S1; - }; - + STRSIZE H5T_VARIABLE; + STRPAD H5T_STR_NULLPAD; + CSET H5T_CSET_ASCII; + CTYPE H5T_C_S1; + }; } } diff --git a/tools/testfiles/tvlstr.h5.xml b/tools/testfiles/tvlstr.h5.xml index 697aad5..e5ec1f3 100644 --- a/tools/testfiles/tvlstr.h5.xml +++ b/tools/testfiles/tvlstr.h5.xml @@ -16,12 +16,12 @@ - + - - - - + + + + -- cgit v0.12