diff options
author | Jacob Gruber <gruber1@hdfgroup.org> | 2012-03-21 22:30:53 (GMT) |
---|---|---|
committer | Jacob Gruber <gruber1@hdfgroup.org> | 2012-03-21 22:30:53 (GMT) |
commit | 6321d6f37b9e6cfa8691d6d1f65dc96a098edb18 (patch) | |
tree | a81e1773694f88f3698deb2993d62370386db4dc /tools | |
parent | 1dfe7e0483a05d4065cc264f36eec54026d3c595 (diff) | |
parent | 0d118ea88a384bb18afa87a8ae068ceb99dc812c (diff) | |
download | hdf5-6321d6f37b9e6cfa8691d6d1f65dc96a098edb18.zip hdf5-6321d6f37b9e6cfa8691d6d1f65dc96a098edb18.tar.gz hdf5-6321d6f37b9e6cfa8691d6d1f65dc96a098edb18.tar.bz2 |
[svn-r22118] merged with r22116. Made some minor edits putting existing code in line with the RFC.
Diffstat (limited to 'tools')
84 files changed, 3572 insertions, 3720 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index fad517c..6cdfcac 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -5,7 +5,6 @@ PROJECT (HDF5_TOOLS) # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) -INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- # If testing was NOT enabled, then we need to build the tools library diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt index b0b9aa8..f9e7c12 100644 --- a/tools/h5copy/CMakeLists.txt +++ b/tools/h5copy/CMakeLists.txt @@ -5,7 +5,6 @@ PROJECT (HDF5_TOOLS_H5COPY) # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) -INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- # Add the h5copy and test executables @@ -27,7 +26,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 $<TARGET_FILE:h5copygentest>) 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 <stdlib.h> #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..dfd1800 100644 --- a/tools/h5diff/CMakeLists.txt +++ b/tools/h5diff/CMakeLists.txt @@ -5,7 +5,6 @@ PROJECT (HDF5_TOOLS_H5DIFF) # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) -INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- # Add the h5diff executables @@ -43,7 +42,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 $<TARGET_FILE:h5diffgentest>) @@ -131,11 +130,18 @@ IF (BUILD_TESTING) h5diff_458.txt h5diff_459.txt h5diff_465.txt + h5diff_466.txt + h5diff_467.txt + h5diff_468.txt + h5diff_469.txt h5diff_480.txt h5diff_481.txt h5diff_482.txt h5diff_483.txt h5diff_484.txt + h5diff_485.txt + h5diff_486.txt + h5diff_487.txt h5diff_50.txt h5diff_51.txt h5diff_52.txt @@ -250,6 +256,8 @@ IF (BUILD_TESTING) h5diff_exclude1-2.h5 h5diff_exclude2-1.h5 h5diff_exclude2-2.h5 + h5diff_exclude3-1.h5 + h5diff_exclude3-2.h5 h5diff_comp_vl_strs.h5 h5diff_attr_v_level1.h5 h5diff_attr_v_level2.h5 @@ -487,6 +495,9 @@ IF (BUILD_TESTING) # different structure and obj names SET (EXCLUDE_FILE2_1 h5diff_exclude2-1.h5) SET (EXCLUDE_FILE2_2 h5diff_exclude2-2.h5) + # Only one file contains unique objs. Common objs are same. + SET (EXCLUDE_FILE3_1 h5diff_exclude3-1.h5) + SET (EXCLUDE_FILE3_2 h5diff_exclude3-2.h5) # compound type with multiple vlen string types SET (COMP_VL_STRS_FILE h5diff_comp_vl_strs.h5) # container types (array,vlen) with multiple nested compound types @@ -658,6 +669,14 @@ IF (BUILD_TESTING) h5diff_459.out.err h5diff_465.out h5diff_465.out.err + h5diff_466.out + h5diff_466.out.err + h5diff_467.out + h5diff_467.out.err + h5diff_468.out + h5diff_468.out.err + h5diff_469.out + h5diff_469.out.err h5diff_480.out h5diff_480.out.err h5diff_481.out @@ -1267,7 +1286,16 @@ ADD_H5_TEST (h5diff_459 2 --follow-symlinks -v --no-dangling-links ${FILE15} $ # dangling link --follow-symlinks (obj vs obj) # (HDFFV-7836) -ADD_H5_TEST (h5diff_465 1 --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1) +ADD_H5_TEST (h5diff_465 0 --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1) +# (HDFFV-7835) +# soft dangling vs. soft dangling +ADD_H5_TEST (h5diff_466 0 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1) +# soft link vs. soft dangling +ADD_H5_TEST (h5diff_467 1 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link2) +# ext dangling vs. ext dangling +ADD_H5_TEST (h5diff_468 0 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4) +# ext link vs. ext dangling +ADD_H5_TEST (h5diff_469 1 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link2) # ############################################################################## # # test for group diff recursivly @@ -1339,6 +1367,16 @@ ADD_H5_TEST (h5diff_483 1 -v --exclude-path "/group1" ${EXCLUDE_FILE2_1} ${EXCLU # Exclude from group compare ADD_H5_TEST (h5diff_484 0 -v --exclude-path "/dset3" ${EXCLUDE_FILE1_1} ${EXCLUDE_FILE1_2} /group1) +# +# Only one file contains unique objs. Common objs are same. +# (HDFFV-7837) +# +ADD_H5_TEST (h5diff_485 0 -v --exclude-path "/group1" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5) +ADD_H5_TEST (h5diff_486 0 -v --exclude-path "/group1" h5diff_exclude3-2.h5 h5diff_exclude3-1.h5) +ADD_H5_TEST (h5diff_487 1 -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5) + + + # ############################################################################## # # diff various multiple vlen and fixed strings in a compound type dataset # ############################################################################## 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 <string.h> #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 <memory.h> #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 b29ed41..b57c98a 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -17,12 +17,18 @@ #include <stdlib.h> #include "hdf5.h" #include "H5private.h" -#include "h5tools.h" -#include "h5tools_utils.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 @@ -71,6 +77,9 @@ /* different structure and obj names */ #define EXCLUDE_FILE2_1 "h5diff_exclude2-1.h5" #define EXCLUDE_FILE2_2 "h5diff_exclude2-2.h5" +/* only one file has unique objs */ +#define EXCLUDE_FILE3_1 "h5diff_exclude3-1.h5" +#define EXCLUDE_FILE3_2 "h5diff_exclude3-2.h5" /* compound type with multiple vlen string types */ #define COMP_VL_STRS_FILE "h5diff_comp_vl_strs.h5" /* attribute compre with verbose level */ @@ -138,6 +147,7 @@ static int test_group_recurse(const char *fname1, const char *fname2); static int test_group_recurse2(void); static int test_exclude_obj1(const char *fname1, const char *fname2); static int test_exclude_obj2(const char *fname1, const char *fname2); +static int test_exclude_obj3(const char *fname1, const char *fname2); static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new); static int test_attributes_verbose_level(const char *fname1, const char *fname2); static int test_enums(const char *fname); @@ -207,6 +217,7 @@ int main(void) test_exclude_obj1(EXCLUDE_FILE1_1, EXCLUDE_FILE1_2); test_exclude_obj2(EXCLUDE_FILE2_1, EXCLUDE_FILE2_2); + test_exclude_obj3(EXCLUDE_FILE3_1, EXCLUDE_FILE3_2); /* diff various multiple vlen and fixlen string types in a compound dataset */ test_comp_vlen_strings(COMP_VL_STRS_FILE, "group", 1); @@ -3338,6 +3349,100 @@ out: /*------------------------------------------------------------------------- * +* Purpose: Create test files for excluding obj. +* Only one file contains unique objs. Common objs are same. +* Test : exclude unique objs to verify the rest are same +* - HDFFV-7837 +* +* Programmer: Jonathan Kim (Mar, 19, 2012) +* +*-------------------------------------------------------------------------*/ +static int test_exclude_obj3(const char *fname1, const char *fname2) +{ + hid_t fid1=0; + hid_t fid2=0; + hid_t gid1=0; + hsize_t dims2[2] = {2,4}; + int data1[4][2] = {{0,0},{0,0},{0,0},{0,0}}; + herr_t status = SUCCEED; + + /*----------------------------------------------------------------------- + * Create file(s) + *------------------------------------------------------------------------*/ + fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + status = FAIL; + goto out; + } + + fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid2 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + status = FAIL; + goto out; + } + + + /*----------------------------------------------------------------------- + * Group + *------------------------------------------------------------------------*/ + /* file1 */ + gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid1 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Datasets + *------------------------------------------------------------------------*/ + /* file1 */ + status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + status = FAIL; + goto out; + } + + status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + status = FAIL; + goto out; + } + + /* file2 */ + status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + status = FAIL; + goto out; + } + +out: + /*----------------------------------------------------------------------- + * Close + *-----------------------------------------------------------------------*/ + if(fid1) + H5Fclose(fid1); + if(fid2) + H5Fclose(fid2); + if(gid1) + H5Gclose(gid1); + + return status; +} + +/*------------------------------------------------------------------------- +* * Purpose: Create test files for multiple variable length string/string array * along with fixed length string/string array types in * a compound type dataset. @@ -4711,7 +4816,6 @@ static void test_non_comparables (const char * fname, int make_diffs) int rank_attr; char data1_str[DIM_ARRY][STR_SIZE]= {"ab","cd","ef"}; herr_t status = SUCCEED; - int i; void *dset_data_ptr1=NULL; void *dset_data_ptr2=NULL; void *dset_data_ptr3=NULL; 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 <string.h> #include <assert.h> #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/h5diff/testfiles/h5diff_465.txt b/tools/h5diff/testfiles/h5diff_465.txt index 827e88e..eca5994 100644 --- a/tools/h5diff/testfiles/h5diff_465.txt +++ b/tools/h5diff/testfiles/h5diff_465.txt @@ -1,2 +1 @@ -1 differences found -EXIT CODE: 1 +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_485.txt b/tools/h5diff/testfiles/h5diff_485.txt new file mode 100644 index 0000000..4175809 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_485.txt @@ -0,0 +1,11 @@ + +file1 file2 +--------------------------------------- + x x / + x x /dset1 + +group : </> and </> +0 differences found +dataset: </dset1> and </dset1> +0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_486.txt b/tools/h5diff/testfiles/h5diff_486.txt new file mode 100644 index 0000000..4175809 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_486.txt @@ -0,0 +1,11 @@ + +file1 file2 +--------------------------------------- + x x / + x x /dset1 + +group : </> and </> +0 differences found +dataset: </dset1> and </dset1> +0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_487.txt b/tools/h5diff/testfiles/h5diff_487.txt new file mode 100644 index 0000000..8555a71 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_487.txt @@ -0,0 +1,12 @@ + +file1 file2 +--------------------------------------- + x x / + x x /dset1 + x /group1 + +group : </> and </> +0 differences found +dataset: </dset1> and </dset1> +0 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_exclude3-1.h5 b/tools/h5diff/testfiles/h5diff_exclude3-1.h5 Binary files differnew file mode 100644 index 0000000..f9cc83d --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_exclude3-1.h5 diff --git a/tools/h5diff/testfiles/h5diff_exclude3-2.h5 b/tools/h5diff/testfiles/h5diff_exclude3-2.h5 Binary files differnew file mode 100644 index 0000000..f811905 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_exclude3-2.h5 diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index aa0f502..27fb253 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -111,6 +111,8 @@ $SRC_H5DIFF_TESTFILES/h5diff_exclude1-1.h5 $SRC_H5DIFF_TESTFILES/h5diff_exclude1-2.h5 $SRC_H5DIFF_TESTFILES/h5diff_exclude2-1.h5 $SRC_H5DIFF_TESTFILES/h5diff_exclude2-2.h5 +$SRC_H5DIFF_TESTFILES/h5diff_exclude3-1.h5 +$SRC_H5DIFF_TESTFILES/h5diff_exclude3-2.h5 $SRC_H5DIFF_TESTFILES/h5diff_comp_vl_strs.h5 $SRC_H5DIFF_TESTFILES/compounds_array_vlen1.h5 $SRC_H5DIFF_TESTFILES/compounds_array_vlen2.h5 @@ -201,6 +203,10 @@ $SRC_H5DIFF_TESTFILES/h5diff_457.txt $SRC_H5DIFF_TESTFILES/h5diff_458.txt $SRC_H5DIFF_TESTFILES/h5diff_459.txt $SRC_H5DIFF_TESTFILES/h5diff_465.txt +$SRC_H5DIFF_TESTFILES/h5diff_466.txt +$SRC_H5DIFF_TESTFILES/h5diff_467.txt +$SRC_H5DIFF_TESTFILES/h5diff_468.txt +$SRC_H5DIFF_TESTFILES/h5diff_469.txt $SRC_H5DIFF_TESTFILES/h5diff_480.txt $SRC_H5DIFF_TESTFILES/h5diff_481.txt $SRC_H5DIFF_TESTFILES/h5diff_482.txt @@ -943,6 +949,15 @@ TOOLTEST h5diff_459.txt --follow-symlinks -v --no-dangling-links h5diff_extlin # dangling link --follow-symlinks (obj vs obj) # (HDFFV-7836) TOOLTEST h5diff_465.txt --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1 +# (HDFFV-7835) +# soft dangling vs. soft dangling +TOOLTEST h5diff_466.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1 +# soft link vs. soft dangling +TOOLTEST h5diff_467.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link2 +# ext dangling vs. ext dangling +TOOLTEST h5diff_468.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4 +# ext link vs. ext dangling +TOOLTEST h5diff_469.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link2 # ############################################################################## # # test for group diff recursivly @@ -1014,6 +1029,15 @@ TOOLTEST h5diff_483.txt -v --exclude-path "/group1" h5diff_exclude2-1.h5 h5diff_ # Exclude from group compare TOOLTEST h5diff_484.txt -v --exclude-path "/dset3" h5diff_exclude1-1.h5 h5diff_exclude1-2.h5 /group1 +# +# Only one file contains unique objs. Common objs are same. +# (HDFFV-7837) +# +TOOLTEST h5diff_485.txt -v --exclude-path "/group1" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5 +TOOLTEST h5diff_486.txt -v --exclude-path "/group1" h5diff_exclude3-2.h5 h5diff_exclude3-1.h5 +TOOLTEST h5diff_487.txt -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5 + + # ############################################################################## # # diff various multiple vlen and fixed strings in a compound type dataset # ############################################################################## diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index 652fe83..a6e452d 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -5,7 +5,6 @@ PROJECT (HDF5_TOOLS_H5DUMP) # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) -INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- # Add the h5dump executables @@ -128,10 +127,12 @@ IF (BUILD_TESTING) tlonglinks.ddl tloop-1.ddl tmulti.ddl + tmultifile.ddl +# tqmarkfile.ddl +# tstarfile.ddl tnamed_dtype_attr.ddl tnestcomp-1.ddl tnbit.ddl - tnofilename.ddl tno-subset.ddl tnullspace.ddl zerodim.ddl @@ -151,6 +152,7 @@ IF (BUILD_TESTING) tshuffle.ddl tslink-1.ddl tslink-2.ddl + tslink-D.ddl tsplit_file.ddl tstr-1.ddl tstr-2.ddl @@ -832,14 +834,18 @@ IF (BUILD_TESTING) tloop-1.out.err tmulti.out tmulti.out.err + tmultifile.out + tmultifile.out.err +# tqmarkfile.out +# tqmarkfile.out.err +# tstarfile.out +# tstarfile.out.err tnamed_dtype_attr.out tnamed_dtype_attr.out.err tnestcomp-1.out tnestcomp-1.out.err tnbit.out tnbit.out.err - tnofilename.out - tnofilename.out.err tno-subset.out tno-subset.out.err tnullspace.out @@ -878,6 +884,8 @@ IF (BUILD_TESTING) tslink-1.out.err tslink-2.out tslink-2.out.err + tslink-D.out + tslink-D.out.err tsplit_file.out tsplit_file.out.err tstr-1.out @@ -926,19 +934,21 @@ IF (BUILD_TESTING) # test for displaying groups ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5) # test for displaying the selected groups + # JIRA HDFFV-7936 ADD_H5_MASK_TEST (tgroup-2 1 --enable-error-stack --group=/g2 --group / -g /y tgroup.h5) + # cannot use TEST_MASK_ERROR and --enable-error-stack on this test because group names are similar to version numbers 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 --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) + ADD_H5_MASK_TEST (tdset-2 1 --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5) # test for displaying attributes 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 --enable-error-stack -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) + ADD_H5_MASK_TEST (tattr-3 1 --enable-error-stack --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 --enable-error-stack tnamed_dtype_attr.h5) # test for displaying at least 9 attributes on root from a be machine @@ -950,6 +960,8 @@ IF (BUILD_TESTING) # test for displaying the selected link 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) + # test for displaying dangling soft links + ADD_H5_MASK_TEST (tslink-D 0 --enable-error-stack -d /slink1 tslink.h5) # tests for hard links ADD_H5_TEST (thlink-1 0 --enable-error-stack thlink.h5) @@ -972,7 +984,8 @@ IF (BUILD_TESTING) 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) + # JIRA HDFFV-7936 ADD_H5_MASK_TEST (tall-1 0 --enable-error-stack tall.h5) + # cannot use TEST_MASK_ERROR and --enable-error-stack on this test because group/dataset names are similar to version numbers ADD_H5_TEST (tall-1 0 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) @@ -1010,6 +1023,11 @@ IF (BUILD_TESTING) ADD_H5_TEST (tarray7 0 --enable-error-stack tarray7.h5) ADD_H5_TEST (tarray8 0 --enable-error-stack tarray8.h5) + # test for wildcards in filename (does not work with cmake) + #ADD_H5_MASK_TEST (tstarfile 0 --enable-error-stack -H -d Dataset1 tarr*.h5) + #ADD_H5_MASK_TEST (tqmarkfile 0 --enable-error-stack -H -d Dataset1 tarray?.h5) + ADD_H5_TEST (tmultifile 0 --enable-error-stack -H -d Dataset1 tarray2.h5 tarray3.h5 tarray4.h5 tarray5.h5 tarray6.h5 tarray7.h5) + # test for files with empty data ADD_H5_TEST (tempty 0 --enable-error-stack tempty.h5) @@ -1025,7 +1043,8 @@ IF (BUILD_TESTING) 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) + # JIRA HDFFV-7936 ADD_H5_MASK_TEST (tall-2A 0 --enable-error-stack -A tall.h5) + # cannot use TEST_MASK_ERROR and --enable-error-stack on this test because group/dataset names are similar to version numbers ADD_H5_TEST (tall-2A 0 -A tall.h5) # test '-r' to print attributes in ASCII instead of decimal @@ -1048,7 +1067,7 @@ IF (BUILD_TESTING) ADD_H5_TEST (file_space 0 --enable-error-stack -B file_space.h5) # test -p with a non existing dataset - ADD_H5_TEST (tperror 1 -p -d bogus tfcontents1.h5) + ADD_H5_MASK_TEST (tperror 1 --enable-error-stack -p -d bogus tfcontents1.h5) # test for file contents ADD_H5_TEST (tcontents 0 --enable-error-stack -n tfcontents1.h5) @@ -1093,10 +1112,10 @@ IF (BUILD_TESTING) 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) - ADD_H5_TEST (texceedsubcount 1 -d 1d -c 1,3 taindices.h5) - ADD_H5_TEST (texceedsubstride 1 -d 1d -S 1,3 taindices.h5) - ADD_H5_TEST (texceedsubblock 1 -d 1d -k 1,3 taindices.h5) + ADD_H5_TEST (texceedsubstart 1 --enable-error-stack -d 1d -s 1,3 taindices.h5) + ADD_H5_TEST (texceedsubcount 1 --enable-error-stack -d 1d -c 1,3 taindices.h5) + ADD_H5_TEST (texceedsubstride 1 --enable-error-stack -d 1d -S 1,3 taindices.h5) + ADD_H5_TEST (texceedsubblock 1 --enable-error-stack -d 1d -k 1,3 taindices.h5) # tests for filters # SZIP @@ -1104,49 +1123,49 @@ IF (BUILD_TESTING) IF (NOT USE_FILTER_SZIP) SET (TESTTYPE "SKIP") ENDIF (NOT USE_FILTER_SZIP) - ADD_SKIP_H5_TEST (tszip 0 ${TESTTYPE} -H -p -d szip tfilters.h5) + ADD_SKIP_H5_TEST (tszip 0 ${TESTTYPE} --enable-error-stack -H -p -d szip tfilters.h5) # deflate SET (TESTTYPE "TEST") IF (NOT USE_FILTER_DEFLATE) SET (TESTTYPE "SKIP") ENDIF (NOT USE_FILTER_DEFLATE) - ADD_SKIP_H5_TEST (tdeflate 0 ${TESTTYPE} -H -p -d deflate tfilters.h5) + ADD_SKIP_H5_TEST (tdeflate 0 ${TESTTYPE} --enable-error-stack -H -p -d deflate tfilters.h5) # shuffle SET (TESTTYPE "TEST") IF (NOT USE_FILTER_SHUFFLE) SET (TESTTYPE "SKIP") ENDIF (NOT USE_FILTER_SHUFFLE) - ADD_SKIP_H5_TEST (tshuffle 0 ${TESTTYPE} -H -p -d shuffle tfilters.h5) + ADD_SKIP_H5_TEST (tshuffle 0 ${TESTTYPE} --enable-error-stack -H -p -d shuffle tfilters.h5) # fletcher32 SET (TESTTYPE "TEST") IF (NOT USE_FILTER_FLETCHER32) SET (TESTTYPE "SKIP") ENDIF (NOT USE_FILTER_FLETCHER32) - ADD_SKIP_H5_TEST (tfletcher32 0 ${TESTTYPE} -H -p -d fletcher32 tfilters.h5) + ADD_SKIP_H5_TEST (tfletcher32 0 ${TESTTYPE} --enable-error-stack -H -p -d fletcher32 tfilters.h5) # nbit SET (TESTTYPE "TEST") IF (NOT USE_FILTER_NBIT) SET (TESTTYPE "SKIP") ENDIF (NOT USE_FILTER_NBIT) - ADD_SKIP_H5_TEST (tnbit 0 ${TESTTYPE} -H -p -d nbit tfilters.h5) + ADD_SKIP_H5_TEST (tnbit 0 ${TESTTYPE} --enable-error-stack -H -p -d nbit tfilters.h5) # scaleoffset SET (TESTTYPE "TEST") IF (NOT USE_FILTER_SCALEOFFSET) SET (TESTTYPE "SKIP") ENDIF (NOT USE_FILTER_SCALEOFFSET) - ADD_SKIP_H5_TEST (tscaleoffset 0 ${TESTTYPE} -H -p -d scaleoffset tfilters.h5) + ADD_SKIP_H5_TEST (tscaleoffset 0 ${TESTTYPE} --enable-error-stack -H -p -d scaleoffset tfilters.h5) # all SET (TESTTYPE "TEST") IF (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET) SET (TESTTYPE "SKIP") ENDIF (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET) - ADD_SKIP_H5_TEST (tallfilters 0 ${TESTTYPE} -H -p -d all tfilters.h5) + ADD_SKIP_H5_TEST (tallfilters 0 ${TESTTYPE} --enable-error-stack -H -p -d all tfilters.h5) # user defined ADD_H5_TEST (tuserfilter 0 --enable-error-stack -H -p -d myfilter tfilters.h5) @@ -1282,8 +1301,7 @@ IF (BUILD_TESTING) 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) + ADD_H5_MASK_TEST (textlink 0 --enable-error-stack textlink.h5) # test for error stack display (BZ2048) ADD_H5_MASK_TEST (filter_fail 1 --enable-error-stack filter_fail.h5) @@ -1413,7 +1431,7 @@ IF (BUILD_TESTING) # test failure handling # Missing file name - ADD_H5_TEST (tnofilename-with-packed-bits 1) + ADD_H5_TEST (tnofilename-with-packed-bits 1 --enable-error-stack) # Limits: # Maximum number of packed bits is 8 (for now). # Maximum integer size is 8*sizeof(long long). @@ -1472,23 +1490,23 @@ IF (BUILD_TESTING) 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) + ADD_H5_TEST (tpbitsMaxExceeded 1 --enable-error-stack -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 (tpbitsOffsetExceeded 1 --enable-error-stack -d /DS08BITS -M 64,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) + ADD_H5_TEST (tpbitsOffsetNegative 1 --enable-error-stack -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) + ADD_H5_TEST (tpbitsLengthPositive 1 --enable-error-stack -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 (tpbitsLengthExceeded 1 --enable-error-stack -d /DS08BITS -M 37,28 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) + ADD_H5_TEST (tpbitsIncomplete 1 --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5) IF (HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 09dead0..2799d95 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -210,7 +210,7 @@ leave(int ret) { h5tools_close(); - exit(ret); + HDexit(ret); } @@ -230,35 +230,38 @@ 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, + HDfflush(rawoutstream); + HDfprintf(rawoutstream, "usage: %s [OPTIONS] files\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, " If an attribute name contains a slash (/), escape the\n"); + HDfprintf(rawoutstream, " slash with a preceding backslash (\\).\n"); + HDfprintf(rawoutstream, " (See example section below.)\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" @@ -266,69 +269,77 @@ usage(const char *prog) " 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, " --no-compact-subset Disable compact form of subsetting and allow the use\n"); - fprintf(stdout, " of \"[\" in datset names.\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"); + 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, " Attribute \"high/low\" of the group /bar_none in the file quux.h5\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " h5dump -a \"/bar_none/high\\/low\" 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"); + HDfprintf(rawoutstream, " 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " h5dump -d /foo multi1.h5 multi2.h5 multi3.h5\n"); + HDfprintf(rawoutstream, "\n"); } @@ -454,9 +465,8 @@ table_list_free(void) table_list.nalloc = table_list.nused = 0; } /* end table_list_free() */ - /*------------------------------------------------------------------------- - * Function: set_output_file + * Function: set_data_output_file * * Purpose: Open fname as the output file for dataset raw data. * Set rawdatastream as its file stream. @@ -472,27 +482,27 @@ table_list_free(void) *------------------------------------------------------------------------- */ static int -set_output_file(const char *fname, int is_bin) +set_data_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"); + if (HDfclose(rawdatastream)) + HDperror("closing rawdatastream"); else rawdatastream = NULL; } /* binary output */ if (is_bin) { - if ((f = fopen(fname, "wb")) != NULL) { + if ((f = HDfopen(fname, "wb")) != NULL) { rawdatastream = f; return 0; } } else { - if ((f = fopen(fname, "w")) != NULL) { + if ((f = HDfopen(fname, "w")) != NULL) { rawdatastream = f; return 0; } @@ -502,6 +512,70 @@ set_output_file(const char *fname, int is_bin) } /*------------------------------------------------------------------------- + * Function: set_output_file + * + * Purpose: Open fname as the output file for raw output. + * Set rawoutstream as its file stream. + * + * Return: 0 -- succeeded + * negative -- failed + * + *------------------------------------------------------------------------- + */ +static int +set_output_file(const char *fname) +{ + FILE *f; /* temporary holding place for the stream pointer + * so that rawoutstream is changed only when succeeded */ + + if (rawoutstream && rawoutstream != stdout) { + if (HDfclose(rawoutstream)) + HDperror("closing rawoutstream"); + else + rawoutstream = NULL; + } + + if ((f = HDfopen(fname, "w")) != NULL) { + rawoutstream = f; + return 0; + } + + return -1; +} + +/*------------------------------------------------------------------------- + * Function: set_error_file + * + * Purpose: Open fname as the error output file for dataset raw error. + * Set rawerrorstream as its file stream. + * + * Return: 0 -- succeeded + * negative -- failed + * + *------------------------------------------------------------------------- + */ +static int +set_error_file(const char *fname) +{ + FILE *f; /* temporary holding place for the stream pointer + * so that rawerrorstream is changed only when succeeded */ + + if (rawerrorstream && rawerrorstream != stderr) { + if (HDfclose(rawerrorstream)) + HDperror("closing rawerrorstream"); + else + rawerrorstream = NULL; + } + + if ((f = HDfopen(fname, "w")) != NULL) { + rawerrorstream = f; + return 0; + } + + return -1; +} + +/*------------------------------------------------------------------------- * Function: set_binary_form * * Purpose: set the binary form of output by translating from a string input @@ -521,15 +595,15 @@ set_binary_form(const char *form) { int bform = -1; - if (strcmp(form,"NATIVE") == 0 || strcmp(form,"MEMORY") == 0) { + if (HDstrcmp(form,"NATIVE") == 0 || HDstrcmp(form,"MEMORY") == 0) { /* native form */ bform = 0; } - else if (strcmp(form,"FILE") == 0) /* file type form */ + else if (HDstrcmp(form,"FILE") == 0) /* file type form */ bform = 1; - else if (strcmp(form,"LE") == 0) /* convert to little endian */ + else if (HDstrcmp(form,"LE") == 0) /* convert to little endian */ bform = 2; - else if (strcmp(form,"BE") == 0) /* convert to big endian */ + else if (HDstrcmp(form,"BE") == 0) /* convert to big endian */ bform = 3; return bform; @@ -556,9 +630,9 @@ set_sort_by(const char *form) { H5_index_t idx_type = H5_INDEX_UNKNOWN; - if (strcmp(form,"name")==0) /* H5_INDEX_NAME */ + if (HDstrcmp(form,"name")==0) /* H5_INDEX_NAME */ idx_type = H5_INDEX_NAME; - else if (strcmp(form,"creation_order")==0) /* H5_INDEX_CRT_ORDER */ + else if (HDstrcmp(form,"creation_order")==0) /* H5_INDEX_CRT_ORDER */ idx_type = H5_INDEX_CRT_ORDER; return idx_type; @@ -585,9 +659,9 @@ set_sort_order(const char *form) { H5_iter_order_t iter_order = H5_ITER_UNKNOWN; - if (strcmp(form,"ascending")==0) /* H5_ITER_INC */ + if (HDstrcmp(form,"ascending")==0) /* H5_ITER_INC */ iter_order = H5_ITER_INC; - else if (strcmp(form,"descending")==0) /* H5_ITER_DEC */ + else if (HDstrcmp(form,"descending")==0) /* H5_ITER_DEC */ iter_order = H5_ITER_DEC; return iter_order; @@ -626,7 +700,7 @@ parse_hsize_list(const char *h_list, subset_d *d) /* count how many integers do we have */ for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) - if (isdigit(*ptr)) { + if (HDisdigit(*ptr)) { if (!last_digit) /* the last read character wasn't a digit */ size_count++; @@ -642,14 +716,14 @@ parse_hsize_list(const char *h_list, subset_d *d) return; /* allocate an array for the integers in the list */ - p_list = (hsize_t *)calloc(size_count, sizeof(hsize_t)); + p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t)); for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) - if(isdigit(*ptr)) { + if(HDisdigit(*ptr)) { /* we should have an integer now */ - p_list[i++] = (hsize_t)atof(ptr); + p_list[i++] = (hsize_t)HDatof(ptr); - while (isdigit(*ptr)) + while (HDisdigit(*ptr)) /* scroll to end of integer */ ptr++; } @@ -681,10 +755,10 @@ parse_subset_params(char *dset) struct subset_t *s = NULL; register char *brace; - if (!disable_compact_subset && ((brace = strrchr(dset, '[')) != NULL)) { + if (!disable_compact_subset && ((brace = HDstrrchr(dset, '[')) != NULL)) { *brace++ = '\0'; - s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); + s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t)); parse_hsize_list(brace, &s->start); while (*brace && *brace != ';') @@ -906,7 +980,7 @@ parse_command_line(int argc, const char *argv[]) } /* this will be plenty big enough to hold the 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) { goto error; } @@ -1031,13 +1105,13 @@ parse_start: case 'o': if ( bin_output ) { - if (set_output_file(opt_arg, 1) < 0) { + if (set_data_output_file(opt_arg, 1) < 0) { usage(h5tools_getprogname()); goto error; } } else { - if (set_output_file(opt_arg, 0) < 0) { + if (set_data_output_file(opt_arg, 0) < 0) { usage(h5tools_getprogname()); goto error; } @@ -1058,7 +1132,7 @@ parse_start: } bin_output = TRUE; if (outfname!=NULL) { - if (set_output_file(outfname, 1) < 0) { + if (set_data_output_file(outfname, 1) < 0) { /* failed to set output file */ usage(h5tools_getprogname()); goto error; @@ -1133,7 +1207,7 @@ parse_start: usage(h5tools_getprogname()); goto error; } - if (strcmp(opt_arg,":") == 0) { + if (HDstrcmp(opt_arg,":") == 0) { xmlnsprefix = ""; } else { @@ -1163,7 +1237,7 @@ parse_start: s = last_dset->subset_info; } else { - last_dset->subset_info = s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); + last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t)); } /* @@ -1306,11 +1380,13 @@ main(int argc, const char *argv[]) hid_t fid = -1; hid_t gid = -1; H5E_auto2_t func; + H5E_auto2_t tools_func; H5O_info_t oi; - struct handler_t *hand; + struct handler_t *hand = NULL; int i; unsigned u; void *edata; + void *tools_edata; char *fname = NULL; h5tools_setprogname(PROGRAMNAME); @@ -1325,6 +1401,10 @@ main(int argc, const char *argv[]) /* Initialize h5tools lib */ h5tools_init(); + /* Disable tools error reporting */ + H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); + H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); + if((hand = parse_command_line(argc, argv))==NULL) { goto done; } @@ -1335,8 +1415,10 @@ main(int argc, const char *argv[]) goto done; } - if (enable_error_stack) + if (enable_error_stack) { H5Eset_auto2(H5E_DEFAULT, func, edata); + H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata); + } /* Check for conflicting options */ if (doxml) { @@ -1379,169 +1461,186 @@ main(int argc, const char *argv[]) h5tools_setstatus(EXIT_FAILURE); goto done; } - fname = HDstrdup(argv[opt_ind]); - - fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0); + while(opt_ind < argc) { + fname = HDstrdup(argv[opt_ind++]); - if (fid < 0) { - error_msg("unable to open file \"%s\"\n", fname); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } + fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0); - /* allocate and initialize internal data structure */ - init_prefix(&prefix, prefix_len); + if (fid < 0) { + error_msg("unable to open file \"%s\"\n", fname); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } - /* Prepare to find objects that might be targets of a reference */ - fill_ref_path_table(fid); + /* allocate and initialize internal data structure */ + init_prefix(&prefix, prefix_len); - if(doxml) { - /* initialize XML */ - /* reset prefix! */ - HDstrcpy(prefix, ""); + /* Prepare to find objects that might be targets of a reference */ + fill_ref_path_table(fid); - /* make sure the URI is initialized to something */ - if (xml_dtd_uri == NULL) { - if (useschema) { - xml_dtd_uri = DEFAULT_XSD; + 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 { - 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; + if (useschema && HDstrcmp(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 */ + /* 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; + } - /* start to dump - display file header information */ - if (!doxml) { - begin_obj(h5tools_dump_header_format->filebegin, fname, h5tools_dump_header_format->fileblockbegin); - } - else { - HDfprintf(stdout, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); + /* 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(h5tools_dump_header_format->filebegin, fname, h5tools_dump_header_format->fileblockbegin); + } + else { + HDfprintf(rawoutstream, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); - /* alternative first element, depending on schema or DTD. */ - if (useschema) { - if (strcmp(xmlnsprefix,"") == 0) { - HDfprintf(stdout, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n", - xml_dtd_uri); + /* alternative first element, depending on schema or DTD. */ + if (useschema) { + if (HDstrcmp(xmlnsprefix,"") == 0) { + HDfprintf(rawoutstream, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\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 = HDstrrchr(ns,(int)':'); + if (indx) *indx = '\0'; + + 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); + } } 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); + HDfprintf(rawoutstream, "<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n", xml_dtd_uri); + HDfprintf(rawoutstream, "<HDF5-File>\n"); } - } - else { - HDfprintf(stdout, "<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n", xml_dtd_uri); - HDfprintf(stdout, "<HDF5-File>\n"); } - } - if (!doxml) { - if (display_fi) { - HDfprintf(stdout, "\n"); - dump_fcontents(fid); - end_obj(h5tools_dump_header_format->fileend,h5tools_dump_header_format->fileblockend); - HDfprintf(stdout, "\n"); - goto done; + 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 (display_bb) + dump_fcpl(fid); } - 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 { + if (!doxml) + dump_indent += COL; + dump_function_table->dump_group_function(gid, "/" ); + if (!doxml) + dump_indent -= COL; + HDfprintf(rawoutstream, "\n"); + } + + if(H5Gclose(gid) < 0) { + error_msg("unable to close root group\n"); + h5tools_setstatus(EXIT_FAILURE); + } - if(display_all) { - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) { - error_msg("unable to open root group\n"); - h5tools_setstatus(EXIT_FAILURE); } else { - if (!doxml) - dump_indent += COL; - dump_function_table->dump_group_function(gid, "/" ); - if (!doxml) - dump_indent -= COL; - HDfprintf(stdout, "\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 */ + + for(i = 0; i < argc; i++) { + if(hand[i].func) { + hand[i].func(fid, hand[i].obj, hand[i].subset_info, 1, NULL); + } + } + HDfprintf(rawoutstream, "\n"); } - if(H5Gclose(gid) < 0) { - error_msg("unable to close root group\n"); - h5tools_setstatus(EXIT_FAILURE); + if (!doxml) { + end_obj(h5tools_dump_header_format->fileend, h5tools_dump_header_format->fileblockend); + HDfprintf(rawoutstream, "\n"); + } + else { + HDfprintf(rawoutstream, "</%sHDF5-File>\n", xmlnsprefix); } + /* Free tables for objects */ + table_list_free(); - } - 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 */ + if(fid >=0) + if (H5Fclose(fid) < 0) + h5tools_setstatus(EXIT_FAILURE); - for(i = 0; i < argc; i++) { - if(hand[i].func) { - hand[i].func(fid, hand[i].obj, hand[i].subset_info, 1, NULL); - } - } - HDfprintf(stdout, "\n"); - } + if(prefix) + HDfree(prefix); + if(fname) + HDfree(fname); + } /* end while */ - if (!doxml) { - end_obj(h5tools_dump_header_format->fileend, h5tools_dump_header_format->fileblockend); - HDfprintf(stdout, "\n"); - } - else { - HDfprintf(stdout, "</%sHDF5-File>\n", xmlnsprefix); - } + if(hand) + free_handler(hand, argc); + + /* To Do: clean up XML table */ + + leave(h5tools_getstatus()); 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); @@ -1551,6 +1650,9 @@ done: if(fname) HDfree(fname); + if(hand) + free_handler(hand, argc); + /* To Do: clean up XML table */ H5Eset_auto2(H5E_DEFAULT, func, edata); diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index c9e5571..b8deaf9 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -49,7 +49,7 @@ dump_datatype(hid_t type) ctx.cur_column = dump_indent; h5dump_type_table = type_table; - h5tools_dump_datatype(stdout, outputformat, &ctx, type); + h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type); h5dump_type_table = NULL; } @@ -77,7 +77,7 @@ dump_dataspace(hid_t space) ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - h5tools_dump_dataspace(stdout, outputformat, &ctx, space); + h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space); } @@ -134,7 +134,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t UNUSED *info, vo outputformat = &string_dataformat; h5dump_type_table = type_table; - h5tools_dump_attribute(stdout, outputformat, &ctx, oid, attr_name, attr_id, display_ai, display_char); + h5tools_dump_attribute(rawoutstream, outputformat, &ctx, oid, attr_name, attr_id, display_ai, display_char); h5dump_type_table = NULL; if(attr_id < 0) { @@ -264,30 +264,30 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); - if(strlen(h5tools_dump_header_format->datasetblockend)) { + if(HDstrlen(h5tools_dump_header_format->datasetblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend); - if(strlen(h5tools_dump_header_format->datasetend)) + if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, " "); } - if(strlen(h5tools_dump_header_format->datasetend)) + if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; @@ -298,14 +298,14 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } else if(found_obj->displayed) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; @@ -314,23 +314,23 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); - if(strlen(h5tools_dump_header_format->datasetblockend)) { + if(HDstrlen(h5tools_dump_header_format->datasetblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend); - if(strlen(h5tools_dump_header_format->datasetend)) + if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, " "); } - if(strlen(h5tools_dump_header_format->datasetend)) + if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); H5Dclose(obj); goto done; @@ -383,7 +383,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->softlinkbegin, name, h5tools_dump_header_format->softlinkblockbegin); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; @@ -396,29 +396,29 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED /* print the value of a soft link */ /* Standard DDL: no modification */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); - if(strlen(h5tools_dump_header_format->softlinkblockend)) { + if(HDstrlen(h5tools_dump_header_format->softlinkblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkblockend); - if(strlen(h5tools_dump_header_format->softlinkend)) + if(HDstrlen(h5tools_dump_header_format->softlinkend)) h5tools_str_append(&buffer, " "); } - if(strlen(h5tools_dump_header_format->softlinkend)) + if(HDstrlen(h5tools_dump_header_format->softlinkend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); HDfree(targbuf); break; @@ -428,14 +428,14 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED HDassert(targbuf); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -457,20 +457,20 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); /* dump the external link */ dump_extlink(group, name, targname); @@ -478,56 +478,56 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } /* end else */ } /* end else */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); - if(strlen(h5tools_dump_header_format->extlinkblockend)) { + if(HDstrlen(h5tools_dump_header_format->extlinkblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkblockend); - if(strlen(h5tools_dump_header_format->extlinkend)) + if(HDstrlen(h5tools_dump_header_format->extlinkend)) h5tools_str_append(&buffer, " "); } - if(strlen(h5tools_dump_header_format->extlinkend)) + if(HDstrlen(h5tools_dump_header_format->extlinkend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); - if(strlen(h5tools_dump_header_format->udlinkblockend)) { + if(HDstrlen(h5tools_dump_header_format->udlinkblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkblockend); - if(strlen(h5tools_dump_header_format->udlinkend)) + if(HDstrlen(h5tools_dump_header_format->udlinkend)) h5tools_str_append(&buffer, " "); } - if(strlen(h5tools_dump_header_format->udlinkend)) + if(HDstrlen(h5tools_dump_header_format->udlinkend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkend); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); break; } /* end switch */ @@ -618,7 +618,7 @@ dump_named_datatype(hid_t tid, const char *name) h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datatypebegin, name, h5tools_dump_header_format->datatypeblockbegin); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); H5Oget_info(tid, &oinfo); @@ -639,7 +639,7 @@ dump_named_datatype(hid_t tid, const char *name) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); goto done; } else @@ -648,13 +648,13 @@ dump_named_datatype(hid_t tid, const char *name) /* Render the element */ h5tools_str_reset(&buffer); - h5tools_print_datatype(stdout, &buffer, outputformat, &ctx, tid, FALSE); + h5tools_print_datatype(rawoutstream, &buffer, outputformat, &ctx, tid, FALSE); if(H5Tget_class(tid) != H5T_COMPOUND) { h5tools_str_append(&buffer, ";"); } - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); /* print attributes */ dump_indent += COL; @@ -680,14 +680,14 @@ dump_named_datatype(hid_t tid, const char *name) done: /* Render the element */ h5tools_str_reset(&buffer); - if(strlen(h5tools_dump_header_format->datatypeblockend)) { + if(HDstrlen(h5tools_dump_header_format->datatypeblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeblockend); - if(strlen(h5tools_dump_header_format->datatypeend)) + if(HDstrlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(&buffer, " "); } - if(strlen(h5tools_dump_header_format->datatypeend)) + if(HDstrlen(h5tools_dump_header_format->datatypeend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); h5tools_str_close(&buffer); } @@ -779,7 +779,7 @@ dump_group(hid_t gid, const char *name) h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->groupbegin, name, h5tools_dump_header_format->groupblockbegin); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; dump_indent += COL; @@ -800,10 +800,10 @@ dump_group(hid_t gid, const char *name) } /* end if */ if(display_oid) { - h5tools_dump_oid(stdout, outputformat, &ctx, gid); + h5tools_dump_oid(rawoutstream, outputformat, &ctx, gid); } - h5tools_dump_comment(stdout, outputformat, &ctx, gid); + h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid); H5Oget_info(gid, &oinfo); @@ -825,7 +825,7 @@ dump_group(hid_t gid, const char *name) /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } else { found_obj->displayed = TRUE; @@ -882,18 +882,18 @@ dump_group(hid_t gid, const char *name) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); - if(strlen(h5tools_dump_header_format->groupblockend)) { + if(HDstrlen(h5tools_dump_header_format->groupblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupblockend); - if(strlen(h5tools_dump_header_format->groupend)) + if(HDstrlen(h5tools_dump_header_format->groupend)) h5tools_str_append(&buffer, " "); } - if(strlen(h5tools_dump_header_format->groupend)) + if(HDstrlen(h5tools_dump_header_format->groupend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupend); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); h5tools_str_close(&buffer); } @@ -962,36 +962,36 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) HDmemset(&buffer, 0, sizeof(h5tools_str_t)); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); - h5tools_dump_comment(stdout, outputformat, &ctx, did); + 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(stdout, outputformat, &ctx, type); + h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type); h5dump_type_table = NULL; space = H5Dget_space(did); - h5tools_dump_dataspace(stdout, outputformat, &ctx, space); + h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space); H5Sclose(space); if(display_oid) { - h5tools_dump_oid(stdout, outputformat, &ctx, did); + h5tools_dump_oid(rawoutstream, outputformat, &ctx, did); } if(display_dcpl) { h5dump_type_table = type_table; - h5tools_dump_dcpl(stdout, outputformat, &ctx, dcpl_id, type, did); + h5tools_dump_dcpl(rawoutstream, outputformat, &ctx, dcpl_id, type, did); h5dump_type_table = NULL; } H5Pclose(dcpl_id); @@ -1004,25 +1004,25 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) for(i=0; i<data_loop; i++) { if(display_packed_bits) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); packed_data_mask = packed_mask[i]; packed_data_offset = packed_offset[i]; packed_data_length = packed_length[i]; h5tools_print_packed_bits(&buffer, type); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } switch(H5Tget_class(type)) { case H5T_TIME: ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; break; @@ -1038,7 +1038,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) case H5T_VLEN: case H5T_ARRAY: { - h5tools_dump_data(stdout, outputformat, &ctx, did, TRUE, sset, display_ai, display_char); + h5tools_dump_data(rawoutstream, outputformat, &ctx, did, TRUE, sset, display_ai, display_char); } break; @@ -1069,18 +1069,18 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); - if(strlen(h5tools_dump_header_format->datasetblockend)) { + if(HDstrlen(h5tools_dump_header_format->datasetblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend); - if(strlen(h5tools_dump_header_format->datasetend)) + if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, " "); } - if(strlen(h5tools_dump_header_format->datasetend)) + if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); h5tools_str_close(&buffer); } @@ -1131,7 +1131,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) if(obj_data == DATASET_DATA) print_dataset = TRUE; - h5tools_dump_data(stdout, outputformat, &ctx, obj_id, print_dataset, sset, display_index, display_char); + h5tools_dump_data(rawoutstream, outputformat, &ctx, obj_id, print_dataset, sset, display_index, display_char); } @@ -1185,23 +1185,23 @@ dump_fcpl(hid_t fid) * SUPER_BLOCK *------------------------------------------------------------------------- */ - HDfprintf(stdout, "\n%s %s\n",SUPER_BLOCK, BEGIN); + HDfprintf(rawoutstream, "\n%s %s\n",SUPER_BLOCK, BEGIN); indentation(dump_indent + COL); - HDfprintf(stdout, "%s %u\n","SUPERBLOCK_VERSION", finfo.super.version); + HDfprintf(rawoutstream, "%s %u\n","SUPERBLOCK_VERSION", finfo.super.version); indentation(dump_indent + COL); - HDfprintf(stdout, "%s %u\n","FREELIST_VERSION", finfo.free.version); + HDfprintf(rawoutstream, "%s %u\n","FREELIST_VERSION", finfo.free.version); indentation(dump_indent + COL); - HDfprintf(stdout, "%s %u\n","SYMBOLTABLE_VERSION", 0); /* Retain this for backward compatibility, for now (QAK) */ + HDfprintf(rawoutstream, "%s %u\n","SYMBOLTABLE_VERSION", 0); /* Retain this for backward compatibility, for now (QAK) */ indentation(dump_indent + COL); - HDfprintf(stdout, "%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version); + HDfprintf(rawoutstream, "%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version); indentation(dump_indent + COL); - HDfprintf(stdout,"%s %Hd\n","OFFSET_SIZE", (long long)off_size); + HDfprintf(rawoutstream,"%s %Hd\n","OFFSET_SIZE", (long long)off_size); indentation(dump_indent + COL); - HDfprintf(stdout,"%s %Hd\n","LENGTH_SIZE", (long long)len_size); + HDfprintf(rawoutstream,"%s %Hd\n","LENGTH_SIZE", (long long)len_size); indentation(dump_indent + COL); - HDfprintf(stdout, "%s %u\n","BTREE_RANK", sym_ik); + HDfprintf(rawoutstream, "%s %u\n","BTREE_RANK", sym_ik); indentation(dump_indent + COL); - HDfprintf(stdout, "%s %d\n","BTREE_LEAF", sym_lk); + HDfprintf(rawoutstream, "%s %d\n","BTREE_LEAF", sym_lk); #ifdef SHOW_FILE_DRIVER if (H5FD_CORE==fdriver) @@ -1232,37 +1232,37 @@ dump_fcpl(hid_t fid) /* Take out this because the driver used can be different from the * standard output. */ /*indentation(dump_indent + COL); - HDfprintf(stdout, "%s %s\n","FILE_DRIVER", dname);*/ + HDfprintf(rawoutstream, "%s %s\n","FILE_DRIVER", dname);*/ #endif indentation(dump_indent + COL); - HDfprintf(stdout, "%s %u\n","ISTORE_K", istore_ik); + HDfprintf(rawoutstream, "%s %u\n","ISTORE_K", istore_ik); indentation(dump_indent + COL); if(fs_strategy == H5F_FILE_SPACE_ALL_PERSIST) - HDfprintf(stdout, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL_PERSIST"); + HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL_PERSIST"); else if(fs_strategy == H5F_FILE_SPACE_ALL) - HDfprintf(stdout, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL"); + HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_ALL"); else if(fs_strategy == H5F_FILE_SPACE_AGGR_VFD) - HDfprintf(stdout, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_AGGR_VFD"); + HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_AGGR_VFD"); else if(fs_strategy == H5F_FILE_SPACE_VFD) - HDfprintf(stdout, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_VFD"); + HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FILE_SPACE_VFD"); else - HDfprintf(stdout, "%s %s\n", "FILE_SPACE_STRATEGY", "Unknown strategy"); + HDfprintf(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "Unknown strategy"); indentation(dump_indent + COL); - HDfprintf(stdout, "%s %Hu\n","FREE_SPACE_THRESHOLD", fs_threshold); + HDfprintf(rawoutstream, "%s %Hu\n","FREE_SPACE_THRESHOLD", fs_threshold); /*------------------------------------------------------------------------- * USER_BLOCK *------------------------------------------------------------------------- */ indentation(dump_indent + COL); - HDfprintf(stdout, "USER_BLOCK %s\n",BEGIN); + HDfprintf(rawoutstream, "USER_BLOCK %s\n",BEGIN); indentation(dump_indent + COL + COL); - HDfprintf(stdout,"%s %Hu\n","USERBLOCK_SIZE", userblock); + HDfprintf(rawoutstream,"%s %Hu\n","USERBLOCK_SIZE", userblock); indentation(dump_indent + COL); - HDfprintf(stdout, "%s\n",END); + HDfprintf(rawoutstream, "%s\n",END); - HDfprintf(stdout, "%s",END); + HDfprintf(rawoutstream, "%s",END); } /*------------------------------------------------------------------------- @@ -1281,7 +1281,7 @@ dump_fcpl(hid_t fid) void dump_fcontents(hid_t fid) { - HDfprintf(stdout, "%s %s\n",FILE_CONTENTS, BEGIN); + HDfprintf(rawoutstream, "%s %s\n",FILE_CONTENTS, BEGIN); /* special case of unamed types in root group */ if (unamedtype) { @@ -1289,14 +1289,14 @@ dump_fcontents(hid_t fid) for (u = 0; u < type_table->nobjs; u++) { if (!type_table->objs[u].recorded) - HDfprintf(stdout, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno); + HDfprintf(rawoutstream, " %-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); + HDfprintf(rawoutstream, " %s\n",END); } /*------------------------------------------------------------------------- @@ -1322,7 +1322,7 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe hid_t oid = -1; hid_t attr_id = -1; char *obj_name; - const char *attr_name; + char *attr_name; int j; h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ @@ -1337,7 +1337,7 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe /* find the last / */ while(j >= 0) { - if (attr[j] == '/') + if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\'))) break; j--; } @@ -1372,37 +1372,40 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe string_dataformat.do_escape = display_escape; outputformat = &string_dataformat; - attr_name = attr + j + 1; + //attr_name = attr + j + 1; + // need to replace escape characters + attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); - /* Open the object with the attribute */ + + /* handle error case: cannot 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(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); - if(strlen(h5tools_dump_header_format->attributeblockend)) { + if(HDstrlen(h5tools_dump_header_format->attributeblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeblockend); - if(strlen(h5tools_dump_header_format->attributeend)) + if(HDstrlen(h5tools_dump_header_format->attributeend)) h5tools_str_append(&buffer, " "); } - if(strlen(h5tools_dump_header_format->attributeend)) + if(HDstrlen(h5tools_dump_header_format->attributeend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); h5tools_str_close(&buffer); @@ -1415,7 +1418,7 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe attr_data_output = display_attr_data; h5dump_type_table = type_table; - h5tools_dump_attribute(stdout, outputformat, &ctx, oid, attr, attr_id, display_ai, display_char); + h5tools_dump_attribute(rawoutstream, outputformat, &ctx, oid, attr_name, attr_id, display_ai, display_char); h5dump_type_table = NULL; if(attr_id < 0) { @@ -1428,6 +1431,7 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe } /* end if */ HDfree(obj_name); + HDfree(attr_name); dump_indent -= COL; return; @@ -1435,6 +1439,9 @@ error: h5tools_setstatus(EXIT_FAILURE); if(obj_name) HDfree(obj_name); + + if (attr_name) + HDfree(attr_name); H5E_BEGIN_TRY { H5Oclose(oid); @@ -1474,13 +1481,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) { if (pe) { - HDfprintf(stdout, "\n"); - begin_obj(h5tools_dump_header_format->datasetbegin, real_name, h5tools_dump_header_format->datasetblockbegin); - HDfprintf(stdout, "\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); + handle_links(fid, dset, data, pe, display_name); } return; } /* end if */ @@ -1502,26 +1503,26 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis * 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.data = (hsize_t *)HDcalloc((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.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 *)calloc((size_t)ndims, sizeof(hsize_t)); + 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 *)calloc((size_t)ndims, sizeof(hsize_t)); + 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; @@ -1577,12 +1578,12 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis if(found_obj) { if (found_obj->displayed) { - HDfprintf(stdout, "\n"); + HDfprintf(rawoutstream, "\n"); indentation(dump_indent); begin_obj(h5tools_dump_header_format->datasetbegin, real_name, h5tools_dump_header_format->datasetblockbegin); - HDfprintf(stdout, "\n"); + HDfprintf(rawoutstream, "\n"); indentation(dump_indent + COL); - HDfprintf(stdout, "%s \"%s\"\n", HARDLINK, found_obj->objname); + HDfprintf(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname); indentation(dump_indent); end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend); } @@ -1634,9 +1635,9 @@ handle_groups(hid_t fid, const char *group, void UNUSED *data, int pe, const cha if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) { if (pe) { - HDfprintf(stdout, "\n"); + HDfprintf(rawoutstream, "\n"); begin_obj(h5tools_dump_header_format->groupbegin, real_name, h5tools_dump_header_format->groupblockbegin); - HDfprintf(stdout, "\n"); + 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); @@ -1691,15 +1692,15 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co } else { char *buf = (char *)HDmalloc(linfo.u.val_size); - HDfprintf(stdout, "\n"); + 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(stdout, "\n"); + HDfprintf(rawoutstream, "\n"); indentation(COL); if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) - HDfprintf(stdout, "LINKTARGET \"%s\"\n", buf); + HDfprintf(rawoutstream, "LINKTARGET \"%s\"\n", buf); else { error_msg("h5dump error: unable to get link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); @@ -1709,21 +1710,21 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co case H5L_TYPE_EXTERNAL: begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); - HDfprintf(stdout, "\n"); + HDfprintf(rawoutstream, "\n"); indentation(COL); begin_obj(h5tools_dump_header_format->extlinkbegin, links, h5tools_dump_header_format->extlinkblockbegin); - HDfprintf(stdout, "\n"); + 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(stdout, "LINKCLASS %d\n", linfo.type); + HDfprintf(rawoutstream, "LINKCLASS %d\n", linfo.type); indentation(COL); - HDfprintf(stdout, "TARGETFILE \"%s\"\n", elink_file); + HDfprintf(rawoutstream, "TARGETFILE \"%s\"\n", elink_file); indentation(COL); - HDfprintf(stdout, "TARGETPATH \"%s\"\n", elink_path); + HDfprintf(rawoutstream, "TARGETPATH \"%s\"\n", elink_path); } else { error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links); @@ -1739,12 +1740,12 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co default: begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); - HDfprintf(stdout, "\n"); + HDfprintf(rawoutstream, "\n"); indentation(COL); begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); - HDfprintf(stdout, "\n"); + HDfprintf(rawoutstream, "\n"); indentation(COL); - HDfprintf(stdout, "LINKCLASS %d\n", linfo.type); + HDfprintf(rawoutstream, "LINKCLASS %d\n", linfo.type); end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend); break; } /* end switch */ @@ -1798,9 +1799,9 @@ handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe, const if(idx == type_table->nobjs) { if (pe) { /* unknown type */ - HDfprintf(stdout, "\n"); + HDfprintf(rawoutstream, "\n"); begin_obj(h5tools_dump_header_format->datatypebegin, real_name, h5tools_dump_header_format->datatypeblockbegin); - HDfprintf(stdout, "\n"); + 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); diff --git a/tools/h5dump/h5dump_defines.h b/tools/h5dump/h5dump_defines.h index a801cac..4af5360 100644 --- a/tools/h5dump/h5dump_defines.h +++ b/tools/h5dump/h5dump_defines.h @@ -26,20 +26,20 @@ #define begin_obj(obj,name,begin) \ do { \ if (name) \ - HDfprintf(stdout, "%s \"%s\" %s", (obj), (name), (begin)); \ + HDfprintf(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \ else \ - HDfprintf(stdout, "%s %s", (obj), (begin)); \ + HDfprintf(rawoutstream, "%s %s", (obj), (begin)); \ } while(0); #define end_obj(obj,end) \ do { \ if(HDstrlen(end)) { \ - HDfprintf(stdout, "%s", end); \ + HDfprintf(rawoutstream, "%s", end); \ if(HDstrlen(obj)) \ - HDfprintf(stdout, " "); \ + HDfprintf(rawoutstream, " "); \ } \ if(HDstrlen(obj)) \ - HDfprintf(stdout, "%s", obj); \ + HDfprintf(rawoutstream, "%s", obj); \ } while(0); diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index 5b6cba1..e6f8043 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -156,30 +156,30 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); - if(strlen(h5tools_dump_header_format->datasetblockend)) { + if(HDstrlen(h5tools_dump_header_format->datasetblockend)) { h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend); - if(strlen(h5tools_dump_header_format->datasetend)) + if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, " "); } - if(strlen(h5tools_dump_header_format->datasetend)) + if(HDstrlen(h5tools_dump_header_format->datasetend)) h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; @@ -203,7 +203,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -216,31 +216,31 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU t_obj_path, /* H5Path */ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); HDfree(t_name); HDfree(t_obj_path); @@ -326,7 +326,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU if (res == 0) { /* target obj found */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -343,12 +343,12 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU targetxid, /* TargetObj */ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -364,7 +364,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU t_targbuf, /* TargetPath */ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } HDfree(t_prefix); @@ -409,7 +409,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -427,7 +427,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU targname, /* TargetPath*/ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); HDfree(t_prefix); HDfree(t_name); @@ -452,7 +452,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -468,7 +468,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNU linfo->type, /* LinkClass */ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); HDfree(t_prefix); HDfree(t_name); @@ -567,24 +567,24 @@ xml_escape_the_name(const char *str) return NULL; cp = str; - len = strlen(str); + len = HDstrlen(str); extra = 0; for (i = 0; i < len; i++) { if (*cp == '\"') { - extra += (strlen(quote) - 1); + extra += (HDstrlen(quote) - 1); } else if (*cp == '\'') { - extra += (strlen(apos) - 1); + extra += (HDstrlen(apos) - 1); } else if (*cp == '<') { - extra += (strlen(lt) - 1); + extra += (HDstrlen(lt) - 1); } else if (*cp == '>') { - extra += (strlen(gt) - 1); + extra += (HDstrlen(gt) - 1); } else if (*cp == '&') { - extra += (strlen(amp) - 1); + extra += (HDstrlen(amp) - 1); } cp++; @@ -601,28 +601,28 @@ xml_escape_the_name(const char *str) for (i = 0; i < len; i++) { if (*cp == '\'') { - strncpy(ncp, apos, strlen(apos)); - ncp += strlen(apos); + HDstrncpy(ncp, apos, HDstrlen(apos)); + ncp += HDstrlen(apos); cp++; } else if (*cp == '<') { - strncpy(ncp, lt, strlen(lt)); - ncp += strlen(lt); + HDstrncpy(ncp, lt, HDstrlen(lt)); + ncp += HDstrlen(lt); cp++; } else if (*cp == '>') { - strncpy(ncp, gt, strlen(gt)); - ncp += strlen(gt); + HDstrncpy(ncp, gt, HDstrlen(gt)); + ncp += HDstrlen(gt); cp++; } else if (*cp == '\"') { - strncpy(ncp, quote, strlen(quote)); - ncp += strlen(quote); + HDstrncpy(ncp, quote, HDstrlen(quote)); + ncp += HDstrlen(quote); cp++; } else if (*cp == '&') { - strncpy(ncp, amp, strlen(amp)); - ncp += strlen(amp); + HDstrncpy(ncp, amp, HDstrlen(amp)); + ncp += HDstrlen(amp); cp++; } else { @@ -664,7 +664,7 @@ xml_escape_the_string(const char *str, int slen) cp = str; if (slen < 0) - len = strlen(str); + len = HDstrlen(str); else len = slen; @@ -678,22 +678,22 @@ xml_escape_the_string(const char *str, int slen) extra++; } else if (*cp == '\'') { - extra += (strlen(apos) - 1); + extra += (HDstrlen(apos) - 1); } else if (*cp == '<') { - extra += (strlen(lt) - 1); + extra += (HDstrlen(lt) - 1); } else if (*cp == '>') { - extra += (strlen(gt) - 1); + extra += (HDstrlen(gt) - 1); } else if (*cp == '&') { - extra += (strlen(amp) - 1); + extra += (HDstrlen(amp) - 1); } cp++; } cp = str; - rcp = ncp = (char *) calloc((len + extra + 1), sizeof(char)); + rcp = ncp = (char *) HDcalloc((len + extra + 1), sizeof(char)); if (ncp == NULL) return NULL; /* ?? */ @@ -708,23 +708,23 @@ xml_escape_the_string(const char *str, int slen) *ncp++ = *cp++; } else if (*cp == '\'') { - strncpy(ncp, apos, strlen(apos)); - ncp += strlen(apos); + HDstrncpy(ncp, apos, HDstrlen(apos)); + ncp += HDstrlen(apos); cp++; } else if (*cp == '<') { - strncpy(ncp, lt, strlen(lt)); - ncp += strlen(lt); + HDstrncpy(ncp, lt, HDstrlen(lt)); + ncp += HDstrlen(lt); cp++; } else if (*cp == '>') { - strncpy(ncp, gt, strlen(gt)); - ncp += strlen(gt); + HDstrncpy(ncp, gt, HDstrlen(gt)); + ncp += HDstrlen(gt); cp++; } else if (*cp == '&') { - strncpy(ncp, amp, strlen(amp)); - ncp += strlen(amp); + HDstrncpy(ncp, amp, HDstrlen(amp)); + ncp += HDstrlen(amp); cp++; } else { @@ -828,38 +828,38 @@ xml_print_datatype(hid_t type, unsigned in_group) as it's name. */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- h5dump error: unknown committed type. -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); h5tools_setstatus(EXIT_FAILURE); } } @@ -868,12 +868,12 @@ xml_print_datatype(hid_t type, unsigned in_group) switch (H5Tget_class(type)) { case H5T_INTEGER: ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; /* <hdf5:IntegerType ByteOrder="bo" Sign="torf" Size="bytes"/> */ @@ -881,7 +881,7 @@ xml_print_datatype(hid_t type, unsigned in_group) sgn = H5Tget_sign(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -915,16 +915,16 @@ xml_print_datatype(hid_t type, unsigned in_group) sz = H5Tget_size(type); h5tools_str_append(&buffer, "%lu", (unsigned long)sz); h5tools_str_append(&buffer, "\" />"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); break; case H5T_FLOAT: @@ -935,16 +935,16 @@ xml_print_datatype(hid_t type, unsigned in_group) ord = H5Tget_order(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -971,45 +971,45 @@ xml_print_datatype(hid_t type, unsigned in_group) 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); h5tools_str_append(&buffer, "<!-- H5T_TIME: not yet implemented -->"); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); break; case H5T_STRING: @@ -1020,17 +1020,17 @@ xml_print_datatype(hid_t type, unsigned in_group) is_vlstr = H5Tis_variable_str(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1057,16 +1057,16 @@ xml_print_datatype(hid_t type, unsigned in_group) else { h5tools_str_append(&buffer, "H5T_STR_ERROR\"/>"); } - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); break; case H5T_BITFIELD: @@ -1074,16 +1074,16 @@ xml_print_datatype(hid_t type, unsigned in_group) ord = H5Tget_order(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1103,33 +1103,33 @@ xml_print_datatype(hid_t type, unsigned in_group) size = H5Tget_size(type); h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); break; case H5T_OPAQUE: /* <hdf5:OpaqueType Tag="tag" Size="bytes" /> */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -1137,16 +1137,16 @@ xml_print_datatype(hid_t type, unsigned in_group) HDfree(mname); size = H5Tget_size(type); h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); break; case H5T_COMPOUND: @@ -1156,12 +1156,12 @@ xml_print_datatype(hid_t type, unsigned in_group) nmembers = H5Tget_nmembers(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); /* List each member Field of the type */ /* <hdf5:Field FieldName="name" > */ @@ -1176,12 +1176,12 @@ xml_print_datatype(hid_t type, unsigned in_group) t_fname = xml_escape_the_name(mname); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); HDfree(mname); HDfree(t_fname); @@ -1189,12 +1189,12 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -1202,80 +1202,80 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sField>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sCompoundType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sReferenceType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); break; case H5T_ENUM: @@ -1283,62 +1283,62 @@ xml_print_datatype(hid_t type, unsigned in_group) nmembs = H5Tget_nmembers(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sEnumType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -1346,22 +1346,22 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sVLType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); H5Tclose(super); break; @@ -1372,14 +1372,14 @@ xml_print_datatype(hid_t type, unsigned in_group) /* Print lead-in */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); /* Get array information */ H5Tget_array_dims2(type, dims); @@ -1388,12 +1388,12 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; for (i = 0; i < ndims; i++) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } ctx.indent_level--; @@ -1401,12 +1401,12 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -1414,34 +1414,34 @@ xml_print_datatype(hid_t type, unsigned in_group) ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sArrayType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- unknown datatype -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); h5tools_setstatus(EXIT_FAILURE); break; } @@ -1521,48 +1521,48 @@ xml_dump_datatype(hid_t type) */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- h5dump error: unknown committed type. -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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); @@ -1570,12 +1570,12 @@ xml_dump_datatype(hid_t type) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } ctx.indent_level--; dump_indent -= COL; @@ -1638,12 +1638,12 @@ xml_dump_dataspace(hid_t space) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataspace>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; switch (space_type) { @@ -1651,12 +1651,12 @@ xml_dump_dataspace(hid_t space) /* scalar dataspace (just a tag, no XML attrs. defined */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sScalarDataspace />",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); break; case H5S_SIMPLE: @@ -1664,56 +1664,56 @@ xml_dump_dataspace(hid_t space) /* <hdf5:SimpleDataspace Ndims="nd"> */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); /* print the <hdf5:Dimension> elements */ ctx.indent_level++; for (i = 0; i < ndims; i++) { if (maxsize[i] == H5S_UNLIMITED) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } } ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sSimpleDataspace>", xmlnsprefix ); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); break; #ifdef TMP @@ -1722,35 +1722,35 @@ xml_dump_dataspace(hid_t space) /* null dataspace (just a tag, no XML attrs. defined */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNullDataspace />",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- unknown dataspace -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataspace>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; h5tools_str_close(&buffer); @@ -1821,22 +1821,22 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU outputformat = &string_dataformat; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; @@ -1857,7 +1857,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU datactx.need_prefix = TRUE; datactx.indent_level = ctx.indent_level; datactx.cur_column = ctx.cur_column; - status = h5tools_dump_dset(stdout, outputformat, &datactx, obj_id, -1, NULL); + status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id, -1, NULL); } } else { @@ -1906,7 +1906,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU datactx.need_prefix = TRUE; datactx.indent_level = ctx.indent_level; datactx.cur_column = ctx.cur_column; - status = h5tools_dump_mem(stdout, outputformat, &datactx, obj_id, p_type, space, buf); + status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id, p_type, space, buf); } /* Reclaim any VL memory, if necessary */ if (vl_data) @@ -1923,12 +1923,12 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; @@ -1944,17 +1944,17 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataFromFile>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); h5tools_str_close(&buffer); } @@ -2013,12 +2013,12 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, outputformat = &string_dataformat; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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) { @@ -2049,44 +2049,44 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<hdf5:Data>"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; dump_indent -= COL; @@ -2094,112 +2094,112 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, case H5T_COMPOUND: ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type)); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); break; } } @@ -2207,32 +2207,32 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, /* The case of an attribute never yet written ?? * Or dataspace is H5S_NULL. */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } ctx.indent_level--; dump_indent -= COL; @@ -2242,12 +2242,12 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, H5Aclose(attr_id); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); h5tools_str_close(&buffer); return SUCCEED; @@ -2257,22 +2257,22 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- h5dump error: unable to open attribute. -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); h5tools_str_close(&buffer); @@ -2357,7 +2357,7 @@ xml_dump_named_datatype(hid_t type, const char *name) */ ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2366,13 +2366,13 @@ xml_dump_named_datatype(hid_t type, const char *name) xmlnsprefix, name, dtxid, parentxid, HDstrcmp(prefix,"") ? t_prefix : "/"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2381,7 +2381,7 @@ xml_dump_named_datatype(hid_t type, const char *name) xmlnsprefix, t_name, dtxid, t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/")); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); /* Check uniqueness of named datatype */ H5Oget_info(type, &oinfo); @@ -2409,22 +2409,22 @@ xml_dump_named_datatype(hid_t type, const char *name) xml_name_to_XID(found_obj->objname, pointerxid, sizeof(pointerxid), 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sNamedDataType>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); HDfree(t_objname); goto done; } @@ -2437,12 +2437,12 @@ xml_dump_named_datatype(hid_t type, const char *name) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; dump_indent += COL; @@ -2451,23 +2451,23 @@ xml_dump_named_datatype(hid_t type, const char *name) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sNamedDataType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); done: @@ -2607,13 +2607,13 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID("/", grpxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } else { t_objname = xml_escape_the_name(found_obj->objname); @@ -2622,7 +2622,7 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par, parentxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2630,7 +2630,7 @@ xml_dump_group(hid_t gid, const char *name) "Parents=\"%s\" H5ParentPaths=\"%s\">", xmlnsprefix,t_name, grpxid, get_next_xid(), t_objname, parentxid, par_name); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); HDfree(t_objname); HDfree(par_name); @@ -2642,7 +2642,7 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par, parentxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2650,7 +2650,7 @@ xml_dump_group(hid_t gid, const char *name) "Parents=\"%s\" H5ParentPaths=\"%s\" />", xmlnsprefix, ptrstr, t_objname, parentxid, par_name); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; @@ -2666,13 +2666,13 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID("/", grpxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } else { char *t_tmp = xml_escape_the_name(tmp); @@ -2682,14 +2682,14 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par, parentxid, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); HDfree(t_tmp); HDfree(par_name); @@ -2752,7 +2752,7 @@ xml_dump_group(hid_t gid, const char *name) char *parentxid = (char *)HDmalloc(100); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2773,7 +2773,7 @@ xml_dump_group(hid_t gid, const char *name) HDfree(t_tmp); HDfree(par_name); } - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); HDfree(t_name); HDfree(grpxid); @@ -2825,7 +2825,7 @@ xml_dump_group(hid_t gid, const char *name) } ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -2833,7 +2833,7 @@ xml_dump_group(hid_t gid, const char *name) h5tools_str_append(&buffer, "</%sRootGroup>", xmlnsprefix); else h5tools_str_append(&buffer, "</%sGroup>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); h5tools_str_close(&buffer); @@ -2899,7 +2899,7 @@ xml_print_refs(hid_t did, int source) if ((tsiz = H5Tget_size(type)) == 0) goto error; - buf = (char *) calloc((size_t)(ssiz * tsiz), sizeof(char)); + 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); @@ -2915,7 +2915,7 @@ xml_print_refs(hid_t did, int source) if ((tsiz = H5Tget_size(type)) == 0) goto error; - buf = (char *) calloc((size_t)(ssiz * tsiz), sizeof(char)); + buf = (char *) HDcalloc((size_t)(ssiz * tsiz), sizeof(char)); if (buf == NULL) { goto error; } @@ -2958,23 +2958,23 @@ xml_print_refs(hid_t did, int source) if (!path) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", "NULL"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); HDfree(t_path); } ctx.indent_level--; @@ -3085,7 +3085,7 @@ xml_print_strs(hid_t did, int source) bp = (char*) buf; if (!is_vlstr) - onestring = (char *) calloc(tsiz, sizeof(char)); + onestring = (char *) HDcalloc(tsiz, sizeof(char)); /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -3124,23 +3124,23 @@ xml_print_strs(hid_t did, int source) if (!onestring) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "NULL"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); HDfree(t_onestring); } } @@ -3235,7 +3235,7 @@ check_filters(hid_t dcpl) if (filter == H5Z_FILTER_DEFLATE) { ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3248,36 +3248,36 @@ check_filters(hid_t dcpl) h5tools_str_append(&buffer, "%d", cd_values[0]); } h5tools_str_append(&buffer, "\"/>"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sFletcher32 />", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sShuffle />", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3318,7 +3318,7 @@ check_filters(hid_t dcpl) h5tools_str_append(&buffer, "Header=\"Raw\""); } h5tools_str_append(&buffer, "/>"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; } else { @@ -3371,12 +3371,12 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; dump_indent += COL; @@ -3389,126 +3389,126 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) const char * path = lookup_ref_path(*(hobj_ref_t *) buf); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); if (!path) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", "NULL"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); HDfree(t_path); } ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- String fill values not yet implemented. -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3518,126 +3518,126 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) buf = (char *) buf + sizeof(unsigned int); } h5tools_str_append(&buffer, "\""); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\"%s\"", name); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Array fill values not yet implemented. -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Time fill not yet implemented. -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Compound fill not yet implemented. -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- VL fill not yet implemented. -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); break; default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Unknown fill datatype: %d -->", H5Tget_class(type)); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); break; } } @@ -3646,12 +3646,12 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; dump_indent -= COL; @@ -3738,14 +3738,14 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) xml_name_to_XID(prefix, pstr, 100, 1); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); HDfree(t_name); HDfree(t_tmp); @@ -3769,24 +3769,24 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; dump_indent += COL; @@ -3794,21 +3794,21 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) for (i = 0; i < ndims; i++) { ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sRequiredFilter>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; dump_indent += COL; @@ -3817,33 +3817,33 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) dump_indent -= COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sRequiredFilter>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sChunkedLayout>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; dump_indent -= COL; HDfree(chsize); @@ -3852,60 +3852,60 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sContiguousLayout/>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sCompactLayout/>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; } /* and check for external.... ?? */ @@ -3916,7 +3916,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) dump_indent += COL; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -3957,30 +3957,30 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) } h5tools_str_append(&buffer, "\""); h5tools_str_append(&buffer, ">"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sFillValue>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoFill/>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; } else { @@ -3988,23 +3988,23 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) } ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sFillValue>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sFillValueInfo>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; dump_indent -= COL; @@ -4052,48 +4052,48 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; dump_indent += COL; @@ -4104,68 +4104,68 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) case H5T_REFERENCE: ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } else { ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->"); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; dump_indent += COL; @@ -4177,36 +4177,36 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) break; default: ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type)); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); break; } } @@ -4215,30 +4215,30 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sData>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; } @@ -4247,12 +4247,12 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) H5Pclose(dcpl); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); h5tools_str_close(&buffer); } @@ -4316,22 +4316,22 @@ xml_print_enum(hid_t type) super = H5Tget_super(type); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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 @@ -4355,8 +4355,8 @@ xml_print_enum(hid_t 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)); + 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); @@ -4377,41 +4377,41 @@ xml_print_enum(hid_t type) char *t_name = xml_escape_the_name(name[i]); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sEnumElement>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + 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(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + 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(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sEnumElement>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "<%sEnumValue>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level++; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); @@ -4429,16 +4429,16 @@ xml_print_enum(hid_t type) h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "d", *((long long *) ((void *) (value + i * dst_size)))); } - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); ctx.indent_level--; ctx.need_prefix = TRUE; - h5tools_simple_prefix(stdout, outputformat, &ctx, 0, 0); + h5tools_simple_prefix(rawoutstream, outputformat, &ctx, 0, 0); /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sEnumValue>",xmlnsprefix); - h5tools_render_element(stdout, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, outputformat->line_ncols, 0, 0); } ctx.indent_level--; dump_indent -= COL; diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index f87f93a..b28f3de 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -426,7 +426,7 @@ gent_attribute(void) /* attribute 1 */ dims[0] = 24; space = H5Screate_simple(1, dims, NULL); - attr = H5Acreate2(root, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); + attr = H5Acreate2(root, "/attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); sprintf(buf, "attribute of root group"); H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); @@ -3528,7 +3528,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; @@ -3729,7 +3729,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); diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index ee91880..25a30c5 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -50,6 +50,7 @@ if test -z "$srcdir"; then fi # source dirs SRC_TOOLS="$srcdir/../" + SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles" # testfiles source dirs for tools SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES" @@ -244,10 +245,12 @@ $SRC_H5DUMP_TESTFILES/tlarge_objname.ddl $SRC_H5DUMP_TESTFILES/tlonglinks.ddl $SRC_H5DUMP_TESTFILES/tloop-1.ddl $SRC_H5DUMP_TESTFILES/tmulti.ddl +$SRC_H5DUMP_TESTFILES/tmultifile.ddl +$SRC_H5DUMP_TESTFILES/tqmarkfile.ddl +$SRC_H5DUMP_TESTFILES/tstarfile.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 @@ -267,6 +270,7 @@ $SRC_H5DUMP_TESTFILES/tscaleoffset.ddl $SRC_H5DUMP_TESTFILES/tshuffle.ddl $SRC_H5DUMP_TESTFILES/tslink-1.ddl $SRC_H5DUMP_TESTFILES/tslink-2.ddl +$SRC_H5DUMP_TESTFILES/tslink-D.ddl $SRC_H5DUMP_TESTFILES/tsplit_file.ddl $SRC_H5DUMP_TESTFILES/tstr-1.ddl $SRC_H5DUMP_TESTFILES/tstr-2.ddl @@ -713,14 +717,14 @@ TOOLTEST tgroup-2.ddl --group=/g2 --group / -g /y tgroup.h5 # test for displaying simple space datasets 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 +TOOLTEST3 tdset-2.ddl --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5 # test for displaying attributes 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 --enable-error-stack -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 +TOOLTEST3 tattr-3.ddl --enable-error-stack --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 --enable-error-stack tattr4_be.h5 # test for displaying attributes in shared datatype (also in group and dataset) @@ -732,6 +736,8 @@ TOOLTEST tudlink-1.ddl --enable-error-stack tudlink.h5 # test for displaying the selected link TOOLTEST tslink-2.ddl --enable-error-stack -l slink2 tslink.h5 TOOLTEST tudlink-2.ddl --enable-error-stack -l udlink2 tudlink.h5 +# test for displaying dangling soft links +TOOLTEST3 tslink-D.ddl --enable-error-stack -d /slink1 tslink.h5 # tests for hard links TOOLTEST thlink-1.ddl --enable-error-stack thlink.h5 @@ -792,6 +798,11 @@ 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 wildcards in filename (does not work with cmake) +# inconsistent across platforms TOOLTEST3 tstarfile.ddl --enable-error-stack -H -d Dataset1 tarr*.h5 +TOOLTEST3 tqmarkfile.ddl --enable-error-stack -H -d Dataset1 tarray?.h5 +TOOLTEST tmultifile.ddl --enable-error-stack -H -d Dataset1 tarray2.h5 tarray3.h5 tarray4.h5 tarray5.h5 tarray6.h5 tarray7.h5 + # test for files with empty data TOOLTEST tempty.ddl --enable-error-stack tempty.h5 @@ -831,7 +842,7 @@ TOOLTEST tboot2.ddl --enable-error-stack -B tfcontents2.h5 TOOLTEST file_space.ddl --enable-error-stack -B file_space.h5 # test -p with a non existing dataset -TOOLTEST tperror.ddl -p -d bogus tfcontents1.h5 +TOOLTEST3 tperror.ddl --enable-error-stack -p -d bogus tfcontents1.h5 # test for file contents TOOLTEST tcontents.ddl --enable-error-stack -n tfcontents1.h5 @@ -876,57 +887,57 @@ TOOLTEST tindicessub3.ddl --enable-error-stack -d 3d -s 0,1,2 -S 1,3,3 -c 2,2,2 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 -TOOLTEST texceedsubcount.ddl -d 1d -c 1,3 taindices.h5 -TOOLTEST texceedsubstride.ddl -d 1d -S 1,3 taindices.h5 -TOOLTEST texceedsubblock.ddl -d 1d -k 1,3 taindices.h5 +TOOLTEST texceedsubstart.ddl --enable-error-stack -d 1d -s 1,3 taindices.h5 +TOOLTEST texceedsubcount.ddl --enable-error-stack -d 1d -c 1,3 taindices.h5 +TOOLTEST texceedsubstride.ddl --enable-error-stack -d 1d -S 1,3 taindices.h5 +TOOLTEST texceedsubblock.ddl --enable-error-stack -d 1d -k 1,3 taindices.h5 + -###### 2/17 SKIP tests because compression values are different ############ # tests for filters # SZIP -option="-H -p -d szip tfilters.h5" +option="--enable-error-stack -H -p -d szip tfilters.h5" if test $USE_FILTER_SZIP != "yes"; then SKIP $option else TOOLTEST tszip.ddl $option fi # deflate -option="-H -p -d deflate tfilters.h5" +option="--enable-error-stack -H -p -d deflate tfilters.h5" if test $USE_FILTER_DEFLATE != "yes"; then SKIP $option else TOOLTEST tdeflate.ddl $option fi # shuffle -option="-H -p -d shuffle tfilters.h5" +option="--enable-error-stack -H -p -d shuffle tfilters.h5" if test $USE_FILTER_SHUFFLE != "yes"; then SKIP $option else TOOLTEST tshuffle.ddl $option fi # fletcher32 -option="-H -p -d fletcher32 tfilters.h5" +option="--enable-error-stack -H -p -d fletcher32 tfilters.h5" if test $USE_FILTER_FLETCHER32 != "yes"; then SKIP $option else TOOLTEST tfletcher32.ddl $option fi # nbit -option="-H -p -d nbit tfilters.h5" +option="--enable-error-stack -H -p -d nbit tfilters.h5" if test $USE_FILTER_NBIT != "yes"; then SKIP $option else TOOLTEST tnbit.ddl $option fi # scaleoffset -option="-H -p -d scaleoffset tfilters.h5" +option="--enable-error-stack -H -p -d scaleoffset tfilters.h5" if test $USE_FILTER_SCALEOFFSET != "yes"; then SKIP $option else TOOLTEST tscaleoffset.ddl $option fi # all -option="-H -p -d all tfilters.h5" +option="--enable-error-stack -H -p -d all tfilters.h5" if test $USE_FILTER_FLETCHER32 != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_DEFLATE != "yes" -o $USE_FILTER_SHUFFLE != "yes" -o $USE_FILTER_NBIT != "yes" -o $USE_FILTER_SCALEOFFSET != "yes"; then SKIP $option else @@ -1023,7 +1034,7 @@ 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 +TOOLTEST3 textlink.ddl --enable-error-stack textlink.h5 # test for error stack display (BZ2048) TOOLTEST3 filter_fail.ddl --enable-error-stack filter_fail.h5 @@ -1035,7 +1046,7 @@ TOOLTEST tall-6.ddl --enable-error-stack -y -o data -d /g1/g1.1/dset1.1.1 tall.h # test failure handling # Missing file name -TOOLTEST tnofilename-with-packed-bits.ddl +TOOLTEST tnofilename-with-packed-bits.ddl --enable-error-stack # Limits: # Maximum number of packed bits is 8 (for now). # Maximum integer size is 64 (for now). @@ -1094,23 +1105,23 @@ TOOLTEST tpbitsCompound.ddl --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound. 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 +TOOLTEST tpbitsMaxExceeded.ddl --enable-error-stack -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 tpbitsOffsetExceeded.ddl --enable-error-stack -d /DS08BITS -M 64,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 +TOOLTEST tpbitsOffsetNegative.ddl --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5 # Bad length, must not be positive. -TOOLTEST tpbitsLengthPositive.ddl -d /DS08BITS -M 4,0 packedbits.h5 +TOOLTEST tpbitsLengthPositive.ddl --enable-error-stack -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 tpbitsLengthExceeded.ddl --enable-error-stack -d /DS08BITS -M 37,28 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 +TOOLTEST tpbitsIncomplete.ddl --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5 # Report test results and exit diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt index bb8de26..76dcf26 100644 --- a/tools/h5import/CMakeLists.txt +++ b/tools/h5import/CMakeLists.txt @@ -5,7 +5,6 @@ PROJECT (HDF5_TOOLS_H5IMPORT) # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) -INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- # Add the h5import executables 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 <string.h> #include <ctype.h> #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 <infile> -c[onfig] <configfile> [<infile> -c[config] <configfile>...]", name); - (void) fprintf(stdout, "\t\t\t\t -o[utfile] <outfile>\n\n"); - (void) fprintf(stdout, "\t PURPOSE:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t\t\t\t -o[utfile] <outfile>\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 <infile> -c[onfig] <configfile> \ [<infile> -c[config] <confile2>...] -o[utfile] <outfile>\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 <infile(s)>:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t <infile(s)>:\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] <configfile>:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t of fastest changing dimensions first.\n\n"); + (void) HDfprintf(stdout, "\t -c[config] <configfile>:\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 <configfile> is the name of the configuration file.\n"); - (void) fprintf(stdout, "\t (See Section \"CONFIGURATION FILE\")\n\n"); - (void) fprintf(stdout, "\t -o[utfile] <outfile>:\n"); - (void) fprintf(stdout, + (void) HDfprintf(stdout, "\t (See Section \"CONFIGURATION FILE\")\n\n"); + (void) HDfprintf(stdout, "\t -o[utfile] <outfile>:\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 <outfile>. 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 <external-filename>: 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 <external-filename>: 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 <infile> -c[onfig] <configfile> \ [<infile> -c[config] <configfile>...] -o[utfile] <outfile> \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..a03d139 100644 --- a/tools/h5jam/CMakeLists.txt +++ b/tools/h5jam/CMakeLists.txt @@ -5,7 +5,6 @@ PROJECT (HDF5_TOOLS_H5JAM) # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) -INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- # Add the h5jam executables @@ -50,7 +49,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 $<TARGET_FILE:h5jamgentest>) 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 c64053c..ca3d86c 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -335,7 +335,7 @@ create_textfile(const char *name, size_t size) fd = HDcreat(name,0777); HDassert(fd >= 0); - buf = calloc(size, (size_t)1); + buf = HDcalloc(size, (size_t)1); HDassert(buf); /* fill buf with pattern */ @@ -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/CMakeLists.txt b/tools/h5ls/CMakeLists.txt index ad37da0..0dec21c 100644 --- a/tools/h5ls/CMakeLists.txt +++ b/tools/h5ls/CMakeLists.txt @@ -5,7 +5,6 @@ PROJECT (HDF5_TOOLS_H5LS) # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) -INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) #----------------------------------------------------------------------------- # Add the h5ls executable @@ -29,111 +28,105 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- # Copy all the test files from source directory to test directory # -------------------------------------------------------------------- - SET (LIST_EXPECT_OUTPUT_FILES - help-1.ls - help-2.ls - help-3.ls - nosuchfile.ls - tall-1.ls - tall-2.ls - tarray1.ls - tattr2.ls - tattrreg_le.ls - tattrreg_be.ls - tcomp-1.ls - tdataregbe.ls - tdataregle.ls - tdset-1.ls - tempty.ls - textlink-1.ls - textlinksrc-1.ls - textlinksrc-2.ls - textlinksrc-3.ls - textlinksrc-4.ls - textlinksrc-5.ls - textlinksrc-6.ls - textlinksrc-7.ls - textlinksrc-1-old.ls - textlinksrc-2-old.ls - textlinksrc-3-old.ls - textlinksrc-6-old.ls - textlinksrc-7-old.ls - tsoftlinks-1.ls - tsoftlinks-2.ls - tsoftlinks-3.ls - tsoftlinks-4.ls - tsoftlinks-5.ls - textlinksrc-nodangle-1.ls - textlinksrc-nodangle-2.ls - tgrp_comments.ls - tsoftlinks-nodangle-1.ls - thlinks-nodangle-1.ls - tgroup.ls - tgroup-1.ls - tgroup-2.ls - tgroup-3.ls - thlink-1.ls - tloop-1.ls - tnestcomp-1.ls - tnestcomp-2.ls - tnestcomp-3.ls - tnestcomp-4.ls - tsaf.ls - tslink-1.ls - tstr-1.ls - tudlink-1.ls - tvldtypes1.ls - tvldtypes2le.ls - tvldtypes2be.ls - ) SET (LIST_HDF5_TEST_FILES - tall.h5 - tarray1.h5 - tattr2.h5 - tattrreg.h5 - tcompound.h5 - tdatareg.h5 - tdset.h5 - tempty.h5 - textlink.h5 - textlinksrc.h5 - textlinktar.h5 - tgroup.h5 - tgrp_comments.h5 - thlink.h5 - tloop.h5 - tnestedcomp.h5 - tsaf.h5 - tslink.h5 - tsoftlinks.h5 - tstr.h5 - tudlink.h5 - tvldtypes1.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tall.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tarray1.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tattr2.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tattrreg.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tcompound.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tdatareg.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tdset.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tempty.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlink.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinktar.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tgroup.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tgrp_comments.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/thlink.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tloop.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnestedcomp.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tslink.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tsoftlinks.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tstr.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tudlink.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes1.h5 ) - # copy the list of expected output files - FOREACH (out_file ${LIST_EXPECT_OUTPUT_FILES}) - SET (out_dest "${PROJECT_BINARY_DIR}/${out_file}") - #MESSAGE (STATUS " Translating ${out_file}") - ADD_CUSTOM_COMMAND ( - TARGET h5ls - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${out_file} ${out_dest} - ) - ENDFOREACH (out_file ${LIST_EXPECT_OUTPUT_FILES}) + SET (LIST_OTHER_TEST_FILES + ${HDF5_TOOLS_SRC_DIR}/testfiles/help-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/help-2.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/help-3.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/nosuchfile.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-2.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tarray1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tattr2.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tattrreg_le.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tattrreg_be.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tcomp-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tdataregbe.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tdataregle.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tdset-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tempty.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlink-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-2.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-3.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-4.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-5.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-6.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-7.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-1-old.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-2-old.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-3-old.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-6-old.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-7-old.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tsoftlinks-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tsoftlinks-2.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tsoftlinks-3.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tsoftlinks-4.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tsoftlinks-5.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-nodangle-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/textlinksrc-nodangle-2.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tgrp_comments.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tsoftlinks-nodangle-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/thlinks-nodangle-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tgroup.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tgroup-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tgroup-2.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tgroup-3.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/thlink-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tloop-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tmultifile.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnestcomp-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnestcomp-2.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnestcomp-3.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tnestcomp-4.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tslink-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tstr-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tudlink-1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes1.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes2le.ls + ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes2be.ls + ) + + FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - # copy the list of hdf5 test files - FOREACH (h5_file ${LIST_HDF5_TEST_FILES}) - SET (h5_dest "${PROJECT_BINARY_DIR}/${h5_file}") - #MESSAGE (STATUS " Copying ${h5_file}") + # copy the list of test files + FOREACH (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) + GET_FILENAME_COMPONENT(fname "${listfiles}" NAME) + SET (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") + #MESSAGE (STATUS " Copying ${listfiles} to ${dest}") ADD_CUSTOM_COMMAND ( TARGET h5ls POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file} ${h5_dest} + ARGS -E copy_if_different ${listfiles} ${dest} ) - ENDFOREACH (h5_file ${LIST_HDF5_TEST_FILES}) + ENDFOREACH (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) + ############################################################################## ############################################################################## @@ -145,6 +138,7 @@ IF (BUILD_TESTING) # If using memchecker add tests without using scripts IF (HDF5_ENABLE_USING_MEMCHECKER) ADD_TEST (NAME H5LS-${resultfile} COMMAND $<TARGET_FILE:h5ls> ${ARGN}) + SET_TESTS_PROPERTIES (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") IF (${resultcode} STREQUAL "1") SET_TESTS_PROPERTIES (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") ENDIF (${resultcode} STREQUAL "1") @@ -156,14 +150,14 @@ IF (BUILD_TESTING) ADD_TEST ( NAME H5LS-clear-${resultfile}-objects COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.out ${resultfile}.out.err + -E remove ./testfiles/${resultfile}.out ./testfiles/${resultfile}.out.err ) ADD_TEST ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>" -D "TEST_ARGS=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ls" @@ -361,6 +355,11 @@ IF (BUILD_TESTING) # when used file with no dangling links - expected exit code 0 ADD_H5_TEST (thlinks-nodangle-1 0 -w80 --follow-symlinks --no-dangling-links thlink.h5) +# test for wildcards in filename (does not work with cmake) +# ADD_H5_TEST (tstarfile 0 -w80 t*link.h5) +# ADD_H5_TEST (tqmarkfile 0 -w80 t?link.h5) + ADD_H5_TEST (tmultifile 0 -w80 thlink.h5 tslink.h5) + # tests for hard links ADD_H5_TEST (thlink-1 0 -w80 thlink.h5) diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 9766170..2171682 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -176,7 +176,7 @@ static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter); static void usage (void) { - fprintf(stderr, "\ + HDfprintf(rawerrorstream, "\ usage: %s [OPTIONS] [OBJECTS...]\n\ OPTIONS\n\ -h, -?, --help Print a usage message and exit\n\ @@ -239,1071 +239,6 @@ usage: %s [OPTIONS] [OBJECTS...]\n\ } -/*------------------------------------------------------------------------- - * 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) fprintf(stream, "\\\""); - nprint += 2; - break; - case '\\': - if (stream) fprintf(stream, "\\\\"); - nprint += 2; - break; - case '\b': - if (stream) fprintf(stream, "\\b"); - nprint += 2; - break; - case '\f': - if (stream) fprintf(stream, "\\f"); - nprint += 2; - break; - case '\n': - if (stream) fprintf(stream, "\\n"); - nprint += 2; - break; - case '\r': - if (stream) fprintf(stream, "\\r"); - nprint += 2; - break; - case '\t': - if (stream) fprintf(stream, "\\t"); - nprint += 2; - break; - case ' ': - if (escape_spaces) { - if (stream) fprintf(stream, "\\ "); - nprint += 2; - } else { - if (stream) fprintf(stream, " "); - nprint++; - } - break; - default: - if (isprint((int)*s)) { - if (stream) putc(*s, stream); - nprint++; - } else { - if (stream) { - fprintf(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 */ - printf("%*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) { - printf("native signed char"); - } else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) { - printf("native unsigned char"); - } else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) { - printf("native int"); - } else if (H5Tequal(type, H5T_NATIVE_UINT)==TRUE) { - printf("native unsigned int"); - } else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) { - printf("native short"); - } else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) { - printf("native unsigned short"); - } else if (H5Tequal(type, H5T_NATIVE_LONG)==TRUE) { - printf("native long"); - } else if (H5Tequal(type, H5T_NATIVE_ULONG)==TRUE) { - printf("native unsigned long"); - } else if (H5Tequal(type, H5T_NATIVE_LLONG)==TRUE) { - printf("native long long"); - } else if (H5Tequal(type, H5T_NATIVE_ULLONG)==TRUE) { - printf("native unsigned long long"); - } else if (H5Tequal(type, H5T_NATIVE_FLOAT)==TRUE) { - printf("native float"); - } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)==TRUE) { - printf("native double"); -#if H5_SIZEOF_LONG_DOUBLE !=0 - } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)==TRUE) { - printf("native long double"); -#endif - } else if (H5Tequal(type, H5T_NATIVE_INT8)==TRUE) { - printf("native int8_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT8)==TRUE) { - printf("native uint8_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT16)==TRUE) { - printf("native int16_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT16)==TRUE) { - printf("native uint16_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT32)==TRUE) { - printf("native int32_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT32)==TRUE) { - printf("native uint32_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT64)==TRUE) { - printf("native int64_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT64)==TRUE) { - printf("native uint64_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST8)==TRUE) { - printf("native int_least8_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST8)==TRUE) { - printf("native uint_least8_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST16)==TRUE) { - printf("native int_least16_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST16)==TRUE) { - printf("native uint_least16_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST32)==TRUE) { - printf("native int_least32_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST32)==TRUE) { - printf("native uint_least32_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST64)==TRUE) { - printf("native int_least64_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST64)==TRUE) { - printf("native uint_least64_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_FAST8)==TRUE) { - printf("native int_fast8_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST8)==TRUE) { - printf("native uint_fast8_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_FAST16)==TRUE) { - printf("native int_fast16_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST16)==TRUE) { - printf("native uint_fast16_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_FAST32)==TRUE) { - printf("native int_fast32_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST32)==TRUE) { - printf("native uint_fast32_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_FAST64)==TRUE) { - printf("native int_fast64_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST64)==TRUE) { - printf("native uint_fast64_t"); - } else if (H5Tequal(type, H5T_NATIVE_B8)==TRUE) { - printf("native 8-bit field"); - } else if (H5Tequal(type, H5T_NATIVE_B16)==TRUE) { - printf("native 16-bit field"); - } else if (H5Tequal(type, H5T_NATIVE_B32)==TRUE) { - printf("native 32-bit field"); - } else if (H5Tequal(type, H5T_NATIVE_B64)==TRUE) { - printf("native 64-bit field"); - } else if (H5Tequal(type, H5T_NATIVE_HSIZE)==TRUE) { - printf("native hsize_t"); - } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)==TRUE) { - printf("native hssize_t"); - } else if (H5Tequal(type, H5T_NATIVE_HERR)==TRUE) { - printf("native herr_t"); - } else if (H5Tequal(type, H5T_NATIVE_HBOOL)==TRUE) { - printf("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) { - 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 { - 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))) { - printf("\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) { - printf("\n%*s(", ind, ""); - if (plsb_s) { - nbits = H5Tget_offset(type); - printf("%lu %s bit%s at bit 0", - (unsigned long)nbits, plsb_s, 1==nbits?"":"s"); - } - if (plsb_s && pmsb_s) printf(", "); - if (pmsb_s) { - nbits = 8*H5Tget_size(type)-(H5Tget_offset(type)+prec); - printf("%lu %s bit%s at bit %lu", - (unsigned long)nbits, pmsb_s, 1==nbits?"":"s", - (unsigned long)(8*H5Tget_size(type)-nbits)); - } - printf(")"); - } - } -} - - -/*------------------------------------------------------------------------- - * 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 */ - printf("%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. */ - printf("%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; - } - printf("\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)", - ind, "", (unsigned long)esize, 1==esize?"":"s", - (unsigned long)epos, (unsigned long)ebias); - printf("\n%*s(sign bit at %lu)", ind, "", (unsigned long)spos); - - /* Display internal padding */ - if (1+esize+msize<H5Tget_precision(type)) { - pad = H5Tget_inpad(type); - switch (pad) { - case H5T_PAD_ZERO: - pad_s = "zero"; - break; - case H5T_PAD_ONE: - pad_s = "one"; - break; - case H5T_PAD_BACKGROUND: - pad_s = "bkg"; - break; - case H5T_PAD_ERROR: - case H5T_NPAD: - pad_s = "unknown"; - break; - default: - ; - break; - } - printf("\n%*s(internal padding bits are %s)", ind, "", pad_s); - } - return TRUE; -} - - -/*------------------------------------------------------------------------- - * Function: display_cmpd_type - * - * Purpose: Print info about a compound data type. - * - * Return: Success: TRUE - * - * Failure: FALSE, nothing printed - * - * Programmer: Robb Matzke - * Thursday, November 5, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static hbool_t -display_cmpd_type(hid_t type, int ind) -{ - char *name=NULL; /* member name */ - size_t size; /* total size of type in bytes */ - hid_t subtype; /* member data type */ - unsigned nmembs; /* number of members */ - int n; /* miscellaneous counters */ - unsigned i; /* miscellaneous counters */ - - if (H5T_COMPOUND!=H5Tget_class(type)) return FALSE; - printf("struct {"); - nmembs=H5Tget_nmembers(type); - for (i=0; i<nmembs; i++) { - - /* Name and offset */ - name = H5Tget_member_name(type, i); - printf("\n%*s\"", ind+4, ""); - n = display_string(stdout, name, FALSE); - printf("\"%*s +%-4lu ", MAX(0, 16-n), "", - (unsigned long)H5Tget_member_offset(type, i)); - HDfree(name); - - /* Member's type */ - subtype = H5Tget_member_type(type, i); - display_type(subtype, ind+4); - H5Tclose(subtype); - } - size = H5Tget_size(type); - printf("\n%*s} %lu byte%s", - ind, "", (unsigned long)size, 1==size?"":"s"); - return TRUE; -} - - -/*------------------------------------------------------------------------- - * Function: display_enum_type - * - * Purpose: Print info about an enumeration data type. - * - * Return: Success: TRUE - * - * Failure: FALSE, nothing printed - * - * Programmer: Robb Matzke - * Wednesday, December 23, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static hbool_t -display_enum_type(hid_t type, int ind) -{ - 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 data type */ - size_t dst_size; /* destination value type size */ - unsigned i; /* miscellaneous counters */ - size_t j; - - if (H5T_ENUM!=H5Tget_class(type)) return FALSE; - nmembs = H5Tget_nmembers(type); - HDassert(nmembs>0); - super = H5Tget_super(type); - printf("enum "); - display_type(super, ind+4); - printf(" {"); - - /* 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 = 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 data type */ - 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++) { - printf("\n%*s", ind+4, ""); - nchars = display_string(stdout, name[i], TRUE); - printf("%*s = ", MAX(0, 16-nchars), ""); - - if (native<0) { - printf("0x"); - for (j=0; j<dst_size; j++) - printf("%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))); - } - } - - /* Release resources */ - for (i=0; i<nmembs; i++) HDfree(name[i]); - HDfree(name); - HDfree(value); - H5Tclose(super); - - if (0==nmembs) printf("\n%*s <empty>", ind+4, ""); - printf("\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)) { - printf("variable-length"); - } else { - printf("%lu-byte", (unsigned long)H5Tget_size(type)); - } - printf(" %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) { - printf("object reference"); - } else if (H5Tequal(type, H5T_STD_REF_DSETREG)==TRUE) { - printf("dataset region reference"); - } else { - printf("%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); - printf("%lu-byte opaque type", (unsigned long)size); - if ((tag=H5Tget_tag(type))) { - printf("\n%*s(tag = \"", ind, ""); - display_string(stdout, tag, FALSE); - printf("\")"); - 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; - - printf("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; i<ndims; i++) - HDfprintf(stdout, "%s%Hu" , i?",":"[", dims[i]); - putchar(']'); - - HDfree(dims); - } else { - fputs(" [SCALAR]", stdout); - } - - - /* Print parent type */ - putchar(' '); - super = H5Tget_super(type); - display_type(super, ind+4); - H5Tclose(super); - return TRUE; -} - - -/*------------------------------------------------------------------------- - * Function: display_bitfield_type - * - * Purpose: Print information about a bitfield type. - * - * Return: Success: TRUE - * - * Failure: FALSE, nothing printed - * - * Programmer: Pedro Vicente - * Tuesday, May 20, 2003 - * - * Modifications: - * Robb Matzke, LLNL 2003-06-05 - * Generalized Pedro's original if/then/else. Also display - * precision/offset information. - *------------------------------------------------------------------------- - */ -static hbool_t -display_bitfield_type(hid_t type, int ind) -{ - H5T_order_t order; /* byte order value */ - const char *order_s=NULL; /* byte order string */ - - if (H5T_BITFIELD!=H5Tget_class(type)) return FALSE; - 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 = ""; - } - - printf("%lu-bit%s bitfield", - (unsigned long)(8*H5Tget_size(type)), order_s); - display_precision(type, ind); - return TRUE; -} - - -/*------------------------------------------------------------------------- - * Function: display_type - * - * 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, November 5, 1998 - * - * Modifications: - * Robb Matzke, 1999-06-11 - * Prints the OID of shared data types. - * - *------------------------------------------------------------------------- - */ -static void -display_type(hid_t type, int ind) -{ - H5T_class_t data_class = H5Tget_class(type); - - /* Bad data type */ - if (type<0) { - printf("<ERROR>"); - return; - } - - /* Shared? If so then print the type's OID */ - if(H5Tcommitted(type)) { - H5O_info_t oi; - - if(H5Oget_info(type, &oi) >= 0) - printf("shared-%lu:"H5_PRINTF_HADDR_FMT" ", - oi.fileno, oi.addr); - else - printf("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 */ - printf("%lu-byte class-%u unknown", - (unsigned long)H5Tget_size(type), (unsigned)data_class); -} - /*------------------------------------------------------------------------- * Function: print_string @@ -1329,49 +264,50 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces) for (/*void*/; s && *s; s++) { switch (*s) { case '"': - h5tools_str_append(buffer, "\\\""); + if (buffer) h5tools_str_append(buffer, "\\\""); nprint += 2; break; case '\\': - h5tools_str_append(buffer, "\\\\"); + if (buffer) h5tools_str_append(buffer, "\\\\"); nprint += 2; break; case '\b': - h5tools_str_append(buffer, "\\b"); + if (buffer) h5tools_str_append(buffer, "\\b"); nprint += 2; break; case '\f': - h5tools_str_append(buffer, "\\f"); + if (buffer) h5tools_str_append(buffer, "\\f"); nprint += 2; break; case '\n': - h5tools_str_append(buffer, "\\n"); + if (buffer) h5tools_str_append(buffer, "\\n"); nprint += 2; break; case '\r': - h5tools_str_append(buffer, "\\r"); + if (buffer) h5tools_str_append(buffer, "\\r"); nprint += 2; break; case '\t': - h5tools_str_append(buffer, "\\t"); + if (buffer) h5tools_str_append(buffer, "\\t"); nprint += 2; break; case ' ': if (escape_spaces) { - h5tools_str_append(buffer, "\\ "); + if (buffer) h5tools_str_append(buffer, "\\ "); nprint += 2; } else { - h5tools_str_append(buffer, " "); + if (buffer) h5tools_str_append(buffer, " "); nprint++; } break; default: if (isprint((int)*s)) { - h5tools_str_append(buffer, "%c", *s); + if (buffer) h5tools_str_append(buffer, "%c", *s); nprint++; - } else { - h5tools_str_append(buffer, "\\%03o", *((const unsigned char*)s)); + } + else { + if (buffer) h5tools_str_append(buffer, "\\%03o", *((const unsigned char*)s)); nprint += 4; } break; @@ -1977,8 +913,8 @@ print_enum_type(h5tools_str_t *buffer, 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<nmembs; i++) { name[i] = H5Tget_member_name(type, i); H5Tget_member_value(type, i, value+i*H5Tget_size(type)); @@ -2267,7 +1203,7 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind) HDfree(dims); } else { - h5tools_str_append(buffer, " [SCALAR]\n", stdout); + h5tools_str_append(buffer, " [SCALAR]\n", rawoutstream); } @@ -2504,20 +1440,20 @@ dump_dataset_values(hid_t dset) /* Print all the values. */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " Data:\n"); - h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + 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(stdout, info, &ctx, dset, -1, NULL) < 0) { + 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(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); } H5Tclose(f_type); - - fprintf(stdout, "\n"); h5tools_str_close(&buffer); + + HDfprintf(rawoutstream, "\n"); } @@ -2579,7 +1515,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, case H5S_SCALAR: /* scalar dataspace */ h5tools_str_append(&buffer, " scalar\n"); - h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); break; case H5S_SIMPLE: @@ -2590,19 +1526,19 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, nelmts *= size[i]; } h5tools_str_append(&buffer, "}\n"); - h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); break; case H5S_NULL: /* null dataspace */ h5tools_str_append(&buffer, " null\n"); - h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); break; default: /* Unknown dataspace type */ h5tools_str_append(&buffer, " unknown\n"); - h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); break; } /* end switch */ @@ -2611,7 +1547,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, h5tools_str_append(&buffer, " Type: "); print_type(&buffer, type, 15); h5tools_str_append(&buffer, "\n"); - h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); /* Data */ outputformat = *info; @@ -2627,7 +1563,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, else { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " Data:\n"); - h5tools_render_element(stdout, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + 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 "; @@ -2684,7 +1620,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, ctx.need_prefix = TRUE; ctx.indent_level = 2; ctx.cur_column = curr_pos; - h5tools_dump_mem(stdout, info, &ctx, attr, p_type, space, buf); + h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf); } /* Reclaim any VL memory, if necessary */ @@ -2694,18 +1630,15 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, HDfree(buf); H5Tclose(p_type); } /* end if */ - fprintf(stdout, "\n"); H5Sclose(space); H5Tclose(type); H5Aclose(attr); } - else { - fprintf(stdout, "\n"); - } - h5tools_str_close(&buffer); + HDfprintf(rawoutstream, "\n"); + return 0; } @@ -2738,26 +1671,41 @@ dataset_list1(hid_t dset) int ndims; /* dimensionality */ H5S_class_t space_type; /* type of dataspace */ int i; + hsize_t curr_pos = 0; /* total data element position */ + h5tool_link_info_t lnk_info; + 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); /* Information that goes on the same row as the name. The name has * already been printed. */ space = H5Dget_space(dset); space_type = H5Sget_simple_extent_type(space); ndims = H5Sget_simple_extent_dims(space, cur_size, max_size); - printf (" {"); + h5tools_str_append(&buffer, " {"); for (i=0; i<ndims; i++) { - HDfprintf (stdout, "%s%Hu", i?", ":"", cur_size[i]); + h5tools_str_append(&buffer, "%s"HSIZE_T_FORMAT, i?", ":"", cur_size[i]); if (max_size[i]==H5S_UNLIMITED) { - HDfprintf (stdout, "/%s", "Inf"); - } else if (max_size[i]!=cur_size[i] || verbose_g>0) { - HDfprintf(stdout, "/%Hu", max_size[i]); + h5tools_str_append(&buffer, "/%s", "Inf"); + } + else if (max_size[i]!=cur_size[i] || verbose_g>0) { + h5tools_str_append(&buffer, "/"HSIZE_T_FORMAT, max_size[i]); } } - if (space_type==H5S_SCALAR) printf("SCALAR"); - else if (space_type==H5S_NULL) printf("NULL"); - putchar('}'); + if (space_type==H5S_SCALAR) h5tools_str_append(&buffer, "SCALAR"); + else if (space_type==H5S_NULL) h5tools_str_append(&buffer, "NULL"); + h5tools_str_append(&buffer, "}"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); H5Sclose (space); + h5tools_str_close(&buffer); + return 0; } @@ -2801,6 +1749,16 @@ dataset_list2(hid_t dset, const char UNUSED *name) double utilization; /* percent utilization of storage */ H5T_class_t tclass; /* datatype class identifier */ int i; + 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); if(verbose_g > 0) { dcpl = H5Dget_create_plist(dset); @@ -2812,87 +1770,87 @@ 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:"); + h5tools_str_append(&buffer, " %-10s {", "Chunks:"); total = H5Tget_size(type); for (i=0; i<ndims; i++) { - printf("%s%lu", i?", ":"", (unsigned long)(chsize[i])); + h5tools_str_append(&buffer, "%s"HSIZE_T_FORMAT, i?", ":"", chsize[i]); total *= chsize[i]; } - printf("} %lu bytes\n", (unsigned long)total); + h5tools_str_append(&buffer, "} "HSIZE_T_FORMAT" bytes\n", total); } /* Print total raw storage size */ total = H5Sget_simple_extent_npoints(space) * H5Tget_size(type); used = H5Dget_storage_size(dset); tclass = H5Tget_class(type); - printf(" %-10s ", "Storage:"); + h5tools_str_append(&buffer, " %-10s ", "Storage:"); switch (tclass) { case H5T_VLEN: - printf("information not available"); + h5tools_str_append(&buffer, "information not available"); break; case H5T_REFERENCE: if ( H5Tequal(type, H5T_STD_REF_DSETREG)) { - printf("information not available"); + h5tools_str_append(&buffer, "information not available"); } break; default: - printf("%lu logical byte%s, %lu allocated byte%s", - (unsigned long)total, 1==total?"":"s", - (unsigned long)used, 1==used?"":"s"); + h5tools_str_append(&buffer, HSIZE_T_FORMAT" logical byte%s, "HSIZE_T_FORMAT" allocated byte%s", + total, 1==total?"":"s", + used, 1==used?"":"s"); if (used>0) { utilization = (total*100.0)/used; - printf(", %1.2f%% utilization", utilization); + h5tools_str_append(&buffer, ", %1.2f%% utilization", utilization); } - } - - putchar('\n'); + h5tools_str_append(&buffer, "\n"); /* Print information about external strorage */ if((nf = H5Pget_external_count(dcpl)) > 0) { for(i = 0, max_len = 0; i < nf; i++) { H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL); - n = display_string(NULL, f_name, TRUE); + n = print_string(NULL, f_name, TRUE); max_len = MAX(max_len, n); } /* end for */ - printf(" %-10s %d external file%s\n", + h5tools_str_append(&buffer, " %-10s %d external file%s\n", "Extern:", nf, 1==nf?"":"s"); - printf(" %4s %10s %10s %10s %s\n", + h5tools_str_append(&buffer, " %4s %10s %10s %10s %s\n", "ID", "DSet-Addr", "File-Addr", "Bytes", "File"); - printf(" %4s %10s %10s %10s ", + h5tools_str_append(&buffer, " %4s %10s %10s %10s ", "----", "----------", "----------", "----------"); - for (i=0; i<max_len; i++) putchar('-'); - putchar('\n'); + for (i=0; i<max_len; i++) h5tools_str_append(&buffer, "-"); + h5tools_str_append(&buffer, "\n"); for (i=0, total=0; i<nf; i++) { if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, &f_offset, &f_size)<0) { - HDfprintf(stdout, - " #%03d %10Hu %10s %10s ***ERROR*** %s\n", + h5tools_str_append(&buffer, + " #%03d %10"HSIZE_T_FORMAT"u %10s %10s ***ERROR*** %s\n", i, total, "", "", i+1<nf?"Following addresses are incorrect":""); - } else if (H5S_UNLIMITED==f_size) { - HDfprintf(stdout, " #%03d %10Hu %10Hu %10s ", + } + else if (H5S_UNLIMITED==f_size) { + h5tools_str_append(&buffer, " #%03d %10"HSIZE_T_FORMAT"u %10"HSIZE_T_FORMAT"u %10s ", i, total, (hsize_t)f_offset, "INF"); - display_string(stdout, f_name, TRUE); - } else { - HDfprintf(stdout, " #%03d %10Hu %10Hu %10Hu ", + print_string(&buffer, f_name, TRUE); + } + else { + h5tools_str_append(&buffer, " #%03d %10"HSIZE_T_FORMAT"u %10"HSIZE_T_FORMAT"u %10"HSIZE_T_FORMAT"u ", i, total, (hsize_t)f_offset, f_size); - display_string(stdout, f_name, TRUE); + print_string(&buffer, f_name, TRUE); } - putchar('\n'); + h5tools_str_append(&buffer, "\n"); total += f_size; } - printf(" %4s %10s %10s %10s ", + h5tools_str_append(&buffer, " %4s %10s %10s %10s ", "----", "----------", "----------", "----------"); for (i=0; i<max_len; i++) - putchar('-'); - putchar('\n'); + h5tools_str_append(&buffer, "-"); + h5tools_str_append(&buffer, "\n"); } /* end if */ /* Print information about raw data filters */ @@ -2903,20 +1861,21 @@ dataset_list2(hid_t dset, const char UNUSED *name) cd_values, sizeof(f_name), f_name, NULL); f_name[sizeof(f_name) - 1] = '\0'; sprintf(s, "Filter-%d:", i); - printf(" %-10s %s-%u %s {", s, + h5tools_str_append(&buffer, " %-10s %s-%u %s {", s, (f_name[0] ? f_name : "method"), (unsigned)filt_id, ((filt_flags & H5Z_FLAG_OPTIONAL) ? "OPT" : "")); for(cd_num = 0; cd_num < cd_nelmts; cd_num++) - printf("%s%u", (cd_num ? ", " : ""), cd_values[cd_num]); - printf("}\n"); + h5tools_str_append(&buffer, "%s%u", (cd_num ? ", " : ""), cd_values[cd_num]); + h5tools_str_append(&buffer, "}\n"); } /* end for */ } /* end if */ /* Print data type */ - printf(" %-10s ", "Type:"); - display_type(type, 15); - printf("\n"); + h5tools_str_append(&buffer, " %-10s ", "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); /* Print address information */ if(address_g) @@ -2928,6 +1887,8 @@ dataset_list2(hid_t dset, const char UNUSED *name) H5Pclose(dcpl); } /* end if */ + h5tools_str_close(&buffer); + if(data_g) dump_dataset_values(dset); @@ -2956,9 +1917,23 @@ static herr_t datatype_list2(hid_t type, const char UNUSED *name) { if (verbose_g>0) { - printf(" %-10s ", "Type:"); - display_type(type, 15); - printf("\n"); + 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, " %-10s ", "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); + + h5tools_str_close(&buffer); } return 0; } @@ -2981,29 +1956,43 @@ datatype_list2(hid_t type, const char UNUSED *name) static herr_t list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void *_iter) { - H5O_type_t obj_type = oinfo->type; /* Type of the object */ - iter_t *iter = (iter_t*)_iter; + H5O_type_t obj_type = oinfo->type; /* Type of the object */ + iter_t *iter = (iter_t*)_iter; + 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); /* Print the link's name, either full name or base name */ if(!iter->symlink_target) - display_obj_name(stdout, iter, name, ""); + print_obj_name(&buffer, iter, name, ""); /* Check object information */ if(oinfo->type < 0 || oinfo->type >= H5O_TYPE_NTYPES) { - printf("Unknown type(%d)", (int)oinfo->type); + h5tools_str_append(&buffer, "Unknown type(%d)", (int)oinfo->type); obj_type = H5O_TYPE_UNKNOWN; } if(iter->symlink_target) - fputc('{', stdout); + h5tools_str_append(&buffer, "{"); if(obj_type >= 0 && dispatch_g[obj_type].name) - fputs(dispatch_g[obj_type].name, stdout); + h5tools_str_append(&buffer, "%s", dispatch_g[obj_type].name); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); /* Check if we've seen this object before */ if(first_seen) { - printf(", same as "); - display_string(stdout, first_seen, TRUE); - if(!iter->symlink_target) - printf("\n"); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, ", same as "); + print_string(&buffer, first_seen, TRUE); + if(!iter->symlink_target) { + h5tools_str_append(&buffer, "\n"); + } + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); } /* end if */ else { hid_t obj = (-1); /* ID of object opened */ @@ -3012,15 +2001,20 @@ 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"); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " *ERROR*\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); goto done; } /* end if */ /* List the first line of information for the object. */ if(obj_type >= 0 && dispatch_g[obj_type].list1) (dispatch_g[obj_type].list1)(obj); - if(!iter->symlink_target || (verbose_g > 0)) - putchar('\n'); + if(!iter->symlink_target || (verbose_g > 0)) { + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + } /* Show detailed information about the object, beginning with information * which is common to all objects. */ @@ -3034,8 +2028,10 @@ 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); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", oinfo->fileno, oinfo->addr); + h5tools_str_append(&buffer, " %-10s %u\n", "Links:", (unsigned)oinfo->rc); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); /* Modification time */ if(oinfo->mtime > 0) { @@ -3048,7 +2044,9 @@ 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); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " %-10s %s\n", "Modified:", buf); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); } /* end if */ } /* end if */ @@ -3064,9 +2062,11 @@ 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("\""); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " %-10s \"", "Comment:"); + print_string(&buffer, comment, FALSE); + h5tools_str_append(&buffer, "\"\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); } /* end if */ HDfree(comment); } @@ -3084,9 +2084,13 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void done: if(iter->symlink_target) { - fputs("}\n", stdout); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "}\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); iter->symlink_target = FALSE; } + h5tools_str_close(&buffer); + return 0; } /* end list_obj() */ @@ -3112,7 +2116,17 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) char *buf=NULL; iter_t *iter = (iter_t*)_iter; int ret; + hsize_t curr_pos = 0; /* total data element position */ h5tool_link_info_t lnk_info; + 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); /* init linkinfo struct */ HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t)); @@ -3122,14 +2136,14 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) lnk_info.opt.msg_mode=1; /* Print the link's name, either full name or base name */ - display_obj_name(stdout, iter, name, ""); + print_obj_name(&buffer, 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; @@ -3137,20 +2151,24 @@ 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); + h5tools_str_append(&buffer, "Soft Link {"); + h5tools_str_append(&buffer, buf); + h5tools_str_append(&buffer, "}"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); if(follow_symlink_g) { hbool_t orig_grp_literal = grp_literal_g; - HDfputc(' ', stdout); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " "); /* Check if we have already seen this softlink */ if(symlink_is_visited(iter->symlink_list, linfo->type, NULL, buf)) { - HDfputs("{Already Visited}\n", stdout); + h5tools_str_append(&buffer, "{Already Visited}\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); goto done; } + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); /* Add this link to the list of seen softlinks */ if(symlink_visit_add(iter->symlink_list, linfo->type, NULL, buf) < 0) @@ -3173,8 +2191,11 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) grp_literal_g = orig_grp_literal; } - else - HDfputc('\n', stdout); + else { + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + } break; @@ -3187,7 +2208,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; @@ -3198,27 +2219,31 @@ 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); + h5tools_str_append(&buffer, "External Link {"); + h5tools_str_append(&buffer, filename); + h5tools_str_append(&buffer, "/"); if(*path != '/') - HDfputc('/', stdout); - HDfputs(path, stdout); - HDfputc('}', stdout); + h5tools_str_append(&buffer, "/"); + h5tools_str_append(&buffer, path); + h5tools_str_append(&buffer, "}"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); /* 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); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, " "); /* Check if we have already seen this elink */ if(symlink_is_visited(iter->symlink_list, linfo->type, filename, path)) { - HDfputs("{Already Visited}\n", stdout); + h5tools_str_append(&buffer, "{Already Visited}\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); goto done; } + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); /* Add this link to the list of seen elinks */ if(symlink_visit_add(iter->symlink_list, linfo->type, filename, path) < 0) @@ -3244,17 +2269,19 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) grp_literal_g = orig_grp_literal; } else - HDfputc('\n', stdout); - + HDfprintf(rawoutstream, "\n"); } break; default: - HDfputs("UD Link {cannot follow UD links}\n", stdout); + h5tools_str_append(&buffer, "UD Link {cannot follow UD links}\n"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); break; } /* end switch */ done: + h5tools_str_close(&buffer); + if (buf) HDfree(buf); return 0; @@ -3279,25 +2306,40 @@ done: static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter) { + int retval = 0; H5O_info_t oi; /* Information for object */ + hsize_t curr_pos = 0; /* total data element position */ + h5tool_link_info_t lnk_info; + 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); /* 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); + h5tools_str_append(&buffer, "{**NOT FOUND**}\n"); iter->symlink_target = FALSE; } else - display_obj_name(stdout, iter, oname, "**NOT FOUND**"); - return -1; + print_obj_name(&buffer, iter, oname, "**NOT FOUND**"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + retval = -1; + goto done; } /* end if */ /* Check for group iteration */ 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); - return 0; /* Previously "continue", when this code was in main(). + h5tools_str_append(&buffer, "%s: unable to open '%s' as group\n", iter->fname, oname); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); + goto done; /* 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. */ } /* end if */ @@ -3321,7 +2363,10 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) list_obj(oname, &oi, NULL, iter); } /* end else */ - return 0; +done: + h5tools_str_close(&buffer); + + return retval; } @@ -3352,8 +2397,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) { @@ -3424,14 +2469,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; } @@ -3460,7 +2505,7 @@ leave(int ret) { h5tools_close(); - exit(ret); + HDexit(ret); } @@ -3712,7 +2757,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 */ @@ -3727,7 +2772,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; @@ -3740,7 +2785,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'; @@ -3774,7 +2819,19 @@ 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**"); + hsize_t curr_pos = 0; /* total data element position */ + h5tool_link_info_t lnk_info; + 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); + print_obj_name(&buffer, &iter, oname, "**NOT FOUND**"); + h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, info->line_ncols, 0, 0); leave(EXIT_FAILURE); } /* end if */ } /* end if */ diff --git a/tools/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in index e2c204b..110c651 100644 --- a/tools/h5ls/testh5ls.sh.in +++ b/tools/h5ls/testh5ls.sh.in @@ -25,13 +25,13 @@ H5LS_BIN=`pwd`/$H5LS # The path of the tool binary CMP='cmp -s' DIFF='diff -c' CP='cp' -NLINES=20 # Max. lines of output to display if test fails +NLINES=20 # Max. lines of output to display if test fails WORDS_BIGENDIAN="@WORDS_BIGENDIAN@" nerrors=0 verbose=yes -h5haveexitcode=yes # default is yes +h5haveexitcode=yes # default is yes # The build (current) directory might be different than the source directory. if test -z "$srcdir"; then srcdir=. @@ -131,6 +131,7 @@ $SRC_H5LS_TESTFILES/tgroup-2.ls $SRC_H5LS_TESTFILES/tgroup-3.ls $SRC_H5LS_TESTFILES/thlink-1.ls $SRC_H5LS_TESTFILES/tloop-1.ls +$SRC_H5LS_TESTFILES/tmultifile.ls $SRC_H5LS_TESTFILES/tnestcomp-1.ls $SRC_H5LS_TESTFILES/tnestcomp-2.ls $SRC_H5LS_TESTFILES/tnestcomp-3.ls @@ -322,6 +323,11 @@ TOOLTEST tsoftlinks-nodangle-1.ls 1 -w80 --follow-symlinks --no-dangling-links t # when used file with no dangling links - expected exit code 0 TOOLTEST thlinks-nodangle-1.ls 0 -w80 --follow-symlinks --no-dangling-links thlink.h5 +# test for wildcards in filename (does not work with cmake) +# this h5ls test script does not pass the filename properly like the h5dump test script??? +#TOOLTEST tstarfile.ls 0 -w80 t*link.h5 +#TOOLTEST tqmarkfile.ls 0 -w80 t?link.h5 +TOOLTEST tmultifile.ls 0 -w80 thlink.h5 tslink.h5 # tests for hard links TOOLTEST thlink-1.ls 0 -w80 thlink.h5 diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 3b00327..28d66c5 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -493,24 +493,24 @@ int copy_attr(hid_t loc_in, type_class = H5Tget_class(wtype_id); is_ref = (type_class == H5T_REFERENCE); if (type_class == H5T_VLEN ||type_class == H5T_ARRAY ) { - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - is_ref = (is_ref || (H5Tget_class(base_type)==H5T_REFERENCE)); - H5Tclose(base_type); + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + is_ref = (is_ref || (H5Tget_class(base_type)==H5T_REFERENCE)); + H5Tclose(base_type); } if (type_class == H5T_COMPOUND) { - int nmembers = H5Tget_nmembers(wtype_id) ; - for (j=0; j<nmembers; j++) { - hid_t mtid = H5Tget_member_type( wtype_id, j ); - H5T_class_t mtclass = H5Tget_class(mtid); - H5Tclose(mtid); - - if (mtclass==H5T_REFERENCE) { - is_ref = 1; - break; - } - } /* for (j=0; i<nmembers; j++) */ + int nmembers = H5Tget_nmembers(wtype_id) ; + for (j=0; j<nmembers; j++) { + hid_t mtid = H5Tget_member_type( wtype_id, j ); + H5T_class_t mtclass = H5Tget_class(mtid); + H5Tclose(mtid); + + if (mtclass==H5T_REFERENCE) { + is_ref = 1; + break; + } + } /* for (j=0; i<nmembers; j++) */ } /* if (type_class == H5T_COMPOUND) */ if(is_ref) { @@ -1002,7 +1002,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 d96e08b..55cf932 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -53,6 +53,7 @@ * local functions *------------------------------------------------------------------------- */ +static int Get_hyperslab (hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p); static void print_dataset_info(hid_t dcpl_id,char *objname,double per, int pr); static int do_copy_objects(hid_t fidin,hid_t fidout,trav_table_t *travt,pack_opt_t *options); static int copy_user_block(const char *infile, const char *outfile, hsize_t size); @@ -491,6 +492,184 @@ out: } /*------------------------------------------------------------------------- +* Function: Get_hyperslab +* +* Purpose: Calulate a hyperslab from a dataset for higher performance. +* The size of hyperslab is limitted by H5TOOLS_BUFSIZE. +* Return the hyperslab dimentions and size in byte. +* +* Return: 0 - SUCCEED, -1 FAILED +* +* Parameters: +* dcpl_id : [IN] dataset creation property. +* rank_dset : [IN] dataset rank +* dims_dset[] : [IN] dataset dimentions +* size_datum : [IN] size of a data element in byte +* dims_hslab[] : [OUT] calculated hyperslab dimentions +* * hslab_nbytes_p : [OUT] total byte of the hyperslab +* +* Programmer: Jonathan Kim +* Date: Feburary, 2012 +* Update: +* The hyperslab calucation would be depend on if the dataset is chunked +* or not. +* +* There care 3 conditions to cover: +* 1. If chunked and a chunk fits in buffer, each chunk would be a unit of +* collection and the boundary would be dataset's dims. +* 2. If chunked but a chunk doesn't fit in buffer, each data element would +* be a unit of collection and the boundary would be the chunk itself. +* 3. If not chunked, each data element would be a unit of collection and +* the boundary would be dataset's dims. +* +* The calulation starts from the last dimention (h5dump dims output). +* +* Note: +* Added for JIRA HDFFV-7862. +*-----------------------------------------*/ + +int Get_hyperslab (hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], + size_t size_datum, + hsize_t dims_hslab[], hsize_t * hslab_nbytes_p) +{ + int status = 0; + int k; + H5D_layout_t dset_layout; + int rank_chunk; + hsize_t dims_chunk[H5S_MAX_RANK]; + hsize_t size_chunk=1; + hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ + hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */ + hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */ + hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */ + hsize_t hslab_nbytes; /* size of hyperslab in byte */ + + /* init to set as size of a data element */ + hslab_nbytes = size_datum; + + /* get layout of dataset */ + dset_layout = H5Pget_layout(dcpl_id); + + /* if dataset is chunked */ + if ( dset_layout == H5D_CHUNKED ) + { + /* get chunk dims */ + rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk); + if (rank_chunk < 0) + { + status = -1; + goto out; + } + + for (k = rank_dset; k > 0; --k) + size_chunk *= dims_chunk[k-1]; + + /* figure out how many chunks can fit in the hyperslab buffer */ + nchunk_fit = (H5TOOLS_BUFSIZE / size_datum) / size_chunk; + + + /* 1. if a chunk fit in hyperslab buffer */ + if (nchunk_fit >= 1) + { + /* Calulate a hyperslab that contains as many chunks that can fit + * in hyperslab buffer. Hyperslab will be increased starting from + * the last dimention of the dataset (see h5dump's dims output). + * The calculation boundary is dataset dims. + * In the loop, used mapping from a datum to a chunk to figure out + * chunk based hyperslab. + */ + for (k = rank_dset; k > 0; --k) + { + /* map dataset dimentions with a chunk dims */ + chunk_dims_map[k-1]= dims_dset[k-1] / dims_chunk[k-1]; + + /* if reminder exist, increse by 1 to cover partial edge chunks */ + if (dims_dset[k-1] % dims_chunk[k-1] > 0) + chunk_dims_map[k-1]++; + + /* get mapped hyperslab dims */ + hs_dims_map[k-1] = MIN (nchunk_fit, chunk_dims_map[k-1]); + + /* prepare next round */ + nchunk_fit = nchunk_fit / chunk_dims_map[k-1]; + /* if a chunk is bigger than the rest of buffer */ + if (nchunk_fit == 0) + nchunk_fit=1; + + /* get hyperslab dimentions as unmapping to actual size */ + dims_hslab[k-1] = MIN( (hs_dims_map[k-1] * dims_chunk[k-1]), dims_dset[k-1]); + + /* calculate total size for the hyperslab */ + hslab_nbytes *= dims_hslab[k-1]; + } + } + /* 2. if a chunk is bigger than hyperslab buffer */ + else + { + /* Calulate a hyperslab that contains as many data elements that + * can fit in hyperslab buffer. Hyperslab will be increased + * starting from the last dimention of the chunk (see h5dump's dims + * output). + * The calculation boundary is a chunk dims. + */ + for (k = rank_dset; k > 0; --k) + { + ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; + + /* if a datum is bigger than rest of buffer */ + if ( ndatum_fit == 0) + ndatum_fit = 1; + /* get hyperslab dimentions within a chunk boundary */ + dims_hslab[k - 1] = MIN (dims_chunk[k-1], ndatum_fit); + + /* calculate total size for the hyperslab */ + hslab_nbytes *= dims_hslab[k - 1]; + + if (hslab_nbytes <= 0) + { + status = -1; + goto out; + } + } + } + } + /* 3. if dataset is not chunked */ + else + { + /* Calulate a hyperslab that contains as many data elements that can + * fit in hyperslab buffer. Hyperslab will be increased starting from + * the last dimention of the dataset (see h5dump's dims output). + * The calculation boundary is dataset dims. + */ + for (k = rank_dset; k > 0; --k) + { + ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes; + + /* if a datum is bigger than rest of buffer */ + if ( ndatum_fit == 0) + ndatum_fit = 1; + /* get hyperslab dimentions within dataset boundary */ + dims_hslab[k - 1] = MIN(dims_dset[k - 1], ndatum_fit); + + /* calculate total size for the hyperslab */ + hslab_nbytes *= dims_hslab[k - 1]; + + if (hslab_nbytes <= 0) + { + status = -1; + goto out; + } + } + } + + /* pass out the hyperslab size*/ + *hslab_nbytes_p = hslab_nbytes; + +out: + return status; +} + +/*------------------------------------------------------------------------- * Function: do_copy_objects * * Purpose: duplicate all HDF5 objects in the file @@ -557,6 +736,30 @@ out: * * May, 1, 2008: Add a printing of the compression ratio of old size / new size * +* Feburary 2012: improve Read/Write by hyperslabs for big datasets. +* Programmer: Jonathan Kim +* +* A threshold of H5TOOLS_MALLOCSIZE is the limit upon which I/O hyperslab is done +* i.e., if the memory needed to read a dataset is greater than this limit, +* then hyperslab I/O is done instead of one operation I/O +* For each dataset, the memory needed is calculated according to +* +* memory needed = number of elements * size of each element +* +* if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations +* are done +* +* H5Dread( input_dataset ) +* H5Dwrite( output_dataset ) +* +* with all elements in the datasets selected. If the memory needed is greater than +* H5TOOLS_MALLOCSIZE, then the following operations are done instead: +* +* 1. figure out a hyperslab (dimentions) and size (refer to Get_hyperslab()). +* 2. Calculate the hyperslab selections as the selection is moving forward. +* Selection would be same as the hyperslab except for the remaining edge portion +* of the dataset. The code take care of the remaining portion if exist. +* *------------------------------------------------------------------------- */ @@ -573,7 +776,7 @@ int do_copy_objects(hid_t fidin, hid_t gcpl_out = -1; /* group creation property list */ hid_t type_in = -1; /* named type ID */ hid_t type_out = -1; /* named type ID */ - hid_t dcpl_id = -1; /* dataset creation property list ID */ + hid_t dcpl_in = -1; /* dataset creation property list ID */ hid_t dcpl_out = -1; /* dataset creation property list ID */ hid_t f_space_id = -1; /* file space ID */ hid_t ftype_id = -1; /* file type ID */ @@ -589,7 +792,7 @@ int do_copy_objects(hid_t fidin, int apply_s; /* flag for apply filter to small dataset sizes */ int apply_f; /* flag for apply filter to return error on H5Dcreate */ void *buf=NULL; /* buffer for raw data */ - void *sm_buf=NULL; /* buffer for raw data */ + void *hslab_buf=NULL; /* hyperslab buffer for raw data */ int has_filter; /* current object has a filter */ int req_filter; /* there was a request for a filter */ unsigned crt_order_flags; /* group creation order flag */ @@ -598,6 +801,7 @@ int do_copy_objects(hid_t fidin, int is_ref=0; htri_t is_named; + /*------------------------------------------------------------------------- * copy the suppplied object list *------------------------------------------------------------------------- @@ -760,9 +964,9 @@ int do_copy_objects(hid_t fidin, goto error; if((ftype_id = H5Dget_type(dset_in)) < 0) goto error; - if((dcpl_id = H5Dget_create_plist(dset_in)) < 0) + if((dcpl_in = H5Dget_create_plist(dset_in)) < 0) goto error; - if((dcpl_out = H5Pcopy(dcpl_id)) < 0) + if((dcpl_out = H5Pcopy(dcpl_in)) < 0) goto error; if((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) goto error; @@ -795,7 +999,7 @@ int do_copy_objects(hid_t fidin, * 2) the internal filters might be turned off *------------------------------------------------------------------------- */ - if (h5tools_canreadf((travt->objs[i].name),dcpl_id)==1) + if (h5tools_canreadf((travt->objs[i].name),dcpl_in)==1) { apply_s=1; apply_f=1; @@ -855,7 +1059,7 @@ int do_copy_objects(hid_t fidin, printf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name); - if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0) goto error; apply_f = 0; } @@ -886,100 +1090,108 @@ int do_copy_objects(hid_t fidin, else /* possibly not enough memory, read/write by hyperslabs */ { size_t p_type_nbytes = msize; /*size of memory type */ - hsize_t p_nelmts = nelmts; /*total selected elmts */ + hsize_t p_nelmts = nelmts; /*total elements */ hsize_t elmtno; /*counter */ int carry; /*counter carry value */ unsigned int vl_data = 0; /*contains VL datatypes */ - /* 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*/ - 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 */ + hsize_t hslab_dims[H5S_MAX_RANK]; /*hyperslab dims */ + hsize_t hslab_nbytes; /*bytes per hyperslab */ + hsize_t hslab_nelmts; /*elements per hyperslab*/ + hid_t hslab_space; /*hyperslab data space */ + + /* hyperslab selection info */ + hsize_t hs_sel_offset[H5S_MAX_RANK];/* selection offset */ + hsize_t hs_sel_count[H5S_MAX_RANK]; /* selection count */ + hsize_t hs_select_nelmts; /* selected elements */ hsize_t zero[8]; /*vector of zeros */ int k; + H5D_layout_t dset_layout; + hid_t dcpl_tmp = -1; /* dataset creation property list ID */ /* check if we have VL data in the dataset's datatype */ if (H5Tdetect_class(wtype_id, 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; - for (k = rank; k > 0; --k) + /* check first if writing dataset is chunked, + * if so use its chunk layout for better performance. */ + dset_layout = H5Pget_layout(dcpl_out); + if (dset_layout == H5D_CHUNKED) + dcpl_tmp = dcpl_out; /* writing dataset */ + else /* if reading dataset is chunked */ { - hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; - if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ - size = 1; - sm_size[k - 1] = MIN(dims[k - 1], size); - sm_nbytes *= sm_size[k - 1]; - HDassert(sm_nbytes > 0); + dset_layout = H5Pget_layout(dcpl_in); + if (dset_layout == H5D_CHUNKED) + dcpl_tmp = dcpl_in; /* reading dataset */ } - sm_buf = HDmalloc((size_t)sm_nbytes); - sm_nelmts = sm_nbytes / p_type_nbytes; - sm_space = H5Screate_simple(1, &sm_nelmts, NULL); + /* get hyperslab dims and size in byte */ + if(Get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0) + goto error; + + hslab_buf = HDmalloc((size_t)hslab_nbytes); + + hslab_nelmts = hslab_nbytes / p_type_nbytes; + hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL); - /* the stripmine loop */ - HDmemset(hs_offset, 0, sizeof hs_offset); + /* the hyperslab selection loop */ + HDmemset(hs_sel_offset, 0, sizeof hs_sel_offset); HDmemset(zero, 0, sizeof zero); - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_select_nelmts) { - /* calculate the hyperslab size */ if (rank > 0) { - for (k = 0, hs_nelmts = 1; k < rank; k++) + /* calculate the hyperslab selections. The selection would be same as the hyperslab except for remaining edge portion of the dataset which is smaller then the hyperslab. + */ + for (k = 0, hs_select_nelmts = 1; k < rank; k++) { - hs_size[k] = MIN(dims[k] - hs_offset[k], sm_size[k]); - hs_nelmts *= hs_size[k]; + /* MIN() is used to get the remaining edge portion if exist. + * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is smaller then the hyperslab.*/ + hs_sel_count[k] = MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]); + hs_select_nelmts *= hs_sel_count[k]; } - if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) + if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_sel_offset, NULL, hs_sel_count, NULL) < 0) goto error; - if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) + if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero, NULL, &hs_select_nelmts, NULL) < 0) goto error; } else { H5Sselect_all(f_space_id); - H5Sselect_all(sm_space); - hs_nelmts = 1; + H5Sselect_all(hslab_space); + hs_select_nelmts = 1; } /* rank */ /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */ - CHECK_H5DRW_ERROR(H5Dread, dset_in, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf); - CHECK_H5DRW_ERROR(H5Dwrite, dset_out, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf); + CHECK_H5DRW_ERROR(H5Dread, dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf); + CHECK_H5DRW_ERROR(H5Dwrite, dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf); /* reclaim any VL memory, if necessary */ if(vl_data) - H5Dvlen_reclaim(wtype_id, sm_space, H5P_DEFAULT, sm_buf); + H5Dvlen_reclaim(wtype_id, hslab_space, H5P_DEFAULT, hslab_buf); /* calculate the next hyperslab offset */ for (k = rank, carry = 1; k > 0 && carry; --k) { - hs_offset[k - 1] += hs_size[k - 1]; - if (hs_offset[k - 1] == dims[k - 1]) - hs_offset[k - 1] = 0; + hs_sel_offset[k - 1] += hs_sel_count[k - 1]; + /* if reached the end of a dim */ + if (hs_sel_offset[k - 1] == dims[k - 1]) + hs_sel_offset[k - 1] = 0; else carry = 0; } /* k */ } /* elmtno */ - H5Sclose(sm_space); + H5Sclose(hslab_space); /* free */ - if (sm_buf!=NULL) + if (hslab_buf!=NULL) { - HDfree(sm_buf); - sm_buf=NULL; + HDfree(hslab_buf); + hslab_buf=NULL; } } /* hyperslab read */ } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */ @@ -1005,7 +1217,7 @@ int do_copy_objects(hid_t fidin, print_dataset_info(dcpl_out,travt->objs[i].name,ratio,1); } else - print_dataset_info(dcpl_id,travt->objs[i].name,ratio,0); + print_dataset_info(dcpl_in,travt->objs[i].name,ratio,0); /* print a message that the filter was not applied (in case there was a filter) @@ -1044,7 +1256,7 @@ int do_copy_objects(hid_t fidin, goto error; if (H5Tclose(wtype_id) < 0) goto error; - if (H5Pclose(dcpl_id) < 0) + if (H5Pclose(dcpl_in) < 0) goto error; if (H5Pclose(dcpl_out) < 0) goto error; @@ -1199,7 +1411,7 @@ error: H5E_BEGIN_TRY { H5Gclose(grp_in); H5Gclose(grp_out); - H5Pclose(dcpl_id); + H5Pclose(dcpl_in); H5Pclose(gcpl_in); H5Pclose(gcpl_out); H5Sclose(f_space_id); @@ -1214,8 +1426,8 @@ error: /* free */ if (buf!=NULL) HDfree(buf); - if (sm_buf!=NULL) - HDfree(sm_buf); + if (hslab_buf!=NULL) + HDfree(hslab_buf); return -1; } diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 010d9f2..e1697ab 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" @@ -106,9 +107,12 @@ int main(int argc, const char **argv) h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); + /* Initialize h5tools lib */ + h5tools_init(); + /* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */ if ( h5tools_getenv_update_hyperslab_bufsize() < 0) - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); /* initialize options */ h5repack_init(&options, 0, 0, (hsize_t)0); @@ -128,7 +132,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); } } @@ -137,7 +141,7 @@ int main(int argc, const char **argv) { error_msg("file names missing\n"); usage(h5tools_getprogname()); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } @@ -320,10 +324,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; @@ -333,7 +337,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': @@ -342,18 +346,18 @@ 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; case 'm': - options->min_comp = atoi( opt_arg ); + options->min_comp = HDatoi( opt_arg ); if ((int)options->min_comp<=0) { error_msg("invalid minimum compress size <%s>\n", opt_arg ); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } break; @@ -371,7 +375,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) case 'c': - options->grp_compact = atoi( opt_arg ); + options->grp_compact = HDatoi( opt_arg ); if (options->grp_compact>0) options->latest = 1; /* must use latest format */ break; @@ -379,7 +383,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) case 'd': - options->grp_indexed = atoi( opt_arg ); + options->grp_indexed = HDatoi( opt_arg ); if (options->grp_indexed>0) options->latest = 1; /* must use latest format */ break; @@ -394,7 +398,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) options->latest = 1; /* must use latest format */ if (msgPtr == NULL) { - ssize = atoi( opt_arg ); + ssize = HDatoi( opt_arg ); for (idx=0; idx<5; idx++) options->msg_size[idx] = ssize; } @@ -403,7 +407,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) char msgType[10]; HDstrcpy(msgType, msgPtr+1); msgPtr[0] = '\0'; - ssize = atoi( opt_arg ); + ssize = HDatoi( opt_arg ); if (HDstrncmp(msgType, "dspace",6) == 0) { options->msg_size[0] = ssize; } @@ -432,26 +436,26 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) case 'b': - options->ublock_size = (hsize_t)atol( opt_arg ); + options->ublock_size = (hsize_t)HDatol( opt_arg ); break; case 't': - options->threshold = (hsize_t)atol( opt_arg ); + options->threshold = (hsize_t)HDatol( opt_arg ); break; case 'a': - options->alignment = atol( opt_arg ); + options->alignment = HDatol( opt_arg ); if ( options->alignment < 1 ) { error_msg("invalid alignment size\n", opt_arg ); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } break; case 'S': - { + { char strategy[MAX_NC_NAME]; HDstrcpy(strategy, opt_arg); @@ -465,14 +469,14 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) options->fs_strategy = H5F_FILE_SPACE_VFD; else { error_msg("invalid file space management strategy\n", opt_arg ); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } break; } case 'T': - options->fs_threshold = (hsize_t)atol( opt_arg ); + options->fs_threshold = (hsize_t)HDatol( opt_arg ); break; } /* switch */ @@ -486,7 +490,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); } } @@ -517,9 +521,9 @@ void read_info(const char *filename, char c; int i, rc=1; - if ((fp = fopen(filename, "r")) == (FILE *)NULL) { + if ((fp = HDfopen(filename, "r")) == (FILE *)NULL) { error_msg("cannot open options file %s\n", filename); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } /* cycle until end of file reached */ @@ -540,7 +544,7 @@ void read_info(const char *filename, while( c!=' ' ) { fscanf(fp, "%c", &c); - if (feof(fp)) break; + if (HDfeof(fp)) break; } c='0'; /* go until end */ @@ -549,14 +553,14 @@ void read_info(const char *filename, fscanf(fp, "%c", &c); comp_info[i]=c; i++; - if (feof(fp)) break; + if (HDfeof(fp)) break; if (c==10 /*eol*/) break; } comp_info[i-1]='\0'; /*cut the last " */ if (h5repack_addfilter(comp_info,options)==-1){ error_msg("could not add compression option\n"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -570,7 +574,7 @@ void read_info(const char *filename, while( c!=' ' ) { fscanf(fp, "%c", &c); - if (feof(fp)) break; + if (HDfeof(fp)) break; } c='0'; /* go until end */ @@ -579,14 +583,14 @@ void read_info(const char *filename, fscanf(fp, "%c", &c); comp_info[i]=c; i++; - if (feof(fp)) break; + if (HDfeof(fp)) break; if (c==10 /*eol*/) break; } comp_info[i-1]='\0'; /*cut the last " */ if (h5repack_addlayout(comp_info,options)==-1){ error_msg("could not add chunck option\n"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -595,10 +599,10 @@ void read_info(const char *filename, */ else { error_msg("bad file format for %s", filename); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } - fclose(fp); + HDfclose(fp); return; } diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index 01ee018..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,7 +156,7 @@ 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"); HDfree(table); @@ -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 5258c4e..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]; @@ -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"); @@ -115,7 +116,7 @@ obj_list_t* parse_filter(const char *str, { if (obj_list) HDfree(obj_list); error_msg("input Error: Invalid compression type in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } @@ -153,7 +154,7 @@ obj_list_t* parse_filter(const char *str, if (!isdigit(c) && l==-1){ 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); } @@ -213,7 +214,7 @@ obj_list_t* parse_filter(const char *str, if (!isdigit(c) && l==-1){ 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); } } @@ -257,7 +258,7 @@ obj_list_t* parse_filter(const char *str, if (!isdigit(c)){ 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 */ @@ -303,7 +304,7 @@ obj_list_t* parse_filter(const char *str, { /*no more parameters, GZIP must have parameter */ if (obj_list) HDfree(obj_list); error_msg("missing compression parameter in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } @@ -319,7 +320,7 @@ obj_list_t* parse_filter(const char *str, { /*no more parameters, SZIP must have parameter */ if (obj_list) HDfree(obj_list); error_msg("missing compression parameter in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } @@ -335,7 +336,7 @@ obj_list_t* parse_filter(const char *str, { /*shuffle does not have parameter */ if (obj_list) HDfree(obj_list); error_msg("extra parameter in SHUF <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -350,7 +351,7 @@ obj_list_t* parse_filter(const char *str, { /*shuffle does not have parameter */ if (obj_list) HDfree(obj_list); error_msg("extra parameter in FLET <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -365,7 +366,7 @@ obj_list_t* parse_filter(const char *str, { /*nbit does not have parameter */ if (obj_list) HDfree(obj_list); error_msg("extra parameter in NBIT <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } /*------------------------------------------------------------------------- @@ -380,13 +381,13 @@ obj_list_t* parse_filter(const char *str, { /*no more parameters, SOFF must have parameter */ 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) HDfree(obj_list); error_msg("invalid filter type in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } } } /*i*/ @@ -409,7 +410,7 @@ obj_list_t* parse_filter(const char *str, { if (obj_list) HDfree(obj_list); error_msg("invalid compression parameter in <%s>\n",str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } break; @@ -424,19 +425,19 @@ obj_list_t* parse_filter(const char *str, { 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) 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) HDfree(obj_list); error_msg("szip mask must be 'NN' or 'EC' \n"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } break; default: @@ -479,7 +480,7 @@ 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]; @@ -509,7 +510,7 @@ obj_list_t* parse_layout(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"); @@ -537,7 +538,7 @@ obj_list_t* parse_layout(const char *str, { if (obj_list) HDfree(obj_list); error_msg("in parse layout, no characters after : in <%s>\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 @@ -578,7 +579,7 @@ obj_list_t* parse_layout(const char *str, { 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<len; i++) @@ -593,7 +594,7 @@ obj_list_t* parse_layout(const char *str, if (obj_list) HDfree(obj_list); error_msg("in parse layout, <%s> Not a valid character in <%s>\n", sdim,str); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } if ( c=='x' || i==len-1) @@ -606,7 +607,7 @@ obj_list_t* parse_layout(const char *str, 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++; } @@ -624,7 +625,7 @@ obj_list_t* parse_layout(const char *str, 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 915b0e9..7108491 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -28,7 +28,7 @@ static const char* MapIdToName(hid_t refobj_id,trav_table_t *travt); static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options, trav_table_t *travt, hid_t fidout); static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, - hid_t fid_out, void *ref_out, trav_table_t *travt); + hid_t fid_out, void *ref_out, trav_table_t *travt); /*------------------------------------------------------------------------- * Function: do_copy_refobjs @@ -432,13 +432,13 @@ error: * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * * Modifier: xcao@hdfgroup.org, 9/12/2011 - * Update values of references(object and region) for the following types: + * Update values of references(object and region) for the following types: * 1) References, * 2) ARRAY of reference, * 3) VLEN of references. * 4) COMPOUND of references. * This function does not handle references in other complicated structures, - * such as references in nested compound datatypes. + * such as references in nested compound datatypes. * * Date: October, 28, 2003 * @@ -479,7 +479,7 @@ static int copy_refs_attr(hid_t loc_in, for(u = 0; u < (unsigned)oinfo.num_attrs; u++) { - is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0; + is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0; /* open attribute */ if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -500,39 +500,39 @@ static int copy_refs_attr(hid_t loc_in, is_ref = (type_class == H5T_REFERENCE); if (type_class == H5T_VLEN ) { - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - is_ref_vlen = (H5Tget_class(base_type)==H5T_REFERENCE); - msize = H5Tget_size(base_type); - H5Tclose(base_type); + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + is_ref_vlen = (H5Tget_class(base_type)==H5T_REFERENCE); + msize = H5Tget_size(base_type); + H5Tclose(base_type); } if (type_class == H5T_ARRAY ) { - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - is_ref_array = (H5Tget_class(base_type)==H5T_REFERENCE); - msize = H5Tget_size(base_type); - H5Tclose(base_type); + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + is_ref_array = (H5Tget_class(base_type)==H5T_REFERENCE); + msize = H5Tget_size(base_type); + H5Tclose(base_type); } if (type_class == H5T_COMPOUND) { - int nmembers = H5Tget_nmembers(ftype_id) ; - if (nmembers < 1) - goto error; + int nmembers = H5Tget_nmembers(ftype_id) ; + if (nmembers < 1) + goto error; ref_comp_index = (int *)HDmalloc(nmembers*sizeof (int)); ref_comp_size = (size_t *)HDmalloc(nmembers*sizeof(ref_comp_size)); ref_comp_field_n = 0; - for (i=0; i<(unsigned)nmembers; i++) { - hid_t mtid = H5Tget_member_type( ftype_id, i ); - if ((H5Tget_class(mtid)==H5T_REFERENCE)) { - ref_comp_index[ref_comp_field_n] = i; - ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid); - ref_comp_field_n++; - } - H5Tclose(mtid); - } + for (i=0; i<(unsigned)nmembers; i++) { + hid_t mtid = H5Tget_member_type( ftype_id, i ); + if ((H5Tget_class(mtid)==H5T_REFERENCE)) { + ref_comp_index[ref_comp_field_n] = i; + ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid); + ref_comp_field_n++; + } + H5Tclose(mtid); + } /* if compound don't contain reference type member, free the above * mallocs. Otherwise there can be memory leaks by the 'continue' @@ -541,14 +541,14 @@ static int copy_refs_attr(hid_t loc_in, { if (ref_comp_index) { - HDfree(ref_comp_index); - ref_comp_index = NULL; + HDfree(ref_comp_index); + ref_comp_index = NULL; } if (ref_comp_size) { - HDfree(ref_comp_size); - ref_comp_size = NULL; + HDfree(ref_comp_size); + ref_comp_size = NULL; } } } @@ -556,10 +556,10 @@ static int copy_refs_attr(hid_t loc_in, is_ref_comp = (ref_comp_field_n > 0); if (!(is_ref || is_ref_vlen || is_ref_array || is_ref_comp)) { - H5Tclose(mtype_id); - H5Tclose(ftype_id); - H5Aclose(attr_id); - continue; + H5Tclose(mtype_id); + H5Tclose(ftype_id); + H5Aclose(attr_id); + continue; } /* get name */ @@ -584,18 +584,18 @@ static int copy_refs_attr(hid_t loc_in, nelmts *= dims[j]; if (is_ref_array) { - unsigned array_rank = 0; - hsize_t array_size = 1; - hsize_t array_dims[H5S_MAX_RANK]; - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - msize = H5Tget_size(base_type); - H5Tclose(base_type); - - array_rank = H5Tget_array_ndims(mtype_id); - H5Tget_array_dims2(mtype_id, array_dims); + unsigned array_rank = 0; + hsize_t array_size = 1; + hsize_t array_dims[H5S_MAX_RANK]; + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + msize = H5Tget_size(base_type); + H5Tclose(base_type); + + array_rank = H5Tget_array_ndims(mtype_id); + H5Tget_array_dims2(mtype_id, array_dims); for(j = 0; j <array_rank; j++) - array_size *= array_dims[j]; + array_size *= array_dims[j]; nelmts *= array_size; } @@ -626,7 +626,7 @@ static int copy_refs_attr(hid_t loc_in, for(i = 0; i < (unsigned)nelmts; i++) { if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt)<0) - continue; + continue; if(options->verbose) printf("object <%s> reference created to <%s>\n", name, refname); } /* k */ @@ -657,13 +657,13 @@ static int copy_refs_attr(hid_t loc_in, for(i = 0; i < (unsigned)nelmts; i++) { if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt)<0) - continue; + continue; if(options->verbose) printf("object <%s> region reference created to <%s>\n", name, refname); } } /* H5T_STD_REF_DSETREG */ else if (is_ref_vlen) { - /* handle VLEN of references */ + /* handle VLEN of references */ buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t))); refbuf = buf; /* reuse the read buffer for write */ @@ -677,31 +677,31 @@ static int copy_refs_attr(hid_t loc_in, if(H5Aread(attr_id, mtype_id, buf) < 0) goto error; - if (H5R_OBJ_REF_BUF_SIZE==msize) { - hobj_ref_t ref_out; - for (i=0; i<(unsigned)nelmts; i++) { - hobj_ref_t *ptr = (hobj_ref_t *)((hvl_t *)buf)[i].p; - for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { - if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(&(ptr[j]), &ref_out, msize); - } - } /* for (i=0; i<nelems; i++) */ - } else if (H5R_DSET_REG_REF_BUF_SIZE == msize) { - - hdset_reg_ref_t ref_out; - for (i=0; i<(unsigned)nelmts; i++) { - hdset_reg_ref_t *ptr = (hdset_reg_ref_t *)((hvl_t *)buf)[i].p; - for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { - if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(&(ptr[j]), &ref_out, msize); - } - } /* for (i=0; i<nelems; i++) */ - } + if (H5R_OBJ_REF_BUF_SIZE==msize) { + hobj_ref_t ref_out; + for (i=0; i<(unsigned)nelmts; i++) { + hobj_ref_t *ptr = (hobj_ref_t *)((hvl_t *)buf)[i].p; + for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { + if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(&(ptr[j]), &ref_out, msize); + } + } /* for (i=0; i<nelems; i++) */ + } else if (H5R_DSET_REG_REF_BUF_SIZE == msize) { + + hdset_reg_ref_t ref_out; + for (i=0; i<(unsigned)nelmts; i++) { + hdset_reg_ref_t *ptr = (hdset_reg_ref_t *)((hvl_t *)buf)[i].p; + for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { + if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(&(ptr[j]), &ref_out, msize); + } + } /* for (i=0; i<nelems; i++) */ + } } /* else if (is_ref_vlen) */ else if (is_ref_comp) { - /* handle ref fields in a compound */ + /* handle ref fields in a compound */ buf = HDmalloc((unsigned)(nelmts * msize)); refbuf = buf; /* reuse the read buffer for write */ @@ -716,22 +716,22 @@ static int copy_refs_attr(hid_t loc_in, goto error; for (i=0; i<(unsigned)nelmts; i++) { - for (j=0; j<(unsigned)ref_comp_field_n; j++) { - if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) { - int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); - hobj_ref_t ref_out; - if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); - } /* if */ - else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) { - int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); - hdset_reg_ref_t ref_out; - if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); - } /* else if */ - } /* j */ + for (j=0; j<(unsigned)ref_comp_field_n; j++) { + if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) { + int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); + hobj_ref_t ref_out; + if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); + } /* if */ + else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) { + int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); + hdset_reg_ref_t ref_out; + if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); + } /* else if */ + } /* j */ } /* i */ } /* else if (is_ref_comp) */ @@ -739,11 +739,11 @@ static int copy_refs_attr(hid_t loc_in, goto error; if (is_ref_vlen && buf) - H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf); + H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf); } /* if (nelmts) */ if (refbuf == buf) - refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */ + refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */ if(buf) { HDfree(buf); @@ -756,13 +756,13 @@ static int copy_refs_attr(hid_t loc_in, } if (ref_comp_index) { - HDfree(ref_comp_index); - ref_comp_index = NULL; + HDfree(ref_comp_index); + ref_comp_index = NULL; } if (ref_comp_size) { - HDfree(ref_comp_size); - ref_comp_size = NULL; + HDfree(ref_comp_size); + ref_comp_size = NULL; } if(H5Aclose(attr_out) < 0) @@ -785,16 +785,16 @@ static int copy_refs_attr(hid_t loc_in, return 0; error: - if(refbuf) - HDfree(refbuf); - if(buf) - HDfree(buf); + if(refbuf) + HDfree(refbuf); + if(buf) + HDfree(buf); if (ref_comp_index) - HDfree(ref_comp_index); + HDfree(ref_comp_index); if (ref_comp_size) - HDfree(ref_comp_size); + HDfree(ref_comp_size); H5E_BEGIN_TRY { H5Tclose(ftype_id); @@ -808,9 +808,9 @@ error: } /*------------------------------------------------------------------------- - * Function: MapIdToName + * Function: MapIdToName * - * Purpose: map a ID from a reference to a dataset name + * Purpose: map a ID from a reference to a dataset name * *------------------------------------------------------------------------- */ @@ -843,41 +843,41 @@ out: } /*------------------------------------------------------------------------- - * Function: Update_Ref_value + * Function: Update_Ref_value * - * Purpose: Update a reference value + * Purpose: Update a reference value * * Programmer: xcao@hdfgroup.org 9/12/2011 * *------------------------------------------------------------------------- */ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, - hid_t fid_out, void *ref_out, trav_table_t *travt) + hid_t fid_out, void *ref_out, trav_table_t *travt) { - herr_t ret = -1; - const char* ref_obj_name; - hid_t space_id=-1, ref_obj_id=-1; + herr_t ret = -1; + const char* ref_obj_name; + hid_t space_id=-1, ref_obj_id=-1; - ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in); - if (ref_obj_id<0) - goto done; + ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in); + if (ref_obj_id<0) + goto done; - ref_obj_name = MapIdToName(ref_obj_id, travt); - if (ref_obj_name == NULL) - goto done; + ref_obj_name = MapIdToName(ref_obj_id, travt); + if (ref_obj_name == NULL) + goto done; - if (ref_type == H5R_DATASET_REGION) { - space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in); - if (space_id < 0) - goto done; - } + if (ref_type == H5R_DATASET_REGION) { + space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in); + if (space_id < 0) + goto done; + } ret = H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id); if (ret < 0) - goto done; + goto done; - ret = 0; + ret = 0; done: H5E_BEGIN_TRY { @@ -885,6 +885,6 @@ done: H5Oclose(ref_obj_id); } H5E_END_TRY; - return ret; + return ret; } diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index b0ab1d1..47cba5b 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -14,16 +14,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" +#include "h5tools.h" #include "h5tools_utils.h" -static int verify_layout(hid_t pid, pack_info_t *obj); -static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter); - /* 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); +static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter); + /*------------------------------------------------------------------------- * Function: h5repack_verify @@ -301,9 +302,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 156038c..17a6190 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -176,6 +176,12 @@ int main (void) int szip_can_encode = 0; #endif + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); + + /* Initialize h5tools lib */ + h5tools_init(); + /* initialize */ HDmemset(&diff_options, 0, sizeof (diff_opt_t)); HDmemset(&pack_options, 0, sizeof (pack_opt_t)); 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 <stdio.h> #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..8c621c9 100644 --- a/tools/h5stat/CMakeLists.txt +++ b/tools/h5stat/CMakeLists.txt @@ -5,7 +5,6 @@ PROJECT (HDF5_TOOLS_H5STAT) # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) -INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- # Add the h5stat executables @@ -30,7 +29,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 $<TARGET_FILE:h5stat_gentest>) diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index 2155f95..e206f4f 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -232,28 +232,28 @@ static void leave(int ret) { h5tools_close(); - exit(ret); + 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 information\n"); - fprintf(stdout, " -A, --attribute Print attribute information\n"); - fprintf(stdout, " -s, --freespace Print free space information\n"); - fprintf(stdout, " -S, --summary Print summary of file space information\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 information\n"); + HDfprintf(stdout, " -A, --attribute Print attribute information\n"); + HDfprintf(stdout, " -s, --freespace Print free space information\n"); + HDfprintf(stdout, " -S, --summary Print summary of file space information\n"); } @@ -318,7 +318,7 @@ 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)); + iter->attr_bins = (unsigned long *)HDrealloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long)); HDassert(iter->attr_bins); /* Initialize counts for intermediate bins */ @@ -390,7 +390,7 @@ 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)); + iter->group_bins = (unsigned long *)HDrealloc(iter->group_bins, (bin + 1) * sizeof(unsigned long)); HDassert(iter->group_bins); /* Initialize counts for intermediate bins */ @@ -521,7 +521,7 @@ 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)); + 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 */ @@ -558,7 +558,7 @@ 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)); + 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 */ @@ -741,7 +741,7 @@ freespace_stats(hid_t fid, iter_t *iter) if((nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, 0, NULL)) < 0) return(FAIL); else if(nsects) { - if(NULL == (sect_info = (H5F_sect_info_t *)calloc((size_t)nsects, sizeof(H5F_sect_info_t)))) + if(NULL == (sect_info = (H5F_sect_info_t *)HDcalloc((size_t)nsects, sizeof(H5F_sect_info_t)))) return(FAIL); nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info); HDassert(nsects); @@ -757,7 +757,7 @@ freespace_stats(hid_t fid, iter_t *iter) bin = ceil_log10((unsigned long)sect_info[u].size); if(bin >= iter->sect_nbins) { /* Allocate more storage for section info */ - iter->sect_bins = (unsigned long *)realloc(iter->sect_bins, (bin + 1) * sizeof(unsigned long)); + iter->sect_bins = (unsigned long *)HDrealloc(iter->sect_bins, (bin + 1) * sizeof(unsigned long)); HDassert(iter->sect_bins); /* Initialize counts for intermediate bins */ @@ -805,7 +805,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; } @@ -1631,6 +1631,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 7384963..a7bb4b0 100644 --- a/tools/h5stat/h5stat_gentest.c +++ b/tools/h5stat/h5stat_gentest.c @@ -26,12 +26,12 @@ #include <assert.h> #include "hdf5.h" -#define FILE "h5stat_newgrat.h5" -#define DATASET_NAME "DATASET_NAME" -#define GROUP_NAME "GROUP" -#define ATTR_NAME "ATTR" -#define NUM_GRPS 35000 -#define NUM_ATTRS 100 +#define FILE "h5stat_newgrat.h5" +#define DATASET_NAME "DATASET_NAME" +#define GROUP_NAME "GROUP" +#define ATTR_NAME "ATTR" +#define NUM_GRPS 35000 +#define NUM_ATTRS 100 /* * Generate 1.8 HDF5 file @@ -40,27 +40,27 @@ */ static void gen_file(void) { - hid_t fcpl; /* File creation property */ - 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 */ + hid_t fcpl; /* File creation property */ + 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); - HDassert(ret >= 0); + assert(ret >= 0); /* Set file space handling strategy */ fcpl = H5Pcreate(H5P_FILE_CREATE); ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0); - HDassert(ret >= 0); + assert(ret >= 0); /* Create dataset */ file = H5Fcreate(FILE, H5F_ACC_TRUNC, fcpl, fapl); @@ -82,17 +82,17 @@ static void gen_file(void) sprintf(attrname, "%s%d", ATTR_NAME,i); attr_id = H5Acreate2(dset_id, attrname, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); ret = H5Aclose(attr_id); - HDassert(ret >= 0); + assert(ret >= 0); } /* end for */ ret = H5Dclose(dset_id); - HDassert(ret >= 0); + assert(ret >= 0); ret = H5Sclose(space_id); - HDassert(ret >= 0); + assert(ret >= 0); ret = H5Tclose(type_id); - HDassert(ret >= 0); + assert(ret >= 0); ret = H5Fclose(file); - HDassert(ret >= 0); + assert(ret >= 0); } int main(void) diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index a75596d..837a14e 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -4,8 +4,6 @@ PROJECT (HDF5_TOOLS_LIB) #----------------------------------------------------------------------------- # Define Sources #----------------------------------------------------------------------------- -#INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) -#INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) SET (H5_TOOLS_LIB_SRCS ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.c diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 4ffee2b..cef30dd 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); + 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"); } } @@ -270,12 +270,12 @@ static int is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *options /* search objects in exclude list */ while (NULL != exclude_path_ptr) { - /* if given object is group, exclude its members as well */ + /* if exclude path is is group, exclude its members as well */ if (exclude_path_ptr->obj_type == H5TRAV_TYPE_GROUP) { ret_cmp = HDstrncmp(exclude_path_ptr->obj_path, path, - strlen(exclude_path_ptr->obj_path)); - if (ret_cmp == 0) + HDstrlen(exclude_path_ptr->obj_path)); + if (ret_cmp == 0) /* found matching members */ { /* check if given path belong to an excluding group, if so * exclude it as well. @@ -295,12 +295,13 @@ static int is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *options else { ret_cmp = HDstrcmp(exclude_path_ptr->obj_path, path); - if (ret_cmp == 0) + if (ret_cmp == 0) /* found matching object */ { /* excluded non-group object */ ret = 1; - /* assign type as scan progress, which is sufficient to - * determine type for excluding groups from the above if. */ + /* remember the type of this maching object. + * if it's group, it can be used for excluding its member + * objects in this while() loop */ exclude_path_ptr->obj_type = type; break; /* while */ } @@ -443,9 +444,11 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch infile[1] = 0; while(curr1 < info1->nused) { + path1_lp = (info1->paths[curr1].path) + path1_offset; + type1_l = info1->paths[curr1].type; + if(!is_exclude_path(path1_lp, type1_l, options)) { - path1_lp = (info1->paths[curr1].path) + path1_offset; trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table); } curr1++; @@ -456,9 +459,11 @@ static void build_match_list (const char *objname1, trav_info_t *info1, const ch infile[1] = 1; while(curr2 < info2->nused) { + path2_lp = (info2->paths[curr2].path) + path2_offset; + type2_l = info2->paths[curr2].type; + if (!is_exclude_path(path2_lp, type2_l, options)) { - path2_lp = (info2->paths[curr2].path) + path2_offset; trav_table_addflags(infile, path2_lp, info2->paths[curr2].type, table); } curr2++; @@ -614,7 +619,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; } @@ -644,8 +649,8 @@ hsize_t h5diff(const char *fname1, char filenames[2][MAX_FILENAME]; hsize_t nfound = 0; int i; - //int i1, i2; - int l_ret; + int l_ret1 = -1; + int l_ret2 = -1; const char * obj1fullname = NULL; const char * obj2fullname = NULL; /* init to group type */ @@ -728,25 +733,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,12 +861,16 @@ 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, "/"); } + /* get any symbolic links info */ + l_ret1 = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, TRUE); + l_ret2 = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, TRUE); + /*--------------------------------------------- * check for following symlinks */ @@ -874,13 +883,12 @@ hsize_t h5diff(const char *fname1, /*------------------------------- * check symbolic link (object1) */ - l_ret = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, TRUE); /* dangling link */ - if (l_ret == 0) + if (l_ret1 == 0) { if (options->no_dangle_links) { - /* gangling link is error */ + /* treat dangling link is error */ if(options->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", obj1fullname); options->err_stat = 1; @@ -890,30 +898,33 @@ hsize_t h5diff(const char *fname1, { if(options->m_verbose) parallel_print("obj1 <%s> is a dangling link.\n", obj1fullname); - nfound++; - print_found(nfound); - goto out; + if (l_ret1 != 0 || l_ret2 != 0) + { + nfound++; + print_found(nfound); + goto out; + } } } - else if(l_ret < 0) /* fail */ + else if(l_ret1 < 0) /* fail */ { parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1); options->err_stat = 1; goto out; } - else if(l_ret != 2) /* symbolic link */ + else if(l_ret1 != 2) /* symbolic link */ obj1type = trg_linfo1.trg_type; /*------------------------------- * check symbolic link (object2) */ - l_ret = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, TRUE); + /* dangling link */ - if (l_ret == 0) + if (l_ret2 == 0) { if (options->no_dangle_links) { - /* gangling link is error */ + /* treat dangling link is error */ if(options->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", obj2fullname); options->err_stat = 1; @@ -923,18 +934,21 @@ hsize_t h5diff(const char *fname1, { if(options->m_verbose) parallel_print("obj2 <%s> is a dangling link.\n", obj2fullname); - nfound++; - print_found(nfound); - goto out; + if (l_ret1 != 0 || l_ret2 != 0) + { + nfound++; + print_found(nfound); + goto out; + } } } - else if(l_ret < 0) /* fail */ + else if(l_ret2 < 0) /* fail */ { parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2); options->err_stat = 1; goto out; } - else if(l_ret != 2) /* symbolic link */ + else if(l_ret2 != 2) /* symbolic link */ obj2type = trg_linfo2.trg_type; } /* end of if follow symlinks */ @@ -947,8 +961,10 @@ hsize_t h5diff(const char *fname1, if(!(options->m_verbose || options->m_report)) { - if (h5tools_is_obj_same(file1_id,obj1fullname,file2_id,obj2fullname)!=0) - goto out; + /* if no danglink links */ + if ( l_ret1 > 0 && l_ret2 > 0 ) + if (h5tools_is_obj_same(file1_id,obj1fullname,file2_id,obj2fullname)!=0) + goto out; } @@ -995,7 +1011,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 +1061,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 +1128,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 +1196,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); @@ -1769,9 +1785,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; } @@ -2163,9 +2179,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 +2222,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 6437809..604a825 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -898,8 +898,8 @@ hsize_t diff_datum(void *_mem1, char temp1_char; char temp2_char; HDassert(type_size==sizeof(char)); - memcpy(&temp1_char, mem1, sizeof(char)); - memcpy(&temp2_char, mem2, sizeof(char)); + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); /* -d and !-p */ if (options->d && !options->p) { @@ -995,8 +995,8 @@ hsize_t diff_datum(void *_mem1, unsigned char temp2_uchar; 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) { @@ -1094,8 +1094,8 @@ hsize_t diff_datum(void *_mem1, short temp2_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) { @@ -1193,8 +1193,8 @@ hsize_t diff_datum(void *_mem1, unsigned short temp2_ushort; 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) { @@ -1293,8 +1293,8 @@ hsize_t diff_datum(void *_mem1, int temp2_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) { @@ -1391,8 +1391,8 @@ hsize_t diff_datum(void *_mem1, unsigned int temp2_uint; 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) { @@ -1489,8 +1489,8 @@ hsize_t diff_datum(void *_mem1, long temp2_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) { @@ -1589,8 +1589,8 @@ hsize_t diff_datum(void *_mem1, unsigned long temp2_ulong; 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) { @@ -1688,8 +1688,8 @@ hsize_t diff_datum(void *_mem1, long long temp2_llong; 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) { @@ -1786,8 +1786,8 @@ hsize_t diff_datum(void *_mem1, unsigned long long temp2_ullong; 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) { @@ -1906,8 +1906,8 @@ hsize_t diff_datum(void *_mem1, 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 */ @@ -2119,8 +2119,8 @@ hsize_t diff_datum(void *_mem1, 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 */ @@ -2334,8 +2334,8 @@ hsize_t diff_datum(void *_mem1, 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 */ @@ -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,15 +5580,15 @@ 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) HDfree(buf); diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index bfb8429..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 */ diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index dfdc8b3..0d476b6 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -183,7 +183,7 @@ diff_basename(const char *name) return NULL; /* Find the end of the base name */ - i = strlen(name); + i = HDstrlen(name); while (i>0 && '/'==name[i-1]) --i; diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index ef32cde..17639bc 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -35,11 +35,14 @@ #define ALIGN(A,Z) ((((A) + (Z) - 1) / (Z)) * (Z)) /* global variables */ +hid_t H5tools_ERR_STACK_g = 0; 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 */ +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 */ @@ -113,10 +116,15 @@ h5tools_init(void) /* register the error class */ HDsnprintf(lib_str, sizeof(lib_str), "%d.%d.%d",H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); + H5tools_ERR_STACK_g = H5Ecreate_stack(); H5TOOLS_INIT_ERROR() if (!rawdatastream) rawdatastream = stdout; + if (!rawoutstream) + rawoutstream = stdout; + if (!rawerrorstream) + rawerrorstream = stderr; h5tools_dump_init(); @@ -143,19 +151,36 @@ h5tools_init(void) void h5tools_close(void) { + H5E_auto2_t tools_func; + void *tools_edata; if (h5tools_init_g) { + H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); + if(tools_func!=NULL) + H5Eprint2(H5tools_ERR_STACK_g, rawerrorstream); if (rawdatastream && rawdatastream != stdout) { if (fclose(rawdatastream)) perror("closing rawdatastream"); 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(); H5TOOLS_CLOSE_ERROR() - + H5Eclose_stack(H5tools_ERR_STACK_g); /* Shut down the library */ H5close(); @@ -1047,7 +1072,7 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) *------------------------------------------------------------------------- */ int -do_bin_output(FILE *stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem) +do_bin_output(FILE *stream, FILE *err_stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem) { HERR_INIT(int, SUCCEED) unsigned char *mem = (unsigned char*)_mem; @@ -1059,7 +1084,7 @@ do_bin_output(FILE *stream, hid_t container, hsize_t nelmts, hid_t tid, void *_m for (i = 0; i < nelmts; i++) { if (render_bin_output(stream, container, tid, mem + i * size) < 0) { - printf("\nError in writing binary stream\n"); + HDfprintf(err_stream,"\nError in writing binary stream\n"); return FAIL; } } diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index a8f43b3..0f4b271 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -525,6 +525,8 @@ 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 */ @@ -558,7 +560,7 @@ H5TOOLS_DLL void h5tools_simple_prefix(FILE *stream, const h5tool_format_t *i 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, hid_t container, hsize_t nelmts, hid_t tid, void *_mem); +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); diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 98945aa..9188225 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -189,22 +189,6 @@ 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, @@ -248,8 +232,8 @@ h5tools_dump_init(void) * 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 + * Return: Success: SUCCEED + * Failure: FAIL * Programmer: * Robb Matzke, Monday, April 26, 1999 * Modifications: @@ -272,11 +256,12 @@ h5tools_dump_init(void) * new field sm_pos in h5tools_context_t, the current stripmine element position *------------------------------------------------------------------------- */ -void +int 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) { + HERR_INIT(int, SUCCEED) unsigned char *mem = (unsigned char*) _mem; hsize_t i; /*element counter */ size_t size; /*size of each datum */ @@ -297,7 +282,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai /* binary dump */ if (bin_output) { - do_bin_output(rawdatastream, container, nelmts, type, _mem); + do_bin_output(rawdatastream, rawoutstream, container, nelmts, type, _mem); } /* end if */ else { /* setup */ @@ -373,8 +358,10 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai 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"); + else { + /* if (region_id < 0) - could mean that no reference was written do not throw failure */ + H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference failed"); + } ctx->need_prefix = TRUE; @@ -402,6 +389,9 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai h5tools_str_close(&buffer); }/* else bin */ + +CATCH + return ret_value; } /*------------------------------------------------------------------------- @@ -1242,7 +1232,8 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c ctx->need_prefix = TRUE; - h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf); + if(h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "h5tools_dump_simple_data failed"); /* Reclaim any VL memory, if necessary */ if (vl_data) @@ -1500,7 +1491,8 @@ 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 */ + HERR_INIT(herr_t, SUCCEED) + hid_t f_space = -1; /* file data space */ hsize_t elmtno; /* counter */ size_t i; /* counter */ int carry; /* counter carry value */ @@ -1517,7 +1509,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont 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 */ + hid_t sm_space = -1; /* stripmine data space */ /* Hyperslab info */ hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */ @@ -1530,13 +1522,12 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont f_space = H5Dget_space(dset); if (f_space == FAIL) - return FAIL; + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); ctx->ndims = H5Sget_simple_extent_ndims(f_space); if ((size_t)ctx->ndims > NELMTS(sm_size)) { - H5Sclose(f_space); - return FAIL; + H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed"); } /* Assume entire data space to be printed */ @@ -1558,9 +1549,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont ctx->size_last_dim = 0; if (p_nelmts == 0) { - /* nothing to print */ - H5Sclose(f_space); - return SUCCEED; + H5_LEAVE(SUCCEED); /* nothing to print */ } /* Check if we have VL data in the dataset's datatype */ @@ -1622,10 +1611,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont /* 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; + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); } /* Print the data */ @@ -1636,7 +1622,8 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont indices */ ctx->sm_pos = elmtno; - h5tools_dump_simple_data(stream, info, dset, ctx, flags, hs_nelmts, p_type, sm_buf); + if(h5tools_dump_simple_data(stream, info, dset, ctx, flags, hs_nelmts, p_type, sm_buf) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "h5tools_dump_simple_data failed"); /* Reclaim any VL memory, if necessary */ if (vl_data) @@ -1656,13 +1643,17 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont ctx->continuation++; } - HDfree(sm_buf); +CATCH + if(sm_buf) + HDfree(sm_buf); done: - H5Sclose(sm_space); - H5Sclose(f_space); + if(sm_space >= 0 && H5Sclose(sm_space) < 0) + H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + if(f_space >= 0 && H5Sclose(f_space) < 0) + H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); - return SUCCEED; + return ret_value; } /*------------------------------------------------------------------------- @@ -1680,13 +1671,14 @@ 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) { + HERR_INIT(herr_t, SUCCEED) 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; + H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed"); /* Assume entire data space to be printed */ for (i = 0; i < ctx->ndims; i++) @@ -1698,7 +1690,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte nelmts *= ctx->p_max_idx[i] - ctx->p_min_idx[i]; if (nelmts == 0) - return SUCCEED; /*nothing to print*/ + H5_LEAVE(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]); @@ -1709,9 +1701,11 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte 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); + if(h5tools_dump_simple_data(stream, info, obj_id, ctx, START_OF_DATA | END_OF_DATA, nelmts, type, mem) < 0) + HERROR(H5E_tools_g, H5E_tools_min_id_g, "h5tools_dump_simple_data failed"); - return SUCCEED; +CATCH + return ret_value; } /*------------------------------------------------------------------------- @@ -1754,7 +1748,7 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tool_format_t info_dflt; /* Use default values */ if (!stream) - stream = stdout; + stream = rawoutstream; if (!info) { HDmemset(&info_dflt, 0, sizeof info_dflt); @@ -1826,7 +1820,7 @@ h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *c /* Use default values */ if (!stream) - stream = stdout; + stream = rawoutstream; if (!info) { HDmemset(&info_dflt, 0, sizeof(info_dflt)); @@ -3069,7 +3063,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); - h5tools_str_append(&buffer,"OFFSET %u", ioffset); + 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--; diff --git a/tools/lib/h5tools_dump.h b/tools/lib/h5tools_dump.h index c94d0e1..55e046b 100644 --- a/tools/lib/h5tools_dump.h +++ b/tools/lib/h5tools_dump.h @@ -44,10 +44,10 @@ H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, 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_DLL int 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_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); diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index 207218e..ae549fd 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -22,6 +22,7 @@ #include "H5Epublic.h" /* tools-HDF5 Error variables */ +H5TOOLS_DLLVAR hid_t H5tools_ERR_STACK_g; H5TOOLS_DLLVAR hid_t H5tools_ERR_CLS_g; H5TOOLS_DLLVAR hid_t H5E_tools_g; H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g; @@ -66,7 +67,11 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g; * HERROR macro, used to facilitate error reporting . The arguments are the major * error number, the minor error number, and a description of the error. */ -#define HERROR(maj_id, min_id, str) H5Epush2(H5E_DEFAULT, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, maj_id, min_id, str) +#define HERROR(maj_id, min_id, str) { \ + H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, maj_id, min_id, str); \ + ret_value = FAIL; \ +} + /* Macro for "catching" flow of control when an error occurs. Note that the * H5_LEAVE macro won't jump back here once it's past this point. diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index c3fbb1b..0de126d 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -157,7 +157,7 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) */ if (nchars < 0 #ifndef H5_VSNPRINTF_WORKS - && (strlen(str->s) < str->nalloc) + && (HDstrlen(str->s) < str->nalloc) #endif ) { /* failure, such as bad format */ @@ -173,7 +173,7 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) */ size_t newsize = MAX(str->len + nchars + 1, 2 * str->nalloc); HDassert(newsize > str->nalloc); /*overflow*/ - str->s = HDrealloc(str->s, newsize); + str->s = (char*)HDrealloc(str->s, newsize); HDassert(str->s); str->nalloc = newsize; } @@ -209,7 +209,7 @@ h5tools_str_reset(h5tools_str_t *str/*in,out*/) { if (!str->s || str->nalloc <= 0) { str->nalloc = STR_INIT_LEN; - str->s = HDmalloc(str->nalloc); + str->s = (char*)HDmalloc(str->nalloc); HDassert(str->s); } @@ -282,7 +282,7 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt) size_t n = sizeof(_temp); if (str->len - start + 1 > n) { n = str->len - start + 1; - temp = HDmalloc(n); + temp = (char*)HDmalloc(n); HDassert(temp); } @@ -1114,8 +1114,6 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK)); if (info->arr_linebreak && i && i % dims[ndims - 1] == 0) { - int x; - h5tools_str_append(str, "%s", "\n"); h5tools_str_indent(str, info, ctx); @@ -1123,7 +1121,6 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else if (i && info->arr_sep) { /* if next element begin, add next line with indent */ if (is_next_arry_elmt) { - int x; is_next_arry_elmt = 0; h5tools_str_append(str, "%s", "\n "); @@ -1366,3 +1363,52 @@ h5tools_str_is_zero(const void *_mem, size_t size) return TRUE; } + +/*------------------------------------------------------------------------- + * Function: h5tools_str_replace + * + * Purpose: replace all occurrences of substring. + * + * Return: char * + * + * Programmer: Peter Cao + * March 8, 2012 + * + * Notes: + * Applications need to call free() to free the memoery allocated for + * the return string + * + *------------------------------------------------------------------------- + */ +char * +h5tools_str_replace ( const char *string, const char *substr, const char *replacement ) +{ + char *tok = NULL; + char *newstr = NULL; + char *oldstr = NULL; + char *head = NULL; + + if ( substr == NULL || replacement == NULL ) + return strdup (string); + + newstr = strdup (string); + head = newstr; + while ( (tok = strstr ( head, substr ))){ + oldstr = newstr; + newstr = HDmalloc ( strlen ( oldstr ) - strlen ( substr ) + strlen ( replacement ) + 1 ); + + if ( newstr == NULL ){ + HDfree (oldstr); + return NULL; + } + memcpy ( newstr, oldstr, tok - oldstr ); + memcpy ( newstr + (tok - oldstr), replacement, strlen ( replacement ) ); + memcpy ( newstr + (tok - oldstr) + strlen( replacement ), tok + strlen ( substr ), strlen ( oldstr ) - strlen ( substr ) - ( tok - oldstr ) ); + memset ( newstr + strlen ( oldstr ) - strlen ( substr ) + strlen ( replacement ) , 0, 1 ); + /* move back head right after the last replacement */ + head = newstr + (tok - oldstr) + strlen( replacement ); + HDfree (oldstr); + } + + return newstr; +} diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h index 9527a56..38697c6 100644 --- a/tools/lib/h5tools_str.h +++ b/tools/lib/h5tools_str.h @@ -47,5 +47,7 @@ H5TOOLS_DLL void h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_ 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); +H5TOOLS_DLL char *h5tools_str_replace ( const char *string, const char *substr, + const char *replacement ); #endif /* H5TOOLS_STR_H__ */ diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index a1fe7c6..11ab5f3 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -28,6 +28,7 @@ #include <stdio.h> #include <stdlib.h> +#include "h5tools.h" #include "h5tools_utils.h" #include "H5private.h" #include "h5trav.h" @@ -48,9 +49,9 @@ static const char *h5tools_progname = "h5tools"; * 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); +hsize_t H5TOOLS_MALLOCSIZE = (256 * 1024 * 1024); /* 256 MB */ /* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */ -hsize_t H5TOOLS_BUFSIZE = (1024 * 1024); +hsize_t H5TOOLS_BUFSIZE = ( 32 * 1024 * 1024); /* 32 MB */ /* ``parallel_print'' variables */ @@ -115,7 +116,7 @@ void parallel_print(const char* format, ...) overflow_file = HDtmpfile(); if(overflow_file == NULL) - HDfprintf(stderr, "warning: could not create overflow file. Output may be truncated.\n"); + HDfprintf(rawerrorstream, "warning: could not create overflow file. Output may be truncated.\n"); else bytes_written = HDvfprintf(overflow_file, format, ap); } @@ -151,9 +152,10 @@ error_msg(const char *fmt, ...) va_list ap; HDva_start(ap, fmt); - HDfflush(stdout); - HDfprintf(stderr, "%s error: ", h5tools_getprogname()); - HDvfprintf(stderr, fmt, ap); + HDfflush(rawdatastream); + HDfflush(rawoutstream); + HDfprintf(rawerrorstream, "%s error: ", h5tools_getprogname()); + HDvfprintf(rawerrorstream, fmt, ap); HDva_end(ap); } @@ -180,9 +182,10 @@ warn_msg(const char *fmt, ...) va_list ap; HDva_start(ap, fmt); - HDfflush(stdout); - HDfprintf(stderr, "%s warning: ", h5tools_getprogname()); - HDvfprintf(stderr, fmt, ap); + HDfflush(rawdatastream); + HDfflush(rawoutstream); + HDfprintf(rawerrorstream, "%s warning: ", h5tools_getprogname()); + HDvfprintf(rawerrorstream, fmt, ap); HDva_end(ap); } @@ -266,7 +269,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti } 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); @@ -276,7 +279,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti else { if (arg[len] == '=') { if (opt_err) - HDfprintf(stderr, + HDfprintf(rawerrorstream, "%s: no option required for \"%s\" flag\n", argv[0], arg); @@ -291,7 +294,7 @@ 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 = '?'; } @@ -307,7 +310,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti 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 */ @@ -326,7 +329,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti } else if (++opt_ind >= argc) { if (opt_err) - HDfprintf(stderr, + HDfprintf(rawerrorstream, "%s: value expected for option \"%c\"\n", argv[0], opt_opt); @@ -385,11 +388,11 @@ indentation(int x) { if (x < h5tools_nCols) { while (x-- > 0) - printf(" "); + HDfprintf(rawoutstream, " "); } else { - HDfprintf(stderr, "error: the indentation exceeds the number of cols.\n"); - exit(1); + HDfprintf(rawerrorstream, "error: the indentation exceeds the number of cols.\n"); + HDexit(1); } } @@ -411,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); } @@ -491,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); } @@ -914,7 +917,7 @@ int h5tools_getenv_update_hyperslab_bufsize(void) { /* TODO: later when pubilshed - printf("Error: Invalid environment variable \"H5TOOLS_BUFSIZE\" : %s\n", env_str); + HDfprintf(rawerrorstream,"Error: Invalid environment variable \"H5TOOLS_BUFSIZE\" : %s\n", env_str); */ goto error; diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 3bb8b3f..ad8b9fe 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -151,7 +151,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, size_t base_len = HDstrlen(udata->base_grp_name); size_t add_slash = base_len ? ((udata->base_grp_name)[base_len-1] != '/') : 1; - if(NULL == (new_name = HDmalloc(base_len + add_slash + HDstrlen(path) + 1))) + if(NULL == (new_name = (char*)HDmalloc(base_len + add_slash + HDstrlen(path) + 1))) return(H5_ITER_ERROR); HDstrcpy(new_name, udata->base_grp_name); if (add_slash) @@ -895,7 +895,7 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) switch(linfo->type) { case H5L_TYPE_SOFT: if(linfo->u.val_size > 0) { - char *targbuf = HDmalloc(linfo->u.val_size + 1); + char *targbuf = (char*)HDmalloc(linfo->u.val_size + 1); HDassert(targbuf); H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT); @@ -912,7 +912,7 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) const char *filename; const char *objname; - targbuf = HDmalloc(linfo->u.val_size + 1); + targbuf = (char*)HDmalloc(linfo->u.val_size + 1); HDassert(targbuf); H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT); diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt index 3e70163..72930c9 100644 --- a/tools/misc/CMakeLists.txt +++ b/tools/misc/CMakeLists.txt @@ -5,7 +5,6 @@ PROJECT (HDF5_TOOLS_MISC) # Setup include Directories #----------------------------------------------------------------------------- INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) -INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- # Add the misc executables diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 7b4215a..f24fbba 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -23,34 +23,34 @@ * *------------------------------------------------------------------------- */ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ -#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/ -#define H5EA_PACKAGE /*suppress error about including H5EApkg */ -#define H5EA_TESTING /*suppress warning about H5EA testing funcs*/ -#define H5FA_PACKAGE /*suppress error about including H5FApkg */ -#define H5FA_TESTING /*suppress warning about H5FA testing funcs*/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ - -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5B2pkg.h" /* v2 B-trees */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5EApkg.h" /* Extensible Arrays */ -#include "H5FApkg.h" /* Fixed Arrays */ -#include "H5Fpkg.h" /* File access */ -#include "H5FSprivate.h" /* Free space manager */ -#include "H5Gpkg.h" /* Groups */ -#include "H5HFpkg.h" /* Fractal heaps */ -#include "H5HGprivate.h" /* Global Heaps */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Opkg.h" /* Object headers */ -#include "H5SMpkg.h" /* Implicitly shared messages */ +#define H5A_PACKAGE /*suppress error about including H5Apkg */ +#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/ +#define H5EA_PACKAGE /*suppress error about including H5EApkg */ +#define H5EA_TESTING /*suppress warning about H5EA testing funcs*/ +#define H5FA_PACKAGE /*suppress error about including H5FApkg */ +#define H5FA_TESTING /*suppress warning about H5FA testing funcs*/ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ + +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5B2pkg.h" /* v2 B-trees */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5EApkg.h" /* Extensible Arrays */ +#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5Fpkg.h" /* File access */ +#include "H5FSprivate.h" /* Free space manager */ +#include "H5Gpkg.h" /* Groups */ +#include "H5HFpkg.h" /* Fractal heaps */ +#include "H5HGprivate.h" /* Global Heaps */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Opkg.h" /* Object headers */ +#include "H5SMpkg.h" /* Implicitly shared messages */ /* File drivers */ #include "H5FDfamily.h" @@ -61,15 +61,15 @@ /*------------------------------------------------------------------------- * Function: get_H5B2_class * - * Purpose: Determine the v2 B-tree class from the buffer read in. + * Purpose: Determine the v2 B-tree class from the buffer read in. * B-trees are debugged through the B-tree subclass. The subclass * identifier is two bytes after the B-tree signature. * - * Return: Non-NULL on success/NULL on failure + * Return: Non-NULL on success/NULL on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 11 2008 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Sep 11 2008 * *------------------------------------------------------------------------- */ @@ -121,7 +121,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 */ @@ -132,15 +132,15 @@ get_H5B2_class(const uint8_t *sig) /*------------------------------------------------------------------------- * Function: get_H5EA_class * - * Purpose: Determine the extensible array class from the buffer read in. + * Purpose: Determine the extensible array class from the buffer read in. * Extensible arrays are debugged through the array subclass. * The subclass identifier is two bytes after the signature. * - * Return: Non-NULL on success/NULL on failure + * Return: Non-NULL on success/NULL on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 11 2008 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Sep 11 2008 * *------------------------------------------------------------------------- */ @@ -156,7 +156,7 @@ get_H5EA_class(const uint8_t *sig) break; default: - fprintf(stderr, "Unknown array class %u\n", (unsigned)(clsid)); + HDfprintf(stderr, "Unknown array class %u\n", (unsigned)(clsid)); HDexit(4); } /* end switch */ @@ -167,15 +167,15 @@ get_H5EA_class(const uint8_t *sig) /*------------------------------------------------------------------------- * Function: get_H5FA_class * - * Purpose: Determine the fixed array class from the buffer read in. + * Purpose: Determine the fixed array class from the buffer read in. * Extensible arrays are debugged through the array subclass. * The subclass identifier is two bytes after the signature. * - * Return: Non-NULL on success/NULL on failure + * Return: Non-NULL on success/NULL on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 11 2008 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Sep 11 2008 * *------------------------------------------------------------------------- */ @@ -191,7 +191,7 @@ get_H5FA_class(const uint8_t *sig) break; default: - fprintf(stderr, "Unknown array class %u\n", (unsigned)(clsid)); + HDfprintf(stderr, "Unknown array class %u\n", (unsigned)(clsid)); HDexit(4); } /* end switch */ @@ -217,7 +217,7 @@ get_H5FA_class(const uint8_t *sig) int main(int argc, char *argv[]) { - hid_t fid, fapl, dxpl; + hid_t fid, fapl, dxpl; H5F_t *f; haddr_t addr = 0, extra = 0, extra2 = 0, extra3 = 0, extra4 = 0; uint8_t sig[H5F_SIGNATURE_LEN]; @@ -225,13 +225,13 @@ 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 */ @@ -239,27 +239,27 @@ main(int argc, char *argv[]) * Open the file and get the file descriptor. */ if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) { - fprintf(stderr, "cannot create dataset transfer property list\n"); + 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"); + 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 = (H5F_t *)H5I_object(fid))) { - fprintf(stderr, "cannot obtain H5F_t pointer\n"); + HDfprintf(stderr, "cannot obtain H5F_t pointer\n"); HDexit(2); } /* end if */ /* Ignore metadata tags while using h5debug */ if(H5AC_ignore_tags(f) < 0) { - fprintf(stderr, "cannot ignore metadata tags\n"); + HDfprintf(stderr, "cannot ignore metadata tags\n"); HDexit(1); } @@ -282,7 +282,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)) { @@ -310,9 +310,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 <filename> <Symbol table node address> <address of local heap>\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 <filename> <Symbol table node address> <address of local heap>\n\n"); } /* end if */ status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra); @@ -330,9 +330,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 <filename> <B-tree node address> <address of local heap>\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 <filename> <B-tree node address> <address of local heap>\n\n"); } /* end if */ status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra); @@ -341,9 +341,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 <filename> <B-tree node address> <# 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 <filename> <B-tree node address> <# of dimensions>\n"); HDexit(4); } /* end if */ @@ -352,7 +352,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); } @@ -374,10 +374,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 <filename> <internal node address> <v2 B-tree header address> <number of records> <depth>\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 <filename> <internal node address> <v2 B-tree header address> <number of records> <depth>\n"); HDexit(4); } /* end if */ @@ -392,9 +392,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 <filename> <leaf node address> <v2 B-tree header address> <number of records>\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 <filename> <leaf node address> <v2 B-tree header address> <number of records>\n"); HDexit(4); } /* end if */ @@ -413,9 +413,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 <filename> <direct block address> <heap header address> <size of direct block>\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 <filename> <direct block address> <heap header address> <size of direct block>\n"); HDexit(4); } /* end if */ @@ -428,9 +428,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 <filename> <indirect block address> <heap header address> <number of rows>\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 <filename> <indirect block address> <heap header address> <number of rows>\n"); HDexit(4); } /* end if */ @@ -450,9 +450,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 <filename> <serialized sections address> <free space header address> <client address>\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 <filename> <serialized sections address> <free space header address> <client address>\n"); HDexit(4); } /* end if */ @@ -472,9 +472,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 <filename> <shared message list address> <list format version> <number of mesages in list>\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 <filename> <shared message list address> <list format version> <number of mesages in list>\n"); HDexit(4); } /* end if */ @@ -487,11 +487,11 @@ main(int argc, char *argv[]) const H5EA_class_t *cls = get_H5EA_class(sig); HDassert(cls); - /* Check for enough valid parameters */ + /* Check for enough valid parameters */ if(extra == 0) { - fprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n"); - fprintf(stderr, "Extensible array header block usage:\n"); - fprintf(stderr, "\th5debug <filename> <Extensible Array header address> <object header address>\n"); + HDfprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n"); + HDfprintf(stderr, "Extensible array header block usage:\n"); + HDfprintf(stderr, "\th5debug <filename> <Extensible Array header address> <object header address>\n"); HDexit(4); } /* end if */ @@ -506,9 +506,9 @@ main(int argc, char *argv[]) /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0) { - fprintf(stderr, "ERROR: Need extensible array header address and object header address containing the layout message in order to dump index block\n"); - fprintf(stderr, "Extensible array index block usage:\n"); - fprintf(stderr, "\th5debug <filename> <index block address> <array header address> <object header address\n"); + HDfprintf(stderr, "ERROR: Need extensible array header address and object header address containing the layout message in order to dump index block\n"); + HDfprintf(stderr, "Extensible array index block usage:\n"); + HDfprintf(stderr, "\th5debug <filename> <index block address> <array header address> <object header address\n"); HDexit(4); } /* end if */ @@ -523,9 +523,9 @@ main(int argc, char *argv[]) /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0 || extra3 == 0) { - fprintf(stderr, "ERROR: Need extensible array header address, super block index and object header address containing the layout message in order to dump super block\n"); - fprintf(stderr, "Extensible array super block usage:\n"); - fprintf(stderr, "\th5debug <filename> <super block address> <array header address> <super block index> <object header address>\n"); + HDfprintf(stderr, "ERROR: Need extensible array header address, super block index and object header address containing the layout message in order to dump super block\n"); + HDfprintf(stderr, "Extensible array super block usage:\n"); + HDfprintf(stderr, "\th5debug <filename> <super block address> <array header address> <super block index> <object header address>\n"); HDexit(4); } /* end if */ @@ -540,9 +540,9 @@ main(int argc, char *argv[]) /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0 || extra3 == 0) { - fprintf(stderr, "ERROR: Need extensible array header address, # of elements in data block and object header address containing the layout message in order to dump data block\n"); - fprintf(stderr, "Extensible array data block usage:\n"); - fprintf(stderr, "\th5debug <filename> <data block address> <array header address> <# of elements in data block> <object header address\n"); + HDfprintf(stderr, "ERROR: Need extensible array header address, # of elements in data block and object header address containing the layout message in order to dump data block\n"); + HDfprintf(stderr, "Extensible array data block usage:\n"); + HDfprintf(stderr, "\th5debug <filename> <data block address> <array header address> <# of elements in data block> <object header address\n"); HDexit(4); } /* end if */ @@ -555,11 +555,11 @@ main(int argc, char *argv[]) const H5FA_class_t *cls = get_H5FA_class(sig); HDassert(cls); - /* Check for enough valid parameters */ + /* Check for enough valid parameters */ if(extra == 0) { - fprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n"); - fprintf(stderr, "Fixed array header block usage:\n"); - fprintf(stderr, "\th5debug <filename> <Fixed Array header address> <object header address>\n"); + HDfprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n"); + HDfprintf(stderr, "Fixed array header block usage:\n"); + HDfprintf(stderr, "\th5debug <filename> <Fixed Array header address> <object header address>\n"); HDexit(4); } /* end if */ @@ -574,9 +574,9 @@ main(int argc, char *argv[]) /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0) { - fprintf(stderr, "ERROR: Need fixed array header address and object header address containing the layout message in order to dump data block\n"); - fprintf(stderr, "fixed array data block usage:\n"); - fprintf(stderr, "\th5debug <filename> <data block address> <array header address> <object header address>\n"); + HDfprintf(stderr, "ERROR: Need fixed array header address and object header address containing the layout message in order to dump data block\n"); + HDfprintf(stderr, "fixed array data block usage:\n"); + HDfprintf(stderr, "\th5debug <filename> <data block address> <array header address> <object header address>\n"); HDexit(4); } /* end if */ @@ -612,13 +612,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 9cc2de5..75534e2 100644 --- a/tools/testfiles/filter_fail.ddl +++ b/tools/testfiles/filter_fail.ddl @@ -25,3 +25,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): major: Data filters minor: Read failed h5dump error: unable to print data +H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): + #000: (file name) line (number) in h5tools_dump_simple_dset(): H5Dread failed + major: Failure in tools library + minor: error in function diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index ca16c42..d8551ca 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -1,4 +1,4 @@ -usage: h5dump [OPTIONS] file +usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit -n, --contents Print a list of the file contents and exit @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] file -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -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 @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] file h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" 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 @@ -94,3 +101,7 @@ usage: h5dump [OPTIONS] file h5dump -d /dset -M 0,1,4,3 quux.h5 + 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5 + + h5dump -d /foo multi1.h5 multi2.h5 multi3.h5 + diff --git a/tools/testfiles/tarray6.h5 b/tools/testfiles/tarray6.h5 Binary files differindex b4af19b..7eb078c 100644 --- a/tools/testfiles/tarray6.h5 +++ b/tools/testfiles/tarray6.h5 diff --git a/tools/testfiles/tattr-1.ddl b/tools/testfiles/tattr-1.ddl index d353577..b58731b 100644 --- a/tools/testfiles/tattr-1.ddl +++ b/tools/testfiles/tattr-1.ddl @@ -1,6 +1,6 @@ HDF5 "tattr.h5" { GROUP "/" { - ATTRIBUTE "attr1" { + ATTRIBUTE "/attr1" { DATATYPE H5T_STD_I8BE DATASPACE SIMPLE { ( 24 ) / ( 24 ) } DATA { diff --git a/tools/testfiles/tattr-2.ddl b/tools/testfiles/tattr-2.ddl index 79ba8c3..328b54f 100644 --- a/tools/testfiles/tattr-2.ddl +++ b/tools/testfiles/tattr-2.ddl @@ -7,14 +7,14 @@ ATTRIBUTE "/attr1" { (14): 111, 111, 116, 32, 103, 114, 111, 117, 112, 0 } } -ATTRIBUTE "/attr4" { +ATTRIBUTE "attr4" { DATATYPE H5T_STD_I32BE DATASPACE SCALAR DATA { (0): 100 } } -ATTRIBUTE "/attr5" { +ATTRIBUTE "attr5" { DATATYPE H5T_STRING { STRSIZE 17; STRPAD H5T_STR_NULLTERM; diff --git a/tools/testfiles/tattr-3.ddl b/tools/testfiles/tattr-3.ddl index 4eee317..a19f69a 100644 --- a/tools/testfiles/tattr-3.ddl +++ b/tools/testfiles/tattr-3.ddl @@ -1,9 +1,16 @@ HDF5 "tattr.h5" { -ATTRIBUTE "/attr2" { +ATTRIBUTE "attr2" { DATATYPE H5T_STD_I32BE DATASPACE SIMPLE { ( 10 ) / ( 10 ) } } -ATTRIBUTE "/attr" { +ATTRIBUTE "attr" { } } -h5dump error: unable to open attribute "/attr" +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Aopen(): unable to load attribute info from object header for attribute: 'attr' + major: Attribute + minor: Unable to initialize object + #001: (file name) line (number) in H5O_attr_open_by_name(): can't locate attribute: 'attr' + major: Attribute + minor: Object not found +h5dump error: unable to open attribute "attr" diff --git a/tools/testfiles/tattr.h5 b/tools/testfiles/tattr.h5 Binary files differindex fd14b58..d61def5 100644 --- a/tools/testfiles/tattr.h5 +++ b/tools/testfiles/tattr.h5 diff --git a/tools/testfiles/tattr.h5.xml b/tools/testfiles/tattr.h5.xml index 57fa276..fceea99 100644 --- a/tools/testfiles/tattr.h5.xml +++ b/tools/testfiles/tattr.h5.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <hdf5:HDF5-File xmlns:hdf5="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"> <hdf5:RootGroup OBJ-XID="xid_928" H5Path="/"> - <hdf5:Attribute Name="attr1"> + <hdf5:Attribute Name="/attr1"> <hdf5:Dataspace> <hdf5:SimpleDataspace Ndims="1"> <hdf5:Dimension DimSize="24" MaxDimSize="24"/> diff --git a/tools/testfiles/tdset-2.ddl b/tools/testfiles/tdset-2.ddl index def68c3..2034a43 100644 --- a/tools/testfiles/tdset-2.ddl +++ b/tools/testfiles/tdset-2.ddl @@ -7,7 +7,37 @@ DATASET "/dset2" { DATATYPE H5T_IEEE_F64BE DATASPACE SIMPLE { ( 30, 20 ) / ( 30, 20 ) } } -DATASET "dset3" { - } } -h5dump error: unable to open dataset "dset3" +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Dopen2(): not found + major: Dataset + minor: Object not found + #001: (file name) line (number) in H5G_loc_find(): can't find object + major: Symbol table + minor: Object not found + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed + major: Symbol table + minor: Object not found + #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + major: Symbol table + minor: Callback failed + #004: (file name) line (number) in H5G_loc_find_cb(): object 'dset3' doesn't exist + major: Symbol table + minor: Object not found +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Lget_info(): unable to get link info + major: Symbol table + minor: Object not found + #001: (file name) line (number) in H5L_get_info(): name doesn't exist + major: Symbol table + minor: Object already exists + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed + major: Symbol table + minor: Object not found + #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + major: Symbol table + minor: Callback failed + #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist + major: Symbol table + minor: Object not found +h5dump error: unable to get link info from "dset3" diff --git a/tools/testfiles/textlink.ddl b/tools/testfiles/textlink.ddl index 5459b30..4718adb 100644 --- a/tools/testfiles/textlink.ddl +++ b/tools/testfiles/textlink.ddl @@ -10,3 +10,53 @@ GROUP "/" { } } } +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Oopen(): unable to open object + major: Symbol table + minor: Can't open object + #001: (file name) line (number) in H5O_open_name(): object not found + major: Symbol table + minor: Object not found + #002: (file name) line (number) in H5G_loc_find(): can't find object + major: Symbol table + minor: Object not found + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + major: Symbol table + minor: Object not found + #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed + major: Links + minor: Link traversal failure + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + major: Links + minor: Link traversal failure + #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID + major: Symbol table + minor: Unable to find atom information (already closed?) + #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'filename', temp_file_name = 'filename' + major: Links + minor: Unable to open file +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Oopen(): unable to open object + major: Symbol table + minor: Can't open object + #001: (file name) line (number) in H5O_open_name(): object not found + major: Symbol table + minor: Object not found + #002: (file name) line (number) in H5G_loc_find(): can't find object + major: Symbol table + minor: Object not found + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + major: Symbol table + minor: Object not found + #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed + major: Links + minor: Link traversal failure + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + major: Links + minor: Link traversal failure + #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID + major: Symbol table + minor: Unable to find atom information (already closed?) + #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'anotherfile', temp_file_name = 'anotherfile' + major: Links + minor: Unable to open file diff --git a/tools/testfiles/thyperslab.ddl b/tools/testfiles/thyperslab.ddl index cfebd14..2f4a118 100644 --- a/tools/testfiles/thyperslab.ddl +++ b/tools/testfiles/thyperslab.ddl @@ -6338,212 +6338,212 @@ GROUP "/" { (30,4025): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, (30,4045): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, (30,4065): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (30,4085): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,8): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,29): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,50): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,71): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,92): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,113): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,133): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,153): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,173): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,193): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,213): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,233): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,253): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,273): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,293): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,313): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,333): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,353): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,373): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,393): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,413): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,433): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,453): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,473): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,493): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,513): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,533): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,553): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,573): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,593): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,613): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,633): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,653): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,673): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,693): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,713): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,733): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,753): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,773): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,793): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,813): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,833): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,853): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,873): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,893): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,913): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,933): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,953): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,973): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,993): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1013): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1033): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1053): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1073): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1093): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1113): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1133): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1153): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1173): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1193): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1213): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1233): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1253): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1273): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1293): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1313): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1333): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1353): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1373): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1393): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1413): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1433): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1453): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1473): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1493): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1513): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1533): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1553): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1573): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1593): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1613): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1633): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1653): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1673): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1693): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1713): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1733): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1753): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1773): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1793): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1813): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1833): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1853): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1873): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1893): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1913): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1933): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1953): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1973): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,1993): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2013): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2033): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2053): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2073): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2093): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2113): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2133): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2153): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2173): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2193): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2213): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2233): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2253): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2273): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2293): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2313): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2333): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2353): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2373): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2393): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2413): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2433): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2453): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2473): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2493): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2513): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2533): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2553): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2573): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2593): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2613): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2633): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2653): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2673): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2693): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2713): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2733): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2753): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2773): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2793): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2813): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2833): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2853): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2873): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2893): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2913): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2933): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2953): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2973): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,2993): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3013): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3033): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3053): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3073): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3093): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3113): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3133): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3153): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3173): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3193): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3213): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3233): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3253): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3273): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3293): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3313): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3333): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3353): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3373): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3393): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3413): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3433): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3453): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3473): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3493): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3513): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3533): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3553): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3573): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3593): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3613): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3633): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3653): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3673): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3693): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3713): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3733): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3753): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3773): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3793): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3813): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3833): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3853): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3873): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3893): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3913): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3933): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3953): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3973): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,3993): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,4013): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,4033): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,4053): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,4073): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - (31,4093): 1, 1, 1, 1 + (30,4085): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,21): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,42): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,63): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,84): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,105): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,125): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,145): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,165): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,185): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,205): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,225): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,245): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,265): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,285): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,305): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,325): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,345): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,365): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,385): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,405): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,425): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,445): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,465): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,485): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,505): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,525): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,545): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,565): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,585): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,605): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,625): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,645): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,665): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,685): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,705): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,725): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,745): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,765): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,785): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,805): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,825): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,845): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,865): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,885): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,905): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,925): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,945): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,965): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,985): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1005): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1025): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1045): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1065): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1085): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1105): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1125): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1145): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1165): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1185): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1205): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1225): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1245): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1265): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1285): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1305): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1325): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1345): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1365): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1385): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1405): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1425): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1445): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1465): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1485): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1505): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1525): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1545): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1565): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1585): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1605): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1625): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1645): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1665): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1685): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1705): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1725): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1745): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1765): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1785): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1805): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1825): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1845): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1865): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1885): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1905): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1925): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1945): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1965): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,1985): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2005): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2025): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2045): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2065): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2085): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2105): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2125): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2145): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2165): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2185): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2205): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2225): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2245): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2265): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2285): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2305): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2325): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2345): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2365): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2385): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2405): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2425): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2445): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2465): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2485): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2505): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2525): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2545): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2565): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2585): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2605): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2625): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2645): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2665): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2685): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2705): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2725): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2745): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2765): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2785): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2805): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2825): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2845): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2865): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2885): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2905): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2925): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2945): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2965): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,2985): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3005): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3025): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3045): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3065): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3085): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3105): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3125): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3145): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3165): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3185): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3205): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3225): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3245): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3265): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3285): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3305): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3325): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3345): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3365): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3385): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3405): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3425): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3445): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3465): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3485): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3505): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3525): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3545): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3565): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3585): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3605): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3625): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3645): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3665): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3685): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3705): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3725): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3745): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3765): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3785): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3805): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3825): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3845): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3865): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3885): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3905): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3925): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3945): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3965): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,3985): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,4005): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,4025): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,4045): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,4065): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (31,4085): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } } } diff --git a/tools/testfiles/tnofilename-with-packed-bits.ddl b/tools/testfiles/tnofilename-with-packed-bits.ddl index ca16c42..050a3a3 100644 --- a/tools/testfiles/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/tnofilename-with-packed-bits.ddl @@ -1,4 +1,4 @@ -usage: h5dump [OPTIONS] file +usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit -n, --contents Print a list of the file contents and exit @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] file -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -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 @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] file h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" 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 @@ -94,3 +101,8 @@ usage: h5dump [OPTIONS] file h5dump -d /dset -M 0,1,4,3 quux.h5 + 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5 + + h5dump -d /foo multi1.h5 multi2.h5 multi3.h5 + +h5dump error: missing file name diff --git a/tools/testfiles/tnofilename.ddl b/tools/testfiles/tnofilename.ddl deleted file mode 100644 index f9bd972..0000000 --- a/tools/testfiles/tnofilename.ddl +++ /dev/null @@ -1,86 +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 - -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 - diff --git a/tools/testfiles/tpbitsIncomplete.ddl b/tools/testfiles/tpbitsIncomplete.ddl index 88dac0a..5608d2b 100644 --- a/tools/testfiles/tpbitsIncomplete.ddl +++ b/tools/testfiles/tpbitsIncomplete.ddl @@ -1,4 +1,4 @@ -usage: h5dump [OPTIONS] file +usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit -n, --contents Print a list of the file contents and exit @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] file -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -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 @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] file h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" 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 @@ -94,4 +101,8 @@ usage: h5dump [OPTIONS] file h5dump -d /dset -M 0,1,4,3 quux.h5 + 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5 + + h5dump -d /foo multi1.h5 multi2.h5 multi3.h5 + h5dump error: Bad mask list(0,2,2,1,0,2,2,) diff --git a/tools/testfiles/tpbitsLengthExceeded.ddl b/tools/testfiles/tpbitsLengthExceeded.ddl index 35055f4..f89b65f 100644 --- a/tools/testfiles/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/tpbitsLengthExceeded.ddl @@ -1,4 +1,4 @@ -usage: h5dump [OPTIONS] file +usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit -n, --contents Print a list of the file contents and exit @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] file -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -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 @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] file h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" 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 @@ -94,4 +101,8 @@ usage: h5dump [OPTIONS] file h5dump -d /dset -M 0,1,4,3 quux.h5 + 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5 + + h5dump -d /foo multi1.h5 multi2.h5 multi3.h5 + h5dump error: Packed Bit offset+length value(65) too large. Max is 64 diff --git a/tools/testfiles/tpbitsLengthPositive.ddl b/tools/testfiles/tpbitsLengthPositive.ddl index 3daeab4..ba32aa6 100644 --- a/tools/testfiles/tpbitsLengthPositive.ddl +++ b/tools/testfiles/tpbitsLengthPositive.ddl @@ -1,4 +1,4 @@ -usage: h5dump [OPTIONS] file +usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit -n, --contents Print a list of the file contents and exit @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] file -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -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 @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] file h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" 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 @@ -94,4 +101,8 @@ usage: h5dump [OPTIONS] file h5dump -d /dset -M 0,1,4,3 quux.h5 + 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5 + + h5dump -d /foo multi1.h5 multi2.h5 multi3.h5 + h5dump error: Packed Bit length value(0) must be positive. diff --git a/tools/testfiles/tpbitsMaxExceeded.ddl b/tools/testfiles/tpbitsMaxExceeded.ddl index 2b3b68f..16f953d 100644 --- a/tools/testfiles/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/tpbitsMaxExceeded.ddl @@ -1,4 +1,4 @@ -usage: h5dump [OPTIONS] file +usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit -n, --contents Print a list of the file contents and exit @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] file -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -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 @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] file h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" 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 @@ -94,4 +101,8 @@ usage: h5dump [OPTIONS] file h5dump -d /dset -M 0,1,4,3 quux.h5 + 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5 + + h5dump -d /foo multi1.h5 multi2.h5 multi3.h5 + h5dump error: Too many masks requested (max. 8). Mask list(0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1) diff --git a/tools/testfiles/tpbitsOffsetExceeded.ddl b/tools/testfiles/tpbitsOffsetExceeded.ddl index 6ccdc26..446fe2d 100644 --- a/tools/testfiles/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/tpbitsOffsetExceeded.ddl @@ -1,4 +1,4 @@ -usage: h5dump [OPTIONS] file +usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit -n, --contents Print a list of the file contents and exit @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] file -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -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 @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] file h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" 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 @@ -94,4 +101,8 @@ usage: h5dump [OPTIONS] file h5dump -d /dset -M 0,1,4,3 quux.h5 + 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5 + + h5dump -d /foo multi1.h5 multi2.h5 multi3.h5 + h5dump error: Packed Bit offset value(64) must be between 0 and 63 diff --git a/tools/testfiles/tpbitsOffsetNegative.ddl b/tools/testfiles/tpbitsOffsetNegative.ddl index eb41bd7..747cf99 100644 --- a/tools/testfiles/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/tpbitsOffsetNegative.ddl @@ -1,4 +1,4 @@ -usage: h5dump [OPTIONS] file +usage: h5dump [OPTIONS] files OPTIONS -h, --help Print a usage message and exit -n, --contents Print a list of the file contents and exit @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] file -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -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 @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] file h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" 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 @@ -94,4 +101,8 @@ usage: h5dump [OPTIONS] file h5dump -d /dset -M 0,1,4,3 quux.h5 + 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5 + + h5dump -d /foo multi1.h5 multi2.h5 multi3.h5 + h5dump error: Bad mask list(-1,1) diff --git a/tools/testfiles/tperror.ddl b/tools/testfiles/tperror.ddl index 76988c8..16a7d8e 100644 --- a/tools/testfiles/tperror.ddl +++ b/tools/testfiles/tperror.ddl @@ -1,5 +1,35 @@ HDF5 "tfcontents1.h5" { -DATASET "bogus" { - } } -h5dump error: unable to open dataset "bogus" +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Dopen2(): not found + major: Dataset + minor: Object not found + #001: (file name) line (number) in H5G_loc_find(): can't find object + major: Symbol table + minor: Object not found + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed + major: Symbol table + minor: Object not found + #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + major: Symbol table + minor: Callback failed + #004: (file name) line (number) in H5G_loc_find_cb(): object 'bogus' doesn't exist + major: Symbol table + minor: Object not found +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Lget_info(): unable to get link info + major: Symbol table + minor: Object not found + #001: (file name) line (number) in H5L_get_info(): name doesn't exist + major: Symbol table + minor: Object already exists + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed + major: Symbol table + minor: Object not found + #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + major: Symbol table + minor: Callback failed + #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist + major: Symbol table + minor: Object not found +h5dump error: unable to get link info from "bogus" |