summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2012-08-06 14:18:55 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2012-08-06 14:18:55 (GMT)
commitc2491932d95b853304780bffa0929128e5721d5b (patch)
tree0ecc89bfe43d3ac328c6ecc852c425d3dcea80c2 /tools
parent451fd8514b148c9f03f3dc9faffb4452be003d7d (diff)
downloadhdf5-c2491932d95b853304780bffa0929128e5721d5b.zip
hdf5-c2491932d95b853304780bffa0929128e5721d5b.tar.gz
hdf5-c2491932d95b853304780bffa0929128e5721d5b.tar.bz2
[svn-r22632] Merge from trunk revision 22631
tested: local linux
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump/CMakeLists.txt36
-rw-r--r--tools/h5dump/h5dump.c26
-rw-r--r--tools/h5import/CMakeLists.txt122
-rw-r--r--tools/h5import/h5import.c2010
-rw-r--r--tools/h5import/h5import.h29
-rwxr-xr-xtools/h5import/h5importtestutil.sh109
-rw-r--r--tools/h5import/testfiles/dbinfp64.h5.txt2
-rw-r--r--tools/h5import/testfiles/dbinin16.h5.txt2
-rw-r--r--tools/h5import/testfiles/dbinin32.h5.txt2
-rw-r--r--tools/h5import/testfiles/dbinin8.h5.txt2
-rw-r--r--tools/h5import/testfiles/dbinin8w.h5.txt2
-rw-r--r--tools/h5import/testfiles/dbinuin16.h5.txt2
-rw-r--r--tools/h5import/testfiles/dbinuin32.h5.txt2
-rw-r--r--tools/h5import/testfiles/dtxtstr.h5.txt2
-rw-r--r--tools/lib/h5tools.c556
-rw-r--r--tools/lib/h5tools.h3
-rw-r--r--tools/lib/h5tools_dump.c4
-rw-r--r--tools/lib/h5tools_str.c873
-rw-r--r--tools/lib/h5tools_utils.c2
-rw-r--r--tools/lib/h5tools_utils.h2
-rw-r--r--tools/lib/h5trav.c25
-rw-r--r--tools/lib/h5trav.h2
-rw-r--r--tools/testfiles/h5dump-help.txt26
-rw-r--r--tools/testfiles/tnofilename-with-packed-bits.ddl26
-rw-r--r--tools/testfiles/tpbitsIncomplete.ddl26
-rw-r--r--tools/testfiles/tpbitsLengthExceeded.ddl26
-rw-r--r--tools/testfiles/tpbitsLengthPositive.ddl26
-rw-r--r--tools/testfiles/tpbitsMaxExceeded.ddl26
-rw-r--r--tools/testfiles/tpbitsOffsetExceeded.ddl26
-rw-r--r--tools/testfiles/tpbitsOffsetNegative.ddl26
30 files changed, 2870 insertions, 1153 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index e85773a..107aa04 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -1352,11 +1352,21 @@ IF (BUILD_TESTING)
# NATIVE default. the NATIVE test can be validated with h5import/h5diff
ADD_H5_TEST (tbin1 0 --enable-error-stack -d integer -o out1.bin -b tbinary.h5)
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5DUMP-tbin1 PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "H5DUMP-tbin1")
+
IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
- IF (NOT "${last_test}" STREQUAL "")
- SET_TESTS_PROPERTIES (H5DUMP-tbin1 PROPERTIES DEPENDS ${last_test})
- ENDIF (NOT "${last_test}" STREQUAL "")
- SET (last_test "H5DUMP-tbin1")
+ ADD_TEST (NAME H5DUMP-clear-out1D COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/out1D.h5)
+ SET_TESTS_PROPERTIES (H5DUMP-clear-out1D PROPERTIES DEPENDS H5DUMP-tbin1)
+ ADD_TEST (NAME H5DUMP-h5import-out1D COMMAND h5import out1.bin -c tbin1.out -o out1D.h5)
+ SET_TESTS_PROPERTIES (H5DUMP-h5import-out1D PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ SET_TESTS_PROPERTIES (H5DUMP-h5import-out1D PROPERTIES DEPENDS H5DUMP-clear-out1D)
+ ADD_TEST (NAME H5DUMP-h5diff-out1D COMMAND h5diff tbinary.h5 out1D.h5 /integer /integer)
+ SET_TESTS_PROPERTIES (H5DUMP-h5diff-out1D PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ SET_TESTS_PROPERTIES (H5DUMP-h5diff-out1D PROPERTIES DEPENDS H5DUMP-h5import-out1D)
+ SET (last_test "H5DUMP-h5diff-out1D")
ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
ADD_TEST (NAME H5DUMP-clear-out1 COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/out1.h5)
@@ -1381,11 +1391,21 @@ IF (BUILD_TESTING)
# the NATIVE test can be validated with h5import/h5diff
ADD_H5_TEST (tbin3 0 --enable-error-stack -d integer -o out3.bin -b NATIVE tbinary.h5)
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5DUMP-tbin3 PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "H5DUMP-tbin3")
+
IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
- IF (NOT "${last_test}" STREQUAL "")
- SET_TESTS_PROPERTIES (H5DUMP-tbin3 PROPERTIES DEPENDS ${last_test})
- ENDIF (NOT "${last_test}" STREQUAL "")
- SET (last_test "H5DUMP-tbin3")
+ ADD_TEST (NAME H5DUMP-clear-out3D COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/out3D.h5)
+ SET_TESTS_PROPERTIES (H5DUMP-clear-out3D PROPERTIES DEPENDS H5DUMP-tbin3)
+ ADD_TEST (NAME H5DUMP-h5import-out3D COMMAND h5import out3.bin -c tbin3.out -o out3D.h5)
+ SET_TESTS_PROPERTIES (H5DUMP-h5import-out3D PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ SET_TESTS_PROPERTIES (H5DUMP-h5import-out3D PROPERTIES DEPENDS H5DUMP-clear-out3D)
+ ADD_TEST (NAME H5DUMP-h5diff-out3D COMMAND h5diff tbinary.h5 out3D.h5 /integer /integer -q)
+ SET_TESTS_PROPERTIES (H5DUMP-h5diff-out3D PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ SET_TESTS_PROPERTIES (H5DUMP-h5diff-out3D PROPERTIES DEPENDS H5DUMP-h5import-out3D)
+ SET (last_test "H5DUMP-h5diff-out3D")
ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
ADD_TEST (NAME H5DUMP-clear-out3 COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/out3.h5)
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 15d862e..23fd1d9 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -297,10 +297,20 @@ usage(const char *prog)
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, " 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, " These are the letters that are appended to the file name(without .h5) when opening\n");
+ HDfprintf(rawoutstream, " names for the split(m,r) and multi(s,b,r,g,l,o) drivers. They are:\n");
+ HDfprintf(rawoutstream, " m: All meta data when using the split driver.\n");
+ HDfprintf(rawoutstream, " s: The userblock, superblock, and driver info block\n");
+ HDfprintf(rawoutstream, " b: B-tree nodes\n");
+ HDfprintf(rawoutstream, " r: Dataset raw data\n");
+ HDfprintf(rawoutstream, " g: Global heap\n");
+ HDfprintf(rawoutstream, " l: local heap (object names)\n");
+ HDfprintf(rawoutstream, " o: object headers\n");
+ HDfprintf(rawoutstream, "\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");
@@ -337,9 +347,13 @@ usage(const char *prog)
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, " 5) Dataset foo in files file1.h5 file2.h5 file3.h5\n");
+ HDfprintf(rawoutstream, "\n");
+ HDfprintf(rawoutstream, " h5dump -d /foo file1.h5 file2.h5 file3.h5\n");
+ HDfprintf(rawoutstream, "\n");
+ HDfprintf(rawoutstream, " 6) Dataset foo in split files splitfile-m.h5 splitfile-r.h5\n");
HDfprintf(rawoutstream, "\n");
- HDfprintf(rawoutstream, " h5dump -d /foo multi1.h5 multi2.h5 multi3.h5\n");
+ HDfprintf(rawoutstream, " h5dump -d /foo -f split splitfile\n");
HDfprintf(rawoutstream, "\n");
}
diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt
index bbe73a8..c563819 100644
--- a/tools/h5import/CMakeLists.txt
+++ b/tools/h5import/CMakeLists.txt
@@ -59,6 +59,14 @@ IF (BUILD_TESTING)
txtin32.txt
textpfe64.txt
txtstr.txt
+ dbinfp64.h5.txt
+ dbinin8.h5.txt
+ dbinin8w.h5.txt
+ dbinin16.h5.txt
+ dbinin32.h5.txt
+ dbinuin16.h5.txt
+ dbinuin32.h5.txt
+ dtxtstr.h5.txt
)
SET (HDF5_REFERENCE_TEST_FILES
binfp64.h5
@@ -170,7 +178,101 @@ IF (BUILD_TESTING)
SET_TESTS_PROPERTIES (H5IMPORT-H5DMP_CMP-${testname} PROPERTIES DEPENDS H5IMPORT-H5DMP-${testname})
SET (last_test "H5IMPORT-H5DMP_CMP-${testname}")
ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
- ENDMACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
+ ENDMACRO (ADD_H5_TEST testname importfile conffile testfile)
+
+ MACRO (ADD_H5_DUMPTEST testname datasetname testfile)
+ # If using memchecker add tests without using scripts
+ IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (
+ NAME H5IMPORT-DUMP-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ d${testfile}
+ d${testfile}.bin
+ d${testfile}.imp
+ d${testfile}.imp.err
+ d${testfile}.dmp
+ d${testfile}.dmp.err
+ d${testfile}.dff
+ d${testfile}.dff.err
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5IMPORT-DUMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+
+ IF ("${ARGN}" STREQUAL "BINARY")
+ ADD_TEST (
+ NAME H5IMPORT-DUMP-${testname}-H5DUMP
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-b;testfiles/${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=d${testfile}.dmp"
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ELSE ("${ARGN}" STREQUAL "BINARY")
+ ADD_TEST (
+ NAME H5IMPORT-DUMP-${testname}-H5DUMP
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-y;--width=1;testfiles/${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=d${testfile}.dmp"
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDIF ("${ARGN}" STREQUAL "BINARY")
+ SET_TESTS_PROPERTIES (H5IMPORT-DUMP-${testname}-H5DUMP PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-clear-objects")
+
+ ADD_TEST (
+ NAME H5IMPORT-DUMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5import>"
+ -D "TEST_ARGS:STRING=d${testfile}.bin;-c;d${testfile}.dmp;-o;d${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=d${testfile}.imp"
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ SET_TESTS_PROPERTIES (H5IMPORT-DUMP-${testname} PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-H5DUMP")
+
+ ADD_TEST (
+ NAME H5IMPORT-DUMP-${testname}-H5DIFF
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff>"
+ -D "TEST_ARGS:STRING=-v;d${testfile};testfiles/${testfile};${datasetname};${datasetname}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=d${testfile}.dff"
+ -D "TEST_EXPECT=0"
+ -D "TEST_FILTER=(^(Warning)[^\n]*)"
+ -D "TEST_REFERENCE=testfiles/d${testfile}.txt"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ SET_TESTS_PROPERTIES (H5IMPORT-DUMP-${testname}-H5DIFF PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}")
+ SET (last_test "H5IMPORT-DUMP-${testname}-H5DIFF")
+ ELSE (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (
+ NAME H5IMPORT-DUMP-${testname}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname} ${datasetname} ${testfile}"
+ )
+ ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_DUMPTEST testname datasetname testfile)
+
+ MACRO (ADD_H5_SKIP_DUMPTEST testname datasetname testfile)
+ ADD_TEST (
+ NAME H5IMPORT-DUMP-${testname}-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname} ${datasetname} ${testfile} --- DEFLATE filter not available"
+ )
+ ENDMACRO (ADD_H5_SKIP_DUMPTEST testname datasetname testfile)
+
+ # --------------------------------------------------------------------
+ # Determine if filter is available for h5diff
+ # --------------------------------------------------------------------
+ SET (USE_FILTER_DEFLATE H5_HAVE_FILTER_DEFLATE)
##############################################################################
##############################################################################
@@ -223,27 +325,43 @@ IF (BUILD_TESTING)
# ----- TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed "
ADD_H5_TEST (BINARY_F64 binfp64.bin testfiles/binfp64.conf binfp64.h5)
+ IF (NOT USE_FILTER_DEFLATE)
+ ADD_H5_SKIP_DUMPTEST (BINARY_F64 "/fp/bin/64-bit" binfp64.h5 BINARY)
+ ELSE (NOT USE_FILTER_DEFLATE)
+ ADD_H5_DUMPTEST (BINARY_F64 "/fp/bin/64-bit" binfp64.h5 BINARY)
+ ENDIF (NOT USE_FILTER_DEFLATE)
# ----- TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed "
ADD_H5_TEST (BINARY_I8 binin8.bin testfiles/binin8.conf binin8.h5)
+ IF (NOT USE_FILTER_DEFLATE)
+ ADD_H5_SKIP_DUMPTEST (BINARY_I8 "/int/bin/8-bit" binin8.h5 BINARY)
+ ELSE (NOT USE_FILTER_DEFLATE)
+ ADD_H5_DUMPTEST (BINARY_I8 "/int/bin/8-bit" binin8.h5 BINARY)
+ ENDIF (NOT USE_FILTER_DEFLATE)
# ----- TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended "
ADD_H5_TEST (BINARY_I16 binin16.bin testfiles/binin16.conf binin16.h5)
+ ADD_H5_DUMPTEST (BINARY_I16 "/int/bin/16-bit" binin16.h5 BINARY)
# ----- TESTING "BINARY I32 - rank 3 - Output BE + CHUNKED "
ADD_H5_TEST (BINARY_I32 binin32.bin testfiles/binin32.conf binin32.h5)
+ ADD_H5_DUMPTEST (BINARY_I32 "/int/bin/32-bit" binin32.h5 BINARY)
# ----- TESTING "BINARY UI16 - rank 3 - Output byte BE + CHUNKED "
ADD_H5_TEST (BINARY_UI16 binuin16.bin testfiles/binuin16.conf binuin16.h5)
+ ADD_H5_DUMPTEST (BINARY_UI16 "/int/buin/16-bit" binuin16.h5 BINARY)
- # ----- TESTING "BINARY UI32 - rank 3 - Output LE + CHUNKED "
+ # ----- TESTING "BINARY UI32 - rank 3 - Output LE "
ADD_H5_TEST (BINARY_UI32 binuin32.bin testfiles/binuin32.conf binuin32.h5)
+ ADD_H5_DUMPTEST (BINARY_UI32 "/int/buin/32-bit" binuin32.h5 BINARY)
# ----- TESTING "STR"
ADD_H5_TEST (STR testfiles/txtstr.txt testfiles/txtstr.conf txtstr.h5)
+ ADD_H5_DUMPTEST (STR "/mytext/data" txtstr.h5)
# ----- TESTING "BINARY I8 CR LF EOF"
ADD_H5_TEST (BINARY_I8_EOF binin8w.bin testfiles/binin8w.conf binin8w.h5)
+ ADD_H5_DUMPTEST (BINARY_I8_EOF "/dataset0" binin8w.h5 BINARY)
# ----- TESTING "ASCII F64 - rank 1 - INPUT-CLASS TEXTFPE "
ADD_H5_TEST (ASCII_F64_R1 testfiles/textpfe64.txt testfiles/textpfe.conf textpfe.h5)
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c
index 56dc5ab..34870fb 100644
--- a/tools/h5import/h5import.c
+++ b/tools/h5import/h5import.c
@@ -371,11 +371,19 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id)
break;
case 5: /* STR */
-
- if (processStrData(strm, in, file_id) == -1) {
- (void) HDfprintf(stderr, err11, infile);
- HDfclose(strm);
- return (-1);
+ if (in->h5dumpInput) {
+ if (processStrHDFData(strm, in, file_id) == -1) {
+ (void) HDfprintf(stderr, err11, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ }
+ else {
+ if (processStrData(strm, in, file_id) == -1) {
+ (void) HDfprintf(stderr, err11, infile);
+ HDfclose(strm);
+ return (-1);
+ }
}
break;
@@ -944,6 +952,179 @@ out:
return (-1);
}
+/*-------------------------------------------------------------------------
+ * Function: processStrData
+ *
+ * Purpose: read an ASCII file with string data and generate an HDF5 dataset
+ * with a variable length type
+ *
+ * Return: 0, ok, -1 no
+ *
+ *-------------------------------------------------------------------------
+ */
+static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
+{
+ hid_t group_id;
+ hid_t dset_id;
+ hid_t space_id;
+ hid_t mspace_id;
+ hid_t type_id;
+ hid_t handle;
+ char *str1 = NULL;
+ char *str2 = NULL;
+ char *str3 = NULL;
+ char str[1024] = "";
+ char c;
+ int results;
+ int j;
+ int nlines = 0;
+ int line;
+
+ /*-------------------------------------------------------------------------
+ * read file and generate an HDF5 dataset
+ *-------------------------------------------------------------------------
+ */
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING\n");
+#endif
+
+ if ((type_id = H5Tcopy(H5T_C_S1)) < 0)
+ goto out;
+
+ if (H5Tset_size(type_id, H5T_VARIABLE) < 0)
+ goto out;
+
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ /* create parent groups */
+ if (in->path.count > 1) {
+ j = 0;
+ handle = file_id;
+ while (j < in->path.count - 1) {
+ if ((group_id = H5Gopen2(handle, in->path.group[j], H5P_DEFAULT)) < 0) {
+ group_id = H5Gcreate2(handle, in->path.group[j++], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for (; j < in->path.count - 1; j++)
+ group_id = H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ handle = group_id;
+ break;
+ }
+ handle = group_id;
+ j++;
+ }
+ }
+ else {
+ handle = file_id;
+ j = 0;
+ }
+
+ /*enable error reporting */
+ }
+ H5E_END_TRY;
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING groups created\n");
+#endif
+
+ if ((space_id = H5Screate_simple(in->rank, in->sizeOfDimension, NULL)) < 0)
+ goto out;
+
+ if ((mspace_id = H5Screate(H5S_SCALAR)) < 0)
+ goto out;
+
+ if ((dset_id = H5Dcreate2(handle, in->path.group[j], type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING ready to process strings\n");
+#endif
+ line = 0;
+ j = 0;
+
+ while (HDfgets(str,sizeof(str),strm)) {
+ str1 = str;
+ str2 = NULL;
+ str3 = NULL;
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING[%d]={%s}\n", line, str1);
+#endif
+ /* process string to remove the first and last quote char */
+ str2 = strchr(str1, '"');
+ if (str2 != NULL) {
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str2), str2);
+#endif
+ str2++;
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str2), str2);
+#endif
+ str3 = strrchr(str2, '"');
+ if (str3 != NULL) {
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str3), str3);
+#endif
+ *str3 = '\0';
+
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str2), str2);
+#endif
+
+ if(strlen(str2) > 0) {
+ hid_t fspace_id;
+ hsize_t start[1];
+ hsize_t count[1] = { 1 };
+
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING[%d] store %s\n", line, str2);
+#endif
+ if ((fspace_id = H5Dget_space(dset_id)) < 0)
+ goto out;
+
+ start[0] = line++;
+
+ if (H5Sselect_hyperslab(fspace_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ goto out;
+
+ if (H5Dwrite(dset_id, type_id, mspace_id, fspace_id, H5P_DEFAULT, &str2) < 0)
+ goto out;
+
+ if (H5Sclose(fspace_id) < 0)
+ goto out;
+ }
+ }
+ }
+ str[0] = '\0';
+ j++;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING eof reached\n");
+#endif
+
+ /* close */
+ H5Dclose(dset_id);
+ H5Sclose(space_id);
+ H5Sclose(mspace_id);
+ H5Tclose(type_id);
+
+ return (0);
+
+out:
+#ifdef H5DEBUGIMPORT
+ printf("processStrHDFData DATATYPE STRING error exit\n");
+#endif
+/* disable error reporting */
+H5E_BEGIN_TRY
+{
+ /* close */
+ H5Dclose(dset_id);
+ H5Sclose(space_id);
+ H5Sclose(mspace_id);
+ H5Tclose(type_id);
+}
+H5E_END_TRY;
+
+ return (-1);
+}
+
static int allocateIntegerStorage(struct Input *in)
{
hsize_t len = 1;
@@ -1075,6 +1256,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
int kindex;
char temp[255];
int ival;
+ int scanret;
const char *err1 = "Unable to open the configuration file: %s for reading.\n";
const char *err2 = "Unknown keyword in configuration file: %s\n";
@@ -1124,285 +1306,888 @@ static int processConfigurationFile(char *infile, struct Input *in)
return (-1);
}
- while (fscanf(strm, "%s", key) == 1) {
- if ((kindex = mapKeywordToIndex(key)) == -1) {
- (void) HDfprintf(stderr, err2, infile);
- HDfclose(strm);
- return (-1);
- }
- switch (kindex) {
- case 0: /* PATH */
- if (in->configOptionVector[PATH] == 1) {
- (void) HDfprintf(stderr, err3a, infile);
- HDfclose(strm);
- return (-1);
- }
- if (fscanf(strm, "%s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
- }
- if (parsePathInfo(&in->path, temp) == -1) {
- (void) HDfprintf(stderr, err3b, infile);
- HDfclose(strm);
- return (-1);
- }
- in->configOptionVector[PATH] = 1;
- break;
+ scanret = fscanf(strm, "%s", key);
+ if((scanret == 1) && !HDstrcmp("HDF5", key)) {
+#ifdef H5DEBUGIMPORT
+ int pndx;
+ printf("\nh5dump file\n");
+#endif
+ in->h5dumpInput = 1;
+ scanret = fscanf(strm, "%s", temp); /* filename */
+ scanret = fscanf(strm, "%s", temp); /* start bracket */
+ scanret = fscanf(strm, "%s", key); /* DATASET */
+ while (scanret == 1) {
+ if(!HDstrcmp("DATASET", key)) { /* PATH */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASET key\n");
+#endif
+ if (in->configOptionVector[PATH] == 1) {
+ (void) HDfprintf(stderr, err3a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASET %s found\n", temp);
+#endif
+ if (parsePathInfo(&in->path, temp) == -1) {
+ (void) HDfprintf(stderr, err3b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ in->configOptionVector[PATH] = 1;
+ scanret = fscanf(strm, "%s", temp); /* start bracket */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASET %s found\n", temp);
+#endif
+ } /* if(!HDstrcmp("DATASET", key)) PATH */
+ else if(!HDstrcmp("DATATYPE", key)) { /* INPUT-CLASS */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE key\n");
+#endif
+ if (in->configOptionVector[INPUT_CLASS] == 1) {
+ (void) HDfprintf(stderr, err4a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
- case 1: /* INPUT-CLASS */
- if (in->configOptionVector[INPUT_CLASS] == 1) {
- (void) HDfprintf(stderr, err4a, infile);
- HDfclose(strm);
- return (-1);
- }
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE %s found\n", temp);
+#endif
+ if ((kindex = getInputClassType(in, temp)) == -1) {
+ (void) HDfprintf(stderr, err4b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE type %d inputClass\n", in->inputClass);
+#endif
- if (fscanf(strm, "%s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
- HDfclose(strm);
- return (-1);
- }
- if (getInputClass(in, temp) == -1) {
- (void) HDfprintf(stderr, err4b, infile);
- HDfclose(strm);
- return (-1);
- }
+ in->configOptionVector[INPUT_CLASS] = 1;
+
+ /*set default value for output-class */
+ if (in->configOptionVector[OUTPUT_CLASS] == 0) {
+ if (in->inputClass == 0 || in->inputClass == 4)
+ in->outputClass = 0;
+ if (in->inputClass == 1 || in->inputClass == 2
+ || in->inputClass == 3)
+ in->outputClass = 1;
+ if (in->inputClass == 6 || in->inputClass == 7)
+ in->outputClass = 2;
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE type %d outputClass\n", in->outputClass);
+#endif
- in->configOptionVector[INPUT_CLASS] = 1;
-
- /*set default value for output-class */
- if (in->configOptionVector[OUTPUT_CLASS] == 0) {
- if (in->inputClass == 0 || in->inputClass == 4)
- in->outputClass = 0;
- if (in->inputClass == 1 || in->inputClass == 2
- || in->inputClass == 3)
- in->outputClass = 1;
- if (in->inputClass == 6 || in->inputClass == 7)
- in->outputClass = 2;
- }
- break;
+ if(in->inputClass == 5) { /* STRING */
+ int get_next_prop = 1;
+ in->outputClass = -1;
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING found\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING %s found\n", temp);
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* string properties */
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+ while (get_next_prop) {
+ if(!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err19);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING STRSIZE %s found\n", temp);
+#endif
+ if (HDstrcmp("H5T_VARIABLE;", temp)) {
+ char *more = temp;
+ ival = HDstrtol(more, &more, 10);
+ if (getInputSize(in, ival) == -1) {
+ (void) HDfprintf(stderr, err5b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING %d InputSize\n", in->inputSize);
+#endif
+ }
+ }
+ else if(!HDstrcmp("STRPAD", temp)) { /* STRPAD */
+ if (fscanf(strm, "%s", temp) != 1) { /* STRPAD type */
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING STRPAD %s found\n", temp);
+#endif
+ }
+ else if(!HDstrcmp("CSET", key)) { /* CSET */
+ if (fscanf(strm, "%s", temp) != 1) { /* CSET type */
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING CSET %s found\n", temp);
+#endif
- case 2: /* INPUT-SIZE */
- if (in->configOptionVector[INPUT_SIZE] == 1) {
- (void) HDfprintf(stderr, err5a, infile);
- HDfclose(strm);
- return (-1);
+ }
+ else if(!HDstrcmp("CTYPE", temp)) { /* CTYPE */
+ if (fscanf(strm, "%s", temp) != 1) { /* CTYPE type */
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING CTYPE %s found\n", temp);
+#endif
+ } /* if(!HDstrcmp("CSET", key)) */
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING %s found\n", temp);
+#endif
+ if(!HDstrcmp("}", temp)) { /* end bracket */
+ get_next_prop = 0;
+ }
+ } /* while (get_next_prop) */
+ } /* if(kindex == 5) STRING */
+ } /* else if(!HDstrcmp("DATATYPE", key)) INPUT-CLASS */
+ else if(!HDstrcmp("DATASPACE", key)) { /* RANK and DIMENSIONS */
+ hsize_t temp_dims[MAX_NUM_DIMENSION];
+
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE key\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+ if(!HDstrcmp("SCALAR", temp)) { /* SCALAR */
+ in->rank = 0;
+ } /* if(!HDstrcmp("SCALAR", key)) */
+ else if(!HDstrcmp("NULL", temp)) { /* NULL */
+ (void) HDfprintf(stderr, err6b, infile);
+ HDfclose(strm);
+ return (-1);
+ } /* else if(!HDstrcmp("NULL", key)) */
+ else if(!HDstrcmp("SIMPLE", temp)) { /* SIMPLE */
+ int icount = 0;
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE found\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
+ (void) HDfprintf(stderr, err6b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* start paren */
+ (void) HDfprintf(stderr, err6b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ if(!HDstrcmp("(", temp)) { /* start paren */
+ int get_next_dim = 1;
+ int i = 0;
+
+ if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */
+ (void) HDfprintf(stderr, err16c, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ while (get_next_dim) {
+ char *more = temp;
+ temp_dims[icount] = HDstrtoull(more, &more, 10);
+ if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */
+ (void) HDfprintf(stderr, err6b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ if(!HDstrcmp(")", temp)) { /* end paren */
+ in->rank = ++icount;
+ in->configOptionVector[RANK] = 1;
+ get_next_dim = 0;
+ }
+ else { /* Dimension */
+ icount++;
+ if (icount > MAX_NUM_DIMENSION) {
+ (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ HDfclose(strm);
+ return (-1);
+ }
+ }
+ } /* while (get_next_dim) */
+
+ if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
+ (void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n");
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %d rank\n", in->rank);
+#endif
+ for (i = 0; i < in->rank; i++) {
+ in->sizeOfDimension[i] = temp_dims[i];
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE dims:", in->rank);
+ for (pndx = 0; pndx < in->rank; pndx++) {
+ printf(" %d", in->sizeOfDimension[pndx]);
+ }
+ printf("\n");
+#endif
+ in->configOptionVector[DIM] = 1;
+ } /* if(!HDstrcmp("(", key)) start paren */
+ else {
+ (void) HDfprintf(stderr, err5b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ if(!HDstrcmp("/", temp)) { /* / max dims */
+ if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
+ (void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n");
+ return (-1);
+ }
+ if (fscanf(strm, "%s", temp) != 1) { /* start paren */
+ (void) HDfprintf(stderr, err6b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ if(!HDstrcmp("(", temp)) { /* start paren */
+ int get_next_dim = 1;
+ int i = 0;
+
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE process max dim values\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* max dim with optional comma */
+ (void) HDfprintf(stderr, err16c, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ while (get_next_dim) {
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE get max dim value\n");
+#endif
+ if(!HDstrcmp("H5S_UNLIMITED", temp) || !HDstrcmp("H5S_UNLIMITED,", temp)) { /* unlimited */
+ in->maxsizeOfDimension[i] = H5S_UNLIMITED;
+ in->configOptionVector[EXTEND] = 1;
+ }
+ else {
+ char *more = temp;
+ in->maxsizeOfDimension[i] = HDstrtoull(more, &more, 10);
+ }
+ if (fscanf(strm, "%s", temp) != 1) { /* max dim or end paren */
+ (void) HDfprintf(stderr, err16c, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ if(!HDstrcmp(")", temp)) { /* end paren */
+ get_next_dim = 0;
+ }
+ else { /* comma */
+ i++;
+ if (i > MAX_NUM_DIMENSION) {
+ (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ HDfclose(strm);
+ return (-1);
+ }
+ }
+ } /* while (get_next_dim) */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE maxdims:", in->rank);
+ for (pndx = 0; pndx < in->rank; pndx++) {
+ printf(" %d", in->maxsizeOfDimension[pndx]);
+ }
+ printf("\n");
+ printf("h5dump DATASPACE SIMPLE get max dim finished\n");
+#endif
+ } /* if(!HDstrcmp("(", key)) start paren */
+ else {
+ (void) HDfprintf(stderr, err16c, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ scanret = fscanf(strm, "%s", temp); /* end bracket */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATASPACE SIMPLE %s found\n", temp);
+#endif
+ } /* if(!HDstrcmp("/", key)) max dims separator */
+ } /* else if(!HDstrcmp("SIMPLE", key)) */
+ else {
+ (void) HDfprintf(stderr, err5b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ } /* else if(!HDstrcmp("DATASPACE", key)) RANK and DIMENSIONS */
+ else if(!HDstrcmp("STORAGE_LAYOUT", key)) { /* CHUNKED-DIMENSION-SIZES */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT key\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
+ (void) HDfprintf(stderr, err6b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT %s found\n", temp);
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* CHUNKED */
+ (void) HDfprintf(stderr, err6b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT %s found\n", temp);
+#endif
+ if(!HDstrcmp("CHUNKED", temp)) { /* CHUNKED */
+ if ((in->sizeOfChunk = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
+ (void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n");
+ return (-1);
+ }
+ if (fscanf(strm, "%s", temp) != 1) { /* start paren */
+ (void) HDfprintf(stderr, err6b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
+#endif
+ if(!HDstrcmp("(", temp)) { /* start paren */
+ int get_next_dim = 1;
+ int icount = 0;
+
+ if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */
+ (void) HDfprintf(stderr, err16c, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
+#endif
+ while (get_next_dim) {
+ char *more = temp;
+ in->sizeOfChunk[icount] = HDstrtoull(more, &more, 10);
+ if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */
+ (void) HDfprintf(stderr, err6b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
+#endif
+ if(!HDstrcmp(")", temp)) { /* end paren */
+ in->configOptionVector[RANK] = 1;
+ get_next_dim = 0;
+ }
+ else { /* Dimension */
+ icount++;
+ if (icount > MAX_NUM_DIMENSION) {
+ (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ HDfclose(strm);
+ return (-1);
+ }
+ }
+ } /* while (get_next_dim) */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED dims:", in->rank);
+ for (pndx = 0; pndx < in->rank; pndx++) {
+ printf(" %d", in->sizeOfChunk[pndx]);
+ }
+ printf("\n");
+#endif
+ in->configOptionVector[DIM] = 1;
+ } /* if(!HDstrcmp("(", key)) start paren */
+ else {
+ (void) HDfprintf(stderr, err5b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ if (fscanf(strm, "%s", temp) != 1) { /* SIZE */
+ (void) HDfprintf(stderr, err6b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
+#endif
+ if(!HDstrcmp("SIZE", temp)) { /* SIZE */
+ if (fscanf(strm, "%d", (&ival)) != 1) {
+ (void) HDfprintf(stderr, "%s", err19);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED SIZE %d found\n", ival);
+#endif
+ }
+ while (HDstrcmp("}", temp)) {
+ if (fscanf(strm, "%s", temp) != 1) { /* end bracket */
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
+#endif
+ }
+ in->configOptionVector[CHUNK] = 1;
+ } /* if(!HDstrcmp("CHUNKED", key)) CHUNKED */
+ } /* else if(!HDstrcmp("STORAGE_LAYOUT", key)) CHUNKED-DIMENSION-SIZES */
+ else if(!HDstrcmp("FILTERS", key)) { /* FILTERS */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS key\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
+ (void) HDfprintf(stderr, err6b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS %s found\n", temp);
+#endif
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, err6b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS %s found\n", temp);
+#endif
+ if(!HDstrcmp("COMPRESSION", temp)) { /* COMPRESSION */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS COMPRESSION found\n");
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* DEFLATE */
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS COMPRESSION %s found\n", temp);
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* bgin bracket */
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS COMPRESSION %s found\n", temp);
+#endif
+ if (fscanf(strm, "%s", temp) != 1) { /* LEVEL */
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS COMPRESSION %s found\n", temp);
+#endif
+ if (fscanf(strm, "%d", (&ival)) != 1) {
+ (void) HDfprintf(stderr, "%s", err19);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival);
+#endif
+ in->compressionParam = ival;
+ if (fscanf(strm, "%s", temp) != 1) { /* end bracket */
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS COMPRESSION %s found\n", temp);
+#endif
+ in->compressionType = 0; /* ONLY GZIP supported */
+ in->configOptionVector[COMPRESS] = 1;
+ }
+ else if(!HDstrcmp("CONTIGUOUS", temp)) { /* CONTIGUOUS */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS CONTIGUOUS found\n");
+#endif
+ in->configOptionVector[COMPRESS] = 0;
+ }
+ else if(!HDstrcmp("NONE", temp)) { /* NONE */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS NONE found\n");
+#endif
+ in->configOptionVector[COMPRESS] = 0;
+ }
+ if (fscanf(strm, "%s", temp) != 1) { /* end bracket */
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump FILTERS %s found\n", temp);
+#endif
}
- if (fscanf(strm, "%d", (&ival)) != 1) {
- (void) HDfprintf(stderr, "%s", err19);
- HDfclose(strm);
- return (-1);
+ else if(!HDstrcmp("DATA", key)) { /* FINSHED */
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATA key\n");
+#endif
+ scanret = 0;
+ break;
}
- if (getInputSize(in, ival) == -1) {
- (void) HDfprintf(stderr, err5b, infile);
+ scanret = fscanf(strm, "%s", key);
+ }
+#ifdef H5DEBUGIMPORT
+ printf("h5dump path");
+ for (pndx = 0; pndx < in->path.count; pndx++) {
+ printf(" : %s", in->path.group[pndx]);
+ }
+ printf("\n");
+ printf("h5dump inputClass=%d\n", in->inputClass);
+ printf("h5dump inputSize=%d\n", in->inputSize);
+ printf("h5dump rank=%d\n", in->rank);
+ printf("h5dump outputClass=%d\n", in->outputClass);
+ printf("h5dump outputSize=%d\n", in->outputSize);
+ printf("h5dump outputArchitecture=%d\n", in->outputArchitecture);
+ printf("h5dump outputByteOrder=%d\n", in->outputByteOrder);
+ printf("h5dump compressionType=%d\n", in->compressionType);
+ printf("h5dump compressionParam=%d\n", in->compressionParam);
+ printf("h5dump externFilename=%s\n", in->externFilename);
+ printf("h5dump configOptionVector:\n");
+ for (pndx = 0; pndx < NUM_KEYS; pndx++) {
+ printf(" %s=%d\n", keytable[pndx], in->configOptionVector[pndx]);
+ }
+#endif
+ }
+ else {
+ while (scanret == 1) {
+ if ((kindex = mapKeywordToIndex(key)) == -1) {
+ (void) HDfprintf(stderr, err2, infile);
HDfclose(strm);
return (-1);
}
- in->configOptionVector[INPUT_SIZE] = 1;
+ switch (kindex) {
+ case 0: /* PATH */
+ if (in->configOptionVector[PATH] == 1) {
+ (void) HDfprintf(stderr, err3a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+ if (parsePathInfo(&in->path, temp) == -1) {
+ (void) HDfprintf(stderr, err3b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ in->configOptionVector[PATH] = 1;
+ break;
- /*set default value for output-size */
- if (in->configOptionVector[OUTPUT_SIZE] == 0)
- in->outputSize = in->inputSize;
- break;
+ case 1: /* INPUT-CLASS */
+ if (in->configOptionVector[INPUT_CLASS] == 1) {
+ (void) HDfprintf(stderr, err4a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
- case 3: /* RANK */
- if (in->configOptionVector[RANK] == 1) {
- (void) HDfprintf(stderr, err6a, infile);
- HDfclose(strm);
- return (-1);
- }
+ if (fscanf(strm, "%s", temp) != 1) {
+ (void) HDfprintf(stderr, "%s", err18);
+ HDfclose(strm);
+ return (-1);
+ }
+ if (getInputClass(in, temp) == -1) {
+ (void) HDfprintf(stderr, err4b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
- if (getRank(in, strm) == -1) {
- (void) HDfprintf(stderr, err6b, infile);
- HDfclose(strm);
- return (-1);
- }
- in->configOptionVector[RANK] = 1;
- break;
+ in->configOptionVector[INPUT_CLASS] = 1;
+
+ /*set default value for output-class */
+ if (in->configOptionVector[OUTPUT_CLASS] == 0) {
+ if (in->inputClass == 0 || in->inputClass == 4)
+ in->outputClass = 0;
+ if (in->inputClass == 1 || in->inputClass == 2
+ || in->inputClass == 3)
+ in->outputClass = 1;
+ if (in->inputClass == 6 || in->inputClass == 7)
+ in->outputClass = 2;
+ }
+ break;
- case 4: /* DIMENSION-SIZES */
- if (in->configOptionVector[DIM] == 1) {
- (void) HDfprintf(stderr, err7a, infile);
- HDfclose(strm);
- return (-1);
- }
+ case 2: /* INPUT-SIZE */
+ if (in->configOptionVector[INPUT_SIZE] == 1) {
+ (void) HDfprintf(stderr, err5a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ if (fscanf(strm, "%d", (&ival)) != 1) {
+ (void) HDfprintf(stderr, "%s", err19);
+ HDfclose(strm);
+ return (-1);
+ }
+ if (getInputSize(in, ival) == -1) {
+ (void) HDfprintf(stderr, err5b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ in->configOptionVector[INPUT_SIZE] = 1;
- if (in->configOptionVector[RANK] == 0) {
- (void) HDfprintf(stderr, err7b, infile);
- HDfclose(strm);
- return (-1);
- }
- if (getDimensionSizes(in, strm) == -1) {
- (void) HDfprintf(stderr, err7c, infile);
- HDfclose(strm);
- return (-1);
- }
- in->configOptionVector[DIM] = 1;
- break;
+ /*set default value for output-size */
+ if (in->configOptionVector[OUTPUT_SIZE] == 0)
+ in->outputSize = in->inputSize;
+ break;
- case 5: /* OUTPUT-CLASS */
- if (in->configOptionVector[OUTPUT_CLASS] == 1) {
- (void) HDfprintf(stderr, err8a, infile);
- HDfclose(strm);
- return (-1);
- }
+ case 3: /* RANK */
+ if (in->configOptionVector[RANK] == 1) {
+ (void) HDfprintf(stderr, err6a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
- if (getOutputClass(in, strm) == -1) {
- (void) HDfprintf(stderr, err8b, infile);
- HDfclose(strm);
- return (-1);
- }
- in->configOptionVector[OUTPUT_CLASS] = 1;
- break;
+ if (getRank(in, strm) == -1) {
+ (void) HDfprintf(stderr, err6b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ in->configOptionVector[RANK] = 1;
+ break;
- case 6: /* OUTPUT-SIZE */
- if (in->configOptionVector[OUTPUT_SIZE] == 1) {
- (void) HDfprintf(stderr, err9a, infile);
- HDfclose(strm);
- return (-1);
- }
+ case 4: /* DIMENSION-SIZES */
+ if (in->configOptionVector[DIM] == 1) {
+ (void) HDfprintf(stderr, err7a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
- if (getOutputSize(in, strm) == -1) {
- (void) HDfprintf(stderr, err9b, infile);
- HDfclose(strm);
- return (-1);
- }
- in->configOptionVector[OUTPUT_SIZE] = 1;
- break;
+ if (in->configOptionVector[RANK] == 0) {
+ (void) HDfprintf(stderr, err7b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ if (getDimensionSizes(in, strm) == -1) {
+ (void) HDfprintf(stderr, err7c, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ in->configOptionVector[DIM] = 1;
+ break;
- case 7: /* OUTPUT-ARCHITECTURE */
- if (in->configOptionVector[OUTPUT_ARCH] == 1) {
- (void) HDfprintf(stderr, err10a, infile);
- HDfclose(strm);
- return (-1);
- }
+ case 5: /* OUTPUT-CLASS */
+ if (in->configOptionVector[OUTPUT_CLASS] == 1) {
+ (void) HDfprintf(stderr, err8a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
- if (getOutputArchitecture(in, strm) == -1) {
- (void) HDfprintf(stderr, err10b, infile);
- HDfclose(strm);
- return (-1);
- }
- in->configOptionVector[OUTPUT_ARCH] = 1;
- break;
+ if (getOutputClass(in, strm) == -1) {
+ (void) HDfprintf(stderr, err8b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ in->configOptionVector[OUTPUT_CLASS] = 1;
+ break;
- case 8: /* OUTPUT-BYTE-ORDER */
- if (in->configOptionVector[OUTPUT_B_ORDER] == 1) {
- (void) HDfprintf(stderr, err11a, infile);
- HDfclose(strm);
- return (-1);
- }
+ case 6: /* OUTPUT-SIZE */
+ if (in->configOptionVector[OUTPUT_SIZE] == 1) {
+ (void) HDfprintf(stderr, err9a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
- if (getOutputByteOrder(in, strm) == -1) {
- (void) HDfprintf(stderr, err11b, infile);
- HDfclose(strm);
- return (-1);
- }
- in->configOptionVector[OUTPUT_B_ORDER] = 1;
- break;
+ if (getOutputSize(in, strm) == -1) {
+ (void) HDfprintf(stderr, err9b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ in->configOptionVector[OUTPUT_SIZE] = 1;
+ break;
- case 9: /* CHUNKED-DIMENSION-SIZES */
- if (in->configOptionVector[CHUNK] == 1) {
- (void) HDfprintf(stderr, err12a, infile);
- HDfclose(strm);
- return (-1);
- }
- /* cant appear before dimension sizes have been provided */
- if (in->configOptionVector[DIM] == 0) {
- (void) HDfprintf(stderr, err12b, infile);
- HDfclose(strm);
- return (-1);
- }
+ case 7: /* OUTPUT-ARCHITECTURE */
+ if (in->configOptionVector[OUTPUT_ARCH] == 1) {
+ (void) HDfprintf(stderr, err10a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
- if (getChunkedDimensionSizes(in, strm) == -1) {
- (void) HDfprintf(stderr, err12c, infile);
- HDfclose(strm);
- return (-1);
- }
- in->configOptionVector[CHUNK] = 1;
- break;
+ if (getOutputArchitecture(in, strm) == -1) {
+ (void) HDfprintf(stderr, err10b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ in->configOptionVector[OUTPUT_ARCH] = 1;
+ break;
- case 10: /* COMPRESSION-TYPE */
- if (in->configOptionVector[COMPRESS] == 1) {
- (void) HDfprintf(stderr, err13a, infile);
- HDfclose(strm);
- return (-1);
- }
+ case 8: /* OUTPUT-BYTE-ORDER */
+ if (in->configOptionVector[OUTPUT_B_ORDER] == 1) {
+ (void) HDfprintf(stderr, err11a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
- if (getCompressionType(in, strm) == -1) {
- (void) HDfprintf(stderr, err13b, infile);
- HDfclose(strm);
- return (-1);
- }
- in->configOptionVector[COMPRESS] = 1;
+ if (getOutputByteOrder(in, strm) == -1) {
+ (void) HDfprintf(stderr, err11b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ in->configOptionVector[OUTPUT_B_ORDER] = 1;
+ break;
- if (in->configOptionVector[COMPRESS_PARAM] == 0) {
- if (in->compressionType == 0)
- in->compressionParam = 6; /* default value if compressionType is GZIP */
- }
- break;
+ case 9: /* CHUNKED-DIMENSION-SIZES */
+ if (in->configOptionVector[CHUNK] == 1) {
+ (void) HDfprintf(stderr, err12a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ /* cant appear before dimension sizes have been provided */
+ if (in->configOptionVector[DIM] == 0) {
+ (void) HDfprintf(stderr, err12b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
- case 11: /* COMPRESSION-PARAM */
- if (in->configOptionVector[COMPRESS_PARAM] == 1) {
- (void) HDfprintf(stderr, err14a, infile);
- HDfclose(strm);
- return (-1);
- }
+ if (getChunkedDimensionSizes(in, strm) == -1) {
+ (void) HDfprintf(stderr, err12c, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ in->configOptionVector[CHUNK] = 1;
+ break;
- if (getCompressionParameter(in, strm) == -1) {
- (void) HDfprintf(stderr, err14b, infile);
- HDfclose(strm);
- return (-1);
- }
+ case 10: /* COMPRESSION-TYPE */
+ if (in->configOptionVector[COMPRESS] == 1) {
+ (void) HDfprintf(stderr, err13a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
- in->configOptionVector[COMPRESS_PARAM] = 1;
+ if (getCompressionType(in, strm) == -1) {
+ (void) HDfprintf(stderr, err13b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ in->configOptionVector[COMPRESS] = 1;
- if (in->configOptionVector[COMPRESS] == 0)
- in->compressionType = 0;
+ if (in->configOptionVector[COMPRESS_PARAM] == 0) {
+ if (in->compressionType == 0)
+ in->compressionParam = 6; /* default value if compressionType is GZIP */
+ }
+ break;
- break;
+ case 11: /* COMPRESSION-PARAM */
+ if (in->configOptionVector[COMPRESS_PARAM] == 1) {
+ (void) HDfprintf(stderr, err14a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
- case 12: /* EXTERNAL-STORAGE */
- if (in->configOptionVector[EXTERNALSTORE] == 1) {
- (void) HDfprintf(stderr, err15a, infile);
- HDfclose(strm);
- return (-1);
- }
+ if (getCompressionParameter(in, strm) == -1) {
+ (void) HDfprintf(stderr, err14b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
- if (getExternalFilename(in, strm) == -1) {
- (void) HDfprintf(stderr, err15b, infile);
- HDfclose(strm);
- return (-1);
- }
- in->configOptionVector[EXTERNALSTORE] = 1;
- break;
+ in->configOptionVector[COMPRESS_PARAM] = 1;
- case 13: /* MAXIMUM-DIMENSIONS */
- if (in->configOptionVector[EXTEND] == 1) {
- (void) HDfprintf(stderr, err16a, infile);
- HDfclose(strm);
- return (-1);
- }
- /* cant appear before dimension sizes have been provided */
- if (in->configOptionVector[DIM] == 0) {
- (void) HDfprintf(stderr, err16b, infile);
- HDfclose(strm);
- return (-1);
- }
- if (getMaximumDimensionSizes(in, strm) == -1) {
- (void) HDfprintf(stderr, err16c, infile);
- HDfclose(strm);
- return (-1);
- }
- in->configOptionVector[EXTEND] = 1;
- break;
+ if (in->configOptionVector[COMPRESS] == 0)
+ in->compressionType = 0;
- default:
- break;
+ break;
+
+ case 12: /* EXTERNAL-STORAGE */
+ if (in->configOptionVector[EXTERNALSTORE] == 1) {
+ (void) HDfprintf(stderr, err15a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+
+ if (getExternalFilename(in, strm) == -1) {
+ (void) HDfprintf(stderr, err15b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ in->configOptionVector[EXTERNALSTORE] = 1;
+ break;
+
+ case 13: /* MAXIMUM-DIMENSIONS */
+ if (in->configOptionVector[EXTEND] == 1) {
+ (void) HDfprintf(stderr, err16a, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ /* cant appear before dimension sizes have been provided */
+ if (in->configOptionVector[DIM] == 0) {
+ (void) HDfprintf(stderr, err16b, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ if (getMaximumDimensionSizes(in, strm) == -1) {
+ (void) HDfprintf(stderr, err16c, infile);
+ HDfclose(strm);
+ return (-1);
+ }
+ in->configOptionVector[EXTEND] = 1;
+ break;
+
+ default:
+ break;
+ }
+ scanret = fscanf(strm, "%s", key);
}
}
+
/*
- check if keywords obtained are valid
- if yes, return 0 else error
+ check if keywords obtained are valid
+ if yes, return 0 else error
*/
if (validateConfigurationParameters(in) == -1) {
@@ -1410,7 +2195,6 @@ static int processConfigurationFile(char *infile, struct Input *in)
HDfclose(strm);
return (-1);
}
-
HDfclose(strm);
return (0);
}
@@ -1491,7 +2275,7 @@ static int mapKeywordToIndex(char *key)
static int parsePathInfo(struct path_info *path, char *temp)
{
- const char delimiter[] = "/";
+ const char delimiter[] = "/\"";
char *token;
int i = 0;
const char *err1 = "Path string larger than MAX_PATH_NAME_LENGTH.\n";
@@ -1624,6 +2408,720 @@ static int getInputClass(struct Input *in, char * temp)
return (0);
}
+static int getInputClassType(struct Input *in, char * buffer)
+{
+ int kindex = -1;
+ const char *err1 = "Invalid value for input class.\n";
+ const char *err2 = "Invalid value for output architecture.\n";
+ const char *err3 = "Invalid value for output byte-order.\n";
+
+ if (!HDstrcmp(buffer, "H5T_STD_I8BE")) {
+ in->inputSize = 8;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I8LE")) {
+ in->inputSize = 8;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I16BE")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I16LE")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I32BE")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I32LE")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I64BE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_I64LE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U8BE")) {
+ in->inputSize = 8;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U8LE")) {
+ in->inputSize = 8;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U16BE")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U16LE")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U32BE")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U32LE")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U64BE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_U64LE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_SCHAR")) {
+ in->inputSize = 8;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_UCHAR")) {
+ in->inputSize = 8;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_SHORT")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_USHORT")) {
+ in->inputSize = 16;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_INT")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_UINT")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_LONG")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_ULONG")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_LLONG")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 4;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_ULLONG")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 7;
+ }
+ else if (!HDstrcmp(buffer, "H5T_IEEE_F32BE")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_IEEE_F32LE")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_IEEE_F64BE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_IEEE_F64LE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_VAX_F32")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_VAX_F64")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_FLOAT")) {
+ in->inputSize = 32;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 3;
+ }
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_DOUBLE")) {
+ in->inputSize = 64;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 3;
+ }
+#if H5_SIZEOF_LONG_DOUBLE !=0
+ else if (!HDstrcmp(buffer, "H5T_NATIVE_LDOUBLE")) {
+ in->inputSize = H5_SIZEOF_LONG_DOUBLE;
+ in->configOptionVector[INPUT_SIZE] = 1;
+
+ if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ kindex = 3;
+ }
+#endif
+ else if(!HDstrcmp(buffer, "H5T_TIME: not yet implemented")) {
+ kindex = -1;
+ }
+ else if(!HDstrcmp(buffer, "H5T_STRING")) {
+ kindex = 5;
+ }
+ /* case H5T_BITFIELD: */
+ else if (!HDstrcmp(buffer, "H5T_STD_B8BE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B8LE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B16BE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B16LE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B32BE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B32LE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B64BE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ else if (!HDstrcmp(buffer, "H5T_STD_B64LE")) {
+
+ if ((kindex = OutputArchStrToInt("STD")) == -1) {
+ (void) HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->outputArchitecture = kindex;
+
+ if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
+ (void) HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ in->outputByteOrder = kindex;
+
+ kindex = -1;
+ }
+ /* case H5T_OPAQUE: */
+ else if(!HDstrcmp(buffer, "H5T_OPAQUE")) {
+ kindex = -1;
+ }
+ /* case H5T_COMPOUND: */
+ else if(!HDstrcmp(buffer, "H5T_COMPOUND")) {
+ kindex = -1;
+ }
+ /* case H5T_REFERENCE: */
+ else if(!HDstrcmp(buffer, "H5T_REFERENCE")) {
+ kindex = -1;
+ }
+ /* case H5T_ENUM: */
+ else if(!HDstrcmp(buffer, "H5T_ENUM")) {
+ kindex = -1;
+ }
+ /* case H5T_VLEN: */
+ else if(!HDstrcmp(buffer, "H5T_VLEN")) {
+ kindex = -1;
+ }
+ /* case H5T_ARRAY: */
+ else if(!HDstrcmp(buffer, "H5T_ARRAY")) {
+ kindex = -1;
+ }
+
+ if (kindex == -1) {
+ (void) HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+
+ /*set default value for output-size */
+ if (in->configOptionVector[OUTPUT_SIZE] == 0)
+ in->outputSize = in->inputSize;
+#ifdef H5DEBUGIMPORT
+ printf("h5dump DATATYPE STRING %d inputSize\n", in->inputSize);
+ printf("h5dump DATATYPE STRING %d outputSize\n", in->outputSize);
+#endif
+
+ in->inputClass = kindex;
+ return (0);
+}
+
static int InputClassStrToInt(char *temp)
{
int i;
@@ -1910,6 +3408,7 @@ void setDefaultValues(struct Input *in, int count)
char temp[255];
char num[255];
+ in->h5dumpInput = 0;
in->inputClass = 3; /* FP */
in->inputSize = 32;
in->outputClass = 1; /* FP */
@@ -2348,6 +3847,9 @@ static int process(struct Options *opt)
/*create data type */
intype = createInputDataType(in);
outtype = createOutputDataType(in);
+#ifdef H5DEBUGIMPORT
+ printf("process intype %d outtype %d\n", intype, outtype);
+#endif
/* create property list */
proplist = H5Pcreate(H5P_DATASET_CREATE);
@@ -2498,7 +4000,7 @@ void help(char *name)
(void) HDfprintf(stdout,
"\t The user can specify output type and storage properties in \n");
(void) HDfprintf(stdout,
- "\t the configuration file. The user is requited to specify the \n");
+ "\t the configuration file. The user is required to specify the \n");
(void) HDfprintf(stdout,
"\t path of the dataset. If the groups in the path leading to \n");
(void) HDfprintf(stdout,
@@ -2511,7 +4013,7 @@ void help(char *name)
(void) HDfprintf(stdout,
"\t provide the class and size of output data to be written to \n");
(void) HDfprintf(stdout,
- "\t the dataset and may optionally specify the output-architecure,\n");
+ "\t the dataset and may optionally specify the output-architecture,\n");
(void) HDfprintf(stdout,
"\t and the output-byte-order. If output-architecture is not \n");
(void) HDfprintf(stdout,
@@ -2596,7 +4098,11 @@ void help(char *name)
(void) HDfprintf(stdout,
"\t The configuration file is an ASCII text file and must be \n");
(void) HDfprintf(stdout,
- "\t organized as \"CONFIG-KEYWORD VALUE\" pairs, one pair on each \n");
+ "\t the ddl formatted file (without data values) produced by h5dump \n");
+ (void) HDfprintf(stdout,
+ "\t when used with the options '-o outfilename -b' of a single dataset (-d) \n");
+ (void) HDfprintf(stdout,
+ "\t OR organized as \"CONFIG-KEYWORD VALUE\" pairs, one pair on each \n");
(void) HDfprintf(stdout, "\t line.\n\n");
(void) HDfprintf(stdout,
"\t The configuration file may have the following keywords each \n");
@@ -2612,7 +4118,7 @@ void help(char *name)
(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 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");
@@ -2622,7 +4128,7 @@ void help(char *name)
(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");
+ "\t the path do not exist, they will be created. \n");
(void) HDfprintf(stdout, "\t For example,\n");
(void) HDfprintf(stdout, "\t PATH grp1/grp2/dataset1\n");
(void) HDfprintf(stdout, "\t PATH: keyword\n");
diff --git a/tools/h5import/h5import.h b/tools/h5import/h5import.h
index dbc6844..c686624 100644
--- a/tools/h5import/h5import.h
+++ b/tools/h5import/h5import.h
@@ -44,20 +44,20 @@
#define MAX_NUM_DIMENSION 32
#define BASE_10 10
-#define CHUNK 0
-#define COMPRESS 1
-#define EXTEND 2
-#define EXTERNALSTORE 3
+#define PATH 0
+#define INPUT_CLASS 1
+#define INPUT_SIZE 2
+#define RANK 3
#define DIM 4
-#define RANK 5
-#define PATH 6
-#define INPUT_CLASS 7
-#define INPUT_SIZE 8
-#define OUTPUT_CLASS 9
-#define OUTPUT_SIZE 10
-#define OUTPUT_ARCH 11
-#define OUTPUT_B_ORDER 12
-#define COMPRESS_PARAM 13
+#define OUTPUT_CLASS 5
+#define OUTPUT_SIZE 6
+#define OUTPUT_ARCH 7
+#define OUTPUT_B_ORDER 8
+#define CHUNK 9
+#define COMPRESS 10
+#define COMPRESS_PARAM 11
+#define EXTERNALSTORE 12
+#define EXTEND 13
/* data types */
#define H5DT_INT8 signed char
@@ -80,6 +80,7 @@ struct path_info
struct Input
{
+ int h5dumpInput;
struct path_info path;
int inputClass;
int inputSize;
@@ -198,6 +199,7 @@ static int parsePathInfo(struct path_info *path, char *strm);
static int parseDimensions(struct Input *in, char *strm);
static int getInputSize(struct Input *in, int ival);
static int getInputClass(struct Input *in, char * strm);
+static int getInputClassType(struct Input *in, char * strm);
static int InputClassStrToInt(char *temp);
static int getRank(struct Input *in, FILE *strm);
static int getDimensionSizes(struct Input *in, FILE *strm);
@@ -225,6 +227,7 @@ static int readUIntegerData(FILE *strm, struct Input *in);
static int allocateUIntegerStorage(struct Input *in);
static int validateConfigurationParameters(struct Input *in);
static int processStrData(FILE *strm, struct Input *in, hid_t file_id);
+static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id);
#endif /* H5IMPORT_H__ */
diff --git a/tools/h5import/h5importtestutil.sh b/tools/h5import/h5importtestutil.sh
index d5e9561..4831f71 100755
--- a/tools/h5import/h5importtestutil.sh
+++ b/tools/h5import/h5importtestutil.sh
@@ -16,6 +16,9 @@
# HDF Utilities Test script
# Usage: h5importtestutil.sh [machine-type]
+# Determine which filters are available
+USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+
TESTNAME=h5import
EXIT_SUCCESS=0
EXIT_FAILURE=1
@@ -104,6 +107,14 @@ $SRC_H5IMPORT_TESTFILES/txtin16.txt
$SRC_H5IMPORT_TESTFILES/txtin32.txt
$SRC_H5IMPORT_TESTFILES/textpfe64.txt
$SRC_H5IMPORT_TESTFILES/txtstr.txt
+$SRC_H5IMPORT_TESTFILES/dbinfp64.h5.txt
+$SRC_H5IMPORT_TESTFILES/dbinin8.h5.txt
+$SRC_H5IMPORT_TESTFILES/dbinin8w.h5.txt
+$SRC_H5IMPORT_TESTFILES/dbinin16.h5.txt
+$SRC_H5IMPORT_TESTFILES/dbinin32.h5.txt
+$SRC_H5IMPORT_TESTFILES/dbinuin16.h5.txt
+$SRC_H5IMPORT_TESTFILES/dbinuin32.h5.txt
+$SRC_H5IMPORT_TESTFILES/dtxtstr.h5.txt
"
#
@@ -144,6 +155,12 @@ TESTING() {
echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
}
+# Print a "SKIP" message
+SKIP() {
+ TESTING $TESTNAME $@
+ echo " -SKIP-"
+}
+
TOOLTEST()
{
err=0
@@ -164,6 +181,69 @@ else
fi
}
+# Use h5dump output as input to h5import for binary numbers
+# Use h5diff to verify results
+TOOLTEST2()
+{
+err=0
+$RUNSERIAL ../h5dump/h5dump -p -d $1 -o d$2.bin -b tmp_testfiles/$2 > d$2.dmp
+$RUNSERIAL ./h5import d$2.bin -c d$2.dmp -o d$2 > d$2.imp
+$RUNSERIAL ../h5diff/h5diff -v d$2 tmp_testfiles/$2 $1 $1 > log2
+$CP -f $SRC_H5IMPORT_TESTFILES/d$2.txt log1
+
+cmp -s log1 log2 || err=1
+rm -f log1 log2
+if [ $err -eq 1 ]; then
+nerrors="` expr $nerrors + 1 `";
+ echo "*FAILED*"
+else
+ echo " PASSED"
+fi
+}
+
+# Same as TOOLTEST2 except for strings
+# Use h5dump output as input to h5import for strings
+# Use h5diff to verify results
+TOOLTEST3()
+{
+err=0
+$RUNSERIAL ../h5dump/h5dump -p -d $1 -o d$2.bin -y --width=1 tmp_testfiles/$2 > d$2.dmp
+$RUNSERIAL ./h5import d$2.bin -c d$2.dmp -o d$2 > d$2.imp
+$RUNSERIAL ../h5diff/h5diff -v d$2 tmp_testfiles/$2 $1 $1 > log2
+$CP -f $SRC_H5IMPORT_TESTFILES/d$2.txt log1
+
+cmp -s log1 log2 || err=1
+rm -f log1 log2
+if [ $err -eq 1 ]; then
+nerrors="` expr $nerrors + 1 `";
+ echo "*FAILED*"
+else
+ echo " PASSED"
+fi
+}
+
+# Same as TOOLTEST3 except for h5diff uses report mode without warnings
+# Use h5dump output as input to h5import for strings
+# Use h5diff to verify results
+TOOLTEST4()
+{
+err=0
+$RUNSERIAL ../h5dump/h5dump -p -d $1 -o d$2.bin -y --width=1 tmp_testfiles/$2 > d$2.dmp
+$RUNSERIAL ./h5import d$2.bin -c d$2.dmp -o d$2 > d$2.imp
+$RUNSERIAL ../h5diff/h5diff -r d$2 tmp_testfiles/$2 $1 $1 > log2
+$CP -f $SRC_H5IMPORT_TESTFILES/d$2.txt log1
+
+
+cmp -s log1 log2 || err=1
+rm -f log1 log2
+if [ $err -eq 1 ]; then
+nerrors="` expr $nerrors + 1 `";
+ echo "*FAILED*"
+else
+ echo " PASSED"
+fi
+}
+
echo ""
echo "=============================="
echo "H5IMPORT tests started"
@@ -209,39 +289,64 @@ TOOLTEST $TESTDIR/txtfp32.txt -c $TESTDIR/txtfp32.conf -o txtfp32.h5
TESTING "ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed "
TOOLTEST $TESTDIR/txtfp64.txt -c $TESTDIR/txtfp64.conf -o txtfp64.h5
+
TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed "
TOOLTEST binfp64.bin -c $TESTDIR/binfp64.conf -o binfp64.h5
+TESTING "H5DUMP-BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed "
+if test $USE_FILTER_DEFLATE != "yes"; then
+ SKIP "/fp/bin/64-bit" binfp64.h5
+else
+ TOOLTEST2 "/fp/bin/64-bit" binfp64.h5
+fi
TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed "
-TOOLTEST binin8.bin -c $TESTDIR/binin8.conf -o binin8.h5
+TOOLTEST binin8.bin -c $TESTDIR/binin8.conf -o binin8.h5
+TESTING "H5DUMP-BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed "
+if test $USE_FILTER_DEFLATE != "yes"; then
+ SKIP "/int/bin/8-bit" binin8.h5
+else
+ TOOLTEST2 "/int/bin/8-bit" binin8.h5
+fi
TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended "
TOOLTEST binin16.bin -c $TESTDIR/binin16.conf -o binin16.h5
+TESTING "H5DUMP-BINARY I16 - rank 3 - Output order LE + CHUNKED + extended "
+TOOLTEST2 "/int/bin/16-bit" binin16.h5
TESTING "BINARY I32 - rank 3 - Output BE + CHUNKED "
TOOLTEST binin32.bin -c $TESTDIR/binin32.conf -o binin32.h5
+TESTING "H5DUMP-BINARY I32 - rank 3 - Output BE + CHUNKED "
+TOOLTEST2 "/int/bin/32-bit" binin32.h5
TESTING "BINARY UI16 - rank 3 - Output byte BE + CHUNKED "
TOOLTEST binuin16.bin -c $TESTDIR/binuin16.conf -o binuin16.h5
+TESTING "H5DUMP-BINARY UI16 - rank 3 - Output byte BE + CHUNKED "
+TOOLTEST2 "/int/buin/16-bit" binuin16.h5
TESTING "BINARY UI32 - rank 3 - Output LE + CHUNKED "
TOOLTEST binuin32.bin -c $TESTDIR/binuin32.conf -o binuin32.h5
+TESTING "H5DUMP-BINARY UI32 - rank 3 - Output LE + CHUNKED "
+TOOLTEST2 "/int/buin/32-bit" binuin32.h5
TESTING "STR"
TOOLTEST $TESTDIR/txtstr.txt -c $TESTDIR/txtstr.conf -o txtstr.h5
+TESTING "H5DUMP-STR"
+TOOLTEST43 "/mytext/data" txtstr.h5
TESTING "BINARY I8 CR LF EOF"
TOOLTEST binin8w.bin -c $TESTDIR/binin8w.conf -o binin8w.h5
+TESTING "H5DUMP-BINARY I8 CR LF EOF"
+TOOLTEST2 "/dataset0" binin8w.h5
TESTING "ASCII F64 - rank 1 - INPUT-CLASS TEXTFPE "
TOOLTEST $TESTDIR/textpfe64.txt -c $TESTDIR/textpfe.conf -o textpfe.h5
-rm -f txtin32.txt txtin16.txt txtin8.txt txtuin32.txt txtuin16.txt *.bin *.h5
+rm -f txtin32.txt txtin16.txt txtin8.txt txtuin32.txt txtuin16.txt *.bin *.dmp *.imp *.h5
rm -rf tmp_testfiles
else
echo "** h5import or h5importtest not available ***"
diff --git a/tools/h5import/testfiles/dbinfp64.h5.txt b/tools/h5import/testfiles/dbinfp64.h5.txt
new file mode 100644
index 0000000..fb88984
--- /dev/null
+++ b/tools/h5import/testfiles/dbinfp64.h5.txt
@@ -0,0 +1,2 @@
+dataset: </fp/bin/64-bit> and </fp/bin/64-bit>
+0 differences found
diff --git a/tools/h5import/testfiles/dbinin16.h5.txt b/tools/h5import/testfiles/dbinin16.h5.txt
new file mode 100644
index 0000000..b94781e
--- /dev/null
+++ b/tools/h5import/testfiles/dbinin16.h5.txt
@@ -0,0 +1,2 @@
+dataset: </int/bin/16-bit> and </int/bin/16-bit>
+0 differences found
diff --git a/tools/h5import/testfiles/dbinin32.h5.txt b/tools/h5import/testfiles/dbinin32.h5.txt
new file mode 100644
index 0000000..a35cd79
--- /dev/null
+++ b/tools/h5import/testfiles/dbinin32.h5.txt
@@ -0,0 +1,2 @@
+dataset: </int/bin/32-bit> and </int/bin/32-bit>
+0 differences found
diff --git a/tools/h5import/testfiles/dbinin8.h5.txt b/tools/h5import/testfiles/dbinin8.h5.txt
new file mode 100644
index 0000000..bbc6c67
--- /dev/null
+++ b/tools/h5import/testfiles/dbinin8.h5.txt
@@ -0,0 +1,2 @@
+dataset: </int/bin/8-bit> and </int/bin/8-bit>
+0 differences found
diff --git a/tools/h5import/testfiles/dbinin8w.h5.txt b/tools/h5import/testfiles/dbinin8w.h5.txt
new file mode 100644
index 0000000..28d43d2
--- /dev/null
+++ b/tools/h5import/testfiles/dbinin8w.h5.txt
@@ -0,0 +1,2 @@
+dataset: </dataset0> and </dataset0>
+0 differences found
diff --git a/tools/h5import/testfiles/dbinuin16.h5.txt b/tools/h5import/testfiles/dbinuin16.h5.txt
new file mode 100644
index 0000000..ecad7a0
--- /dev/null
+++ b/tools/h5import/testfiles/dbinuin16.h5.txt
@@ -0,0 +1,2 @@
+dataset: </int/buin/16-bit> and </int/buin/16-bit>
+0 differences found
diff --git a/tools/h5import/testfiles/dbinuin32.h5.txt b/tools/h5import/testfiles/dbinuin32.h5.txt
new file mode 100644
index 0000000..cc1d9f3
--- /dev/null
+++ b/tools/h5import/testfiles/dbinuin32.h5.txt
@@ -0,0 +1,2 @@
+dataset: </int/buin/32-bit> and </int/buin/32-bit>
+0 differences found
diff --git a/tools/h5import/testfiles/dtxtstr.h5.txt b/tools/h5import/testfiles/dtxtstr.h5.txt
new file mode 100644
index 0000000..2170300
--- /dev/null
+++ b/tools/h5import/testfiles/dtxtstr.h5.txt
@@ -0,0 +1,2 @@
+dataset: </mytext/data> and </mytext/data>
+0 differences found
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index f308a99..dd72284 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -1064,37 +1064,6 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
}
/*-------------------------------------------------------------------------
- * Function: do_bin_output
- *
- * Purpose: Dump memory buffer to a binary file stream
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *-------------------------------------------------------------------------
- */
-int
-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;
- size_t size; /* datum size */
- hsize_t i; /* element counter */
-
- if((size = H5Tget_size(tid)) == 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
-
- for (i = 0; i < nelmts; i++) {
- if (render_bin_output(stream, container, tid, mem + i * size) < 0) {
- HDfprintf(err_stream,"\nError in writing binary stream\n");
- return FAIL;
- }
- }
-
-CATCH
- return ret_value;
-}
-
-/*-------------------------------------------------------------------------
* Function: render_bin_output
*
* Purpose: Write one element of memory buffer to a binary file stream
@@ -1104,369 +1073,182 @@ CATCH
*-------------------------------------------------------------------------
*/
int
-render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem)
+render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts)
{
HERR_INIT(int, SUCCEED)
unsigned char *mem = (unsigned char*)_mem;
size_t size; /* datum size */
- float tempfloat;
- double tempdouble;
- unsigned long long tempullong;
- long long templlong;
- unsigned long tempulong;
- long templong;
- unsigned int tempuint;
- int tempint;
- unsigned short tempushort;
- short tempshort;
- unsigned char tempuchar;
- char tempschar;
-#if H5_SIZEOF_LONG_DOUBLE !=0
- long double templdouble;
-#endif
-#ifdef DEBUG_H5DUMP_BIN
- static char fmt_llong[8], fmt_ullong[8];
- if (!fmt_llong[0]) {
- HDsprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH);
- HDsprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH);
- }
-#endif
+ hsize_t block_index;
+ H5T_class_t type_class;
if((size = H5Tget_size(tid)) == 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
- if (H5Tequal(tid, H5T_NATIVE_FLOAT)) {
- HDmemcpy(&tempfloat, mem, sizeof(float));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%g ", tempfloat);
-#else
- if (1 != HDfwrite(&tempfloat, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else if (H5Tequal(tid, H5T_NATIVE_DOUBLE)) {
- HDmemcpy(&tempdouble, mem, sizeof(double));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%g ", tempdouble);
-#else
- if (1 != HDfwrite(&tempdouble, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
-#if H5_SIZEOF_LONG_DOUBLE !=0
- else if (H5Tequal(tid, H5T_NATIVE_LDOUBLE)) {
- HDmemcpy(&templdouble, mem, sizeof(long double));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%Lf ", templdouble);
-#else
- if (1 != HDfwrite(&templdouble, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
-#endif
- else if (H5T_STRING == H5Tget_class(tid)) {
- unsigned int i;
- H5T_str_t pad;
- char *s;
-
- pad = H5Tget_strpad(tid);
-
- if (H5Tis_variable_str(tid)) {
- s = *(char**) mem;
- if (s != NULL)
- size = HDstrlen(s);
- }
- else {
- s = (char *) mem;
- if((size = H5Tget_size(tid)) == 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
- }
- for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
- HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%d", tempuchar);
-#else
- if (1 != HDfwrite(&tempuchar, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- } /* i */
- }
- else if (H5Tequal(tid, H5T_NATIVE_INT)) {
- HDmemcpy(&tempint, mem, sizeof(int));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%d ", tempint);
-#else
- if (1 != HDfwrite(&tempint, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else if (H5Tequal(tid, H5T_NATIVE_UINT)) {
- HDmemcpy(&tempuint, mem, sizeof(unsigned int));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%u ", tempuint);
-#else
- if (1 != HDfwrite(&tempuint, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else if (H5Tequal(tid, H5T_NATIVE_SCHAR)) {
- HDmemcpy(&tempschar, mem, sizeof(char));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%d ", tempschar);
-#else
- if (1 != HDfwrite(&tempschar, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else if (H5Tequal(tid, H5T_NATIVE_UCHAR)) {
- HDmemcpy(&tempuchar, mem, sizeof(unsigned char));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%u ", tempuchar);
-#else
- if (1 != HDfwrite(&tempuchar, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else if (H5Tequal(tid, H5T_NATIVE_SHORT)) {
- HDmemcpy(&tempshort, mem, sizeof(short));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%d ", tempshort);
-#else
- if (1 != HDfwrite(&tempshort, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else if (H5Tequal(tid, H5T_NATIVE_USHORT)) {
- HDmemcpy(&tempushort, mem, sizeof(unsigned short));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%u ", tempushort);
-#else
- if (1 != HDfwrite(&tempushort, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else if (H5Tequal(tid, H5T_NATIVE_LONG)) {
- HDmemcpy(&templong, mem, sizeof(long));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%ld ", templong);
-#else
- if (1 != HDfwrite(&templong, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else if (H5Tequal(tid, H5T_NATIVE_ULONG)) {
- HDmemcpy(&tempulong, mem, sizeof(unsigned long));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%lu ", tempulong);
-#else
- if (1 != HDfwrite(&tempulong, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else if (H5Tequal(tid, H5T_NATIVE_LLONG)) {
- HDmemcpy(&templlong, mem, sizeof(long long));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, fmt_llong, templlong);
-#else
- if (1 != HDfwrite(&templlong, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else if (H5Tequal(tid, H5T_NATIVE_ULLONG)) {
- HDmemcpy(&tempullong, mem, sizeof(unsigned long long));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, fmt_ullong, tempullong);
-#else
- if (1 != HDfwrite(&tempullong, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else if (H5Tequal(tid, H5T_NATIVE_HSSIZE)) {
- if (sizeof(hssize_t) == sizeof(int)) {
- HDmemcpy(&tempint, mem, sizeof(int));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%d ", tempint);
-#else
- if (1 != HDfwrite(&tempint, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else if (sizeof(hssize_t) == sizeof(long)) {
- HDmemcpy(&templong, mem, sizeof(long));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%ld ", templong);
-#else
- if (1 != HDfwrite(&templong, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else {
- HDmemcpy(&templlong, mem, sizeof(long long));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, fmt_llong, templlong);
-#else
- if (1 != HDfwrite(&templlong, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- }
- else if (H5Tequal(tid, H5T_NATIVE_HSIZE)) {
- if (sizeof(hsize_t) == sizeof(int)) {
- HDmemcpy(&tempuint, mem, sizeof(unsigned int));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%u ", tempuint);
-#else
- if (1 != HDfwrite(&tempuint, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else if (sizeof(hsize_t) == sizeof(long)) {
- HDmemcpy(&tempulong, mem, sizeof(unsigned long));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%lu ", tempulong);
-#else
- if (1 != HDfwrite(&tempulong, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else {
- HDmemcpy(&tempullong, mem, sizeof(unsigned long long));
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, fmt_ullong, tempullong);
-#else
- if (1 != HDfwrite(&tempullong, size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- }
- else if (H5Tget_class(tid) == H5T_COMPOUND) {
- unsigned j;
- hid_t memb;
- unsigned nmembs;
- size_t offset;
+ if((type_class = H5Tget_class(tid)) < 0)
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed");
- nmembs = H5Tget_nmembers(tid);
+ switch (type_class) {
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_ENUM:
+ block_index = block_nelmts * size;
+ while(block_index > 0) {
+ size_t bytes_in = 0; /* # of bytes to write */
+ size_t bytes_wrote = 0; /* # of bytes written */
+ size_t item_size = size; /* size of items in bytes */
- for (j = 0; j < nmembs; j++) {
- offset = H5Tget_member_offset(tid, j);
- memb = H5Tget_member_type(tid, j);
+ if(block_index > sizeof(size_t))
+ bytes_in = sizeof(size_t);
+ else
+ bytes_in = (size_t)block_index;
- if (render_bin_output(stream, container, memb, mem + offset) < 0)
- return FAIL;
+ bytes_wrote = HDfwrite(mem, 1, bytes_in, stream);
- H5Tclose(memb);
- }
- }
- else if (H5Tget_class(tid) == H5T_ENUM) {
- unsigned int i;
- if (1 == size) {
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "0x%02x", mem[0]);
-#else
- if (1 != HDfwrite(&mem[0], size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else {
- for (i = 0; i < size; i++) {
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%s%02x", i?":":"", mem[i]);
-#else
- if (1 != HDfwrite(&mem[i], sizeof(char), 1, stream))
+ if(bytes_wrote != bytes_in || (0 == bytes_wrote && HDferror(stream)))
H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- } /*i*/
- }/*else 1 */
- }
- else if (H5Tget_class(tid) == H5T_ARRAY) {
- int k, ndims;
- hsize_t i, dims[H5S_MAX_RANK], temp_nelmts, nelmts;
- hid_t memb;
-
- /* get the array's base datatype for each element */
- memb = H5Tget_super(tid);
- size = H5Tget_size(memb);
- ndims = H5Tget_array_ndims(tid);
- H5Tget_array_dims2(tid, dims);
- HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK);
-
- /* calculate the number of array elements */
- for (k = 0, nelmts = 1; k < ndims; k++) {
- temp_nelmts = nelmts;
- temp_nelmts *= dims[k];
- nelmts = (size_t) temp_nelmts;
- }
-
- /* dump the array element */
- for (i = 0; i < nelmts; i++) {
- if (render_bin_output(stream, container, memb, mem + i * size) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
- }
- H5Tclose(memb);
- }
- else if (H5Tget_class(tid) == H5T_VLEN) {
- unsigned int i;
- hsize_t nelmts;
- hid_t memb;
-
- /* get the VL sequences's base datatype for each element */
- memb = H5Tget_super(tid);
- size = H5Tget_size(memb);
-
- /* Get the number of sequence elements */
- nelmts = ((hvl_t *) mem)->len;
-
- for (i = 0; i < nelmts; i++) {
- /* dump the array element */
- if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)) + i * size) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
- }
- H5Tclose(memb);
- }
- else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
- if (region_output) {
- /* region data */
- hid_t region_id, region_space;
- H5S_sel_type region_type;
-
- region_id = H5Rdereference(container, H5R_DATASET_REGION, mem);
- if (region_id >= 0) {
- region_space = H5Rget_region(container, H5R_DATASET_REGION, mem);
- if (region_space >= 0) {
- region_type = H5Sget_select_type(region_space);
- if(region_type == H5S_SEL_POINTS)
- render_bin_output_region_points(region_space, region_id, stream, container);
- else
- render_bin_output_region_blocks(region_space, region_id, stream, container);
- H5Sclose(region_space);
- } /* end if (region_space >= 0) */
- H5Dclose(region_id);
- } /* end if (region_id >= 0) */
- } /* end if (region_output... */
- }
- else if (H5Tequal(tid, H5T_STD_REF_OBJ)) {
- }
- else {
- size_t i;
- if (1 == size) {
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "0x%02x", mem[0]);
-#else
- if (1 != HDfwrite(&mem[0], size, 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- }
- else {
- for (i = 0; i < size; i++) {
-#ifdef DEBUG_H5DUMP_BIN
- HDfprintf(stream, "%s%02x", i?":":"", mem[i]);
-#else
- if (1 != HDfwrite(&mem[i], sizeof(char), 1, stream))
+ block_index -= (hsize_t)bytes_wrote;
+ mem = mem + bytes_wrote;
+ }
+ break;
+ case H5T_STRING:
+ {
+ unsigned int i;
+ H5T_str_t pad;
+ char *s;
+ unsigned char tempuchar;
+
+ pad = H5Tget_strpad(tid);
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+
+ if (H5Tis_variable_str(tid)) {
+ s = *(char**) mem;
+ if (s != NULL)
+ size = HDstrlen(s);
+ }
+ else {
+ s = (char *) mem;
+ }
+ for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
+ HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char));
+ if (1 != HDfwrite(&tempuchar, size, 1, stream))
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
+ } /* i */
+ } /* for (block_index = 0; block_index < block_nelmts; block_index++) */
+ }
+ break;
+ case H5T_COMPOUND:
+ {
+ unsigned j;
+ hid_t memb;
+ unsigned nmembs;
+ size_t offset;
+
+ nmembs = H5Tget_nmembers(tid);
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+ for (j = 0; j < nmembs; j++) {
+ offset = H5Tget_member_offset(tid, j);
+ memb = H5Tget_member_type(tid, j);
+
+ if (render_bin_output(stream, container, memb, mem + offset, 1) < 0)
+ return FAIL;
+
+ H5Tclose(memb);
+ }
+ }
+ }
+ break;
+ case H5T_ARRAY:
+ {
+ int k, ndims;
+ hsize_t i, dims[H5S_MAX_RANK], temp_nelmts, nelmts;
+ hid_t memb;
+
+ /* get the array's base datatype for each element */
+ memb = H5Tget_super(tid);
+ ndims = H5Tget_array_ndims(tid);
+ H5Tget_array_dims2(tid, dims);
+ HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK);
+
+ /* calculate the number of array elements */
+ for (k = 0, nelmts = 1; k < ndims; k++) {
+ temp_nelmts = nelmts;
+ temp_nelmts *= dims[k];
+ nelmts = (size_t) temp_nelmts;
+ }
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+ /* dump the array element */
+ if (render_bin_output(stream, container, memb, mem, nelmts) < 0)
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
+ }
+ H5Tclose(memb);
+ }
+ break;
+ case H5T_VLEN:
+ {
+ unsigned int i;
+ hsize_t nelmts;
+ hid_t memb;
+
+ /* get the VL sequences's base datatype for each element */
+ memb = H5Tget_super(tid);
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+ /* Get the number of sequence elements */
+ nelmts = ((hvl_t *) mem)->len;
+
+ /* dump the array element */
+ if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0)
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
+ }
+ H5Tclose(memb);
+ }
+ break;
+ case H5T_REFERENCE:
+ {
+ if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
+ if (region_output) {
+ /* region data */
+ hid_t region_id, region_space;
+ H5S_sel_type region_type;
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+ region_id = H5Rdereference(container, H5R_DATASET_REGION, mem);
+ if (region_id >= 0) {
+ region_space = H5Rget_region(container, H5R_DATASET_REGION, mem);
+ if (region_space >= 0) {
+ region_type = H5Sget_select_type(region_space);
+ if(region_type == H5S_SEL_POINTS)
+ render_bin_output_region_points(region_space, region_id, stream, container);
+ else
+ render_bin_output_region_blocks(region_space, region_id, stream, container);
+ H5Sclose(region_space);
+ } /* end if (region_space >= 0) */
+ H5Dclose(region_id);
+ } /* end if (region_id >= 0) */
+ }
+ } /* end if (region_output... */
+ }
+ else if (H5Tequal(tid, H5T_STD_REF_OBJ)) {
+ ;
+ }
+ }
+ break;
+ default:
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+ if (size != HDfwrite(mem, sizeof(char), size, stream))
H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
-#endif
- } /*i*/
- }/*else 1 */
+ }
+ break;
}
CATCH
@@ -1552,12 +1334,8 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
- for (numindex = 0; numindex < numelem; numindex++) {
-
- render_bin_output(stream, container, type_id,
- ((char*)region_buf + numindex * type_size));
- /* Render the region data element end */
- } /* end for (jndx = 0; jndx < numelem; jndx++) */
+ render_bin_output(stream, container, type_id, (char*)region_buf, numelem);
+ /* Render the region data element end */
} /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
done:
@@ -1684,12 +1462,10 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
- for (jndx = 0; jndx < npoints; jndx++) {
- if(H5Sget_simple_extent_dims(region_space, dims1, NULL) < 0)
- HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ if(H5Sget_simple_extent_dims(region_space, dims1, NULL) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
- render_bin_output(stream, container, type_id, ((char*)region_buf + jndx * type_size));
- } /* end for (jndx = 0; jndx < npoints; jndx++) */
+ render_bin_output(stream, container, type_id, (char*)region_buf, npoints);
done:
HDfree(region_buf);
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 0f4b271..3e3a4cf 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -560,8 +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, 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(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t nelmts);
H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata);
H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 7ea6f38..7555f03 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -282,7 +282,9 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
/* binary dump */
if (bin_output) {
- do_bin_output(rawdatastream, rawoutstream, container, nelmts, type, _mem);
+ if (render_bin_output(rawdatastream, container, type, _mem, nelmts) < 0) {
+ HDfprintf(rawoutstream,"\nError in writing binary stream\n");
+ }
} /* end if */
else {
/* setup */
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index c069ecc..9ce3524 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -693,6 +693,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
unsigned nmembs;
static char fmt_llong[8], fmt_ullong[8];
H5T_str_t pad;
+ H5T_class_t type_class;
/*
* some tempvars to store the value before we append it to the string to
@@ -729,480 +730,494 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
}
}
- else if (H5Tequal(type, H5T_NATIVE_FLOAT)) {
- float tempfloat;
+ else {
+ if((type_class = H5Tget_class(type)) < 0)
+ return NULL;
+ switch (type_class) {
+ case H5T_FLOAT:
+ if (H5Tequal(type, H5T_NATIVE_FLOAT)) {
+ float tempfloat;
- HDmemcpy(&tempfloat, vp, sizeof(float));
- h5tools_str_append(str, OPT(info->fmt_float, "%g"), tempfloat);
- }
- else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
- double tempdouble;
+ HDmemcpy(&tempfloat, vp, sizeof(float));
+ h5tools_str_append(str, OPT(info->fmt_float, "%g"), tempfloat);
+ }
+ else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
+ double tempdouble;
- HDmemcpy(&tempdouble, vp, sizeof(double));
- h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble);
+ HDmemcpy(&tempdouble, vp, sizeof(double));
+ h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble);
#if H5_SIZEOF_LONG_DOUBLE !=0
- }
- else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) {
- long double templdouble;
+ }
+ else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) {
+ long double templdouble;
- HDmemcpy(&templdouble, vp, sizeof(long double));
- h5tools_str_append(str, "%Lf", templdouble);
+ HDmemcpy(&templdouble, vp, sizeof(long double));
+ h5tools_str_append(str, "%Lf", templdouble);
#endif
- }
- else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) ||
- H5Tequal(type, H5T_NATIVE_UCHAR))) {
- h5tools_print_char(str, info, (char) (*ucp_vp));
- }
- else if (H5T_STRING == H5Tget_class(type)) {
- unsigned int i;
- char quote = '\0';
- char *s;
-
- quote = '\0';
- if (H5Tis_variable_str(type)) {
- /* cp_vp is the pointer into the struct where a `char*' is stored. So we have
- * to dereference the pointer to get the `char*' to pass to HDstrlen(). */
- s = *(char**) cp_vp;
- if (s != NULL)
- size = HDstrlen(s);
- }
- else {
- s = cp_vp;
- size = H5Tget_size(type);
- }
- pad = H5Tget_strpad(type);
-
- /* Check for NULL pointer for string */
- if (s == NULL) {
- h5tools_str_append(str, "NULL");
- }
- else {
- for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
- int j = 1;
-
- /*
- * Count how many times the next character repeats. If the
- * threshold is zero then that means it can repeat any number
- * of times.
- */
- if (info->str_repeat > 0)
- while (i + j < size && s[i] == s[i + j])
- j++;
-
- /*
- * Print the opening quote. If the repeat count is high enough to
- * warrant printing the number of repeats instead of enumerating
- * the characters, then make sure the character to be repeated is
- * in it's own quote.
- */
- if (info->str_repeat > 0 && j > info->str_repeat) {
- if (quote)
- h5tools_str_append(str, "%c", quote);
-
- quote = '\'';
- h5tools_str_append(str, "%s%c", i ? " " : "", quote);
}
- else if (!quote) {
- quote = '"';
- h5tools_str_append(str, "%s%c", i ? " " : "", quote);
- }
-
- /* Print the character */
- h5tools_print_char(str, info, s[i]);
+ break;
+ case H5T_STRING:
+ {
+ unsigned int i;
+ char quote = '\0';
+ char *s;
- /* Print the repeat count */
- if (info->str_repeat && j > info->str_repeat) {
+ quote = '\0';
+ if (H5Tis_variable_str(type)) {
+ /* cp_vp is the pointer into the struct where a `char*' is stored. So we have
+ * to dereference the pointer to get the `char*' to pass to HDstrlen(). */
+ s = *(char**) cp_vp;
+ if (s != NULL) size = HDstrlen(s);
+ }
+ else {
+ s = cp_vp;
+ size = H5Tget_size(type);
+ }
+ pad = H5Tget_strpad(type);
+
+ /* Check for NULL pointer for string */
+ if (s == NULL) {
+ h5tools_str_append(str, "NULL");
+ }
+ else {
+ for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
+ int j = 1;
+
+ /*
+ * Count how many times the next character repeats. If the
+ * threshold is zero then that means it can repeat any number
+ * of times.
+ */
+ if (info->str_repeat > 0) while (i + j < size && s[i] == s[i + j])
+ j++;
+
+ /*
+ * Print the opening quote. If the repeat count is high enough to
+ * warrant printing the number of repeats instead of enumerating
+ * the characters, then make sure the character to be repeated is
+ * in it's own quote.
+ */
+ if (info->str_repeat > 0 && j > info->str_repeat) {
+ if (quote) h5tools_str_append(str, "%c", quote);
+
+ quote = '\'';
+ h5tools_str_append(str, "%s%c", i ? " " : "", quote);
+ }
+ else if (!quote) {
+ quote = '"';
+ h5tools_str_append(str, "%s%c", i ? " " : "", quote);
+ }
+
+ /* Print the character */
+ h5tools_print_char(str, info, s[i]);
+
+ /* Print the repeat count */
+ if (info->str_repeat && j > info->str_repeat) {
#ifdef REPEAT_VERBOSE
- h5tools_str_append(str, "%c repeats %d times", quote, j - 1);
+ h5tools_str_append(str, "%c repeats %d times", quote, j - 1);
#else
- h5tools_str_append(str, "%c*%d", quote, j - 1);
+ h5tools_str_append(str, "%c*%d", quote, j - 1);
#endif /* REPEAT_VERBOSE */
- quote = '\0';
- i += j - 1;
- }
+ quote = '\0';
+ i += j - 1;
+ }
- }
+ }
- if (quote)
- h5tools_str_append(str, "%c", quote);
+ if (quote) h5tools_str_append(str, "%c", quote);
- if (i == 0)
- /*empty string*/
- h5tools_str_append(str, "\"\"");
- } /* end else */
- }
- else if (H5Tequal(type, H5T_NATIVE_INT)) {
- HDmemcpy(&tempint, vp, sizeof(int));
- if(packed_bits_num) {
- if(packed_data_offset >= 8*sizeof(int))
- tempint = 0;
- else
- tempint = (tempint >> packed_data_offset) & packed_data_mask;
- }
- h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint);
- }
- else if (H5Tequal(type, H5T_NATIVE_UINT)) {
- HDmemcpy(&tempuint, vp, sizeof(unsigned int));
- if(packed_bits_num) {
- if(packed_data_offset >= 8*sizeof(unsigned int))
- tempuint = 0;
- else
- tempuint = (tempuint >> packed_data_offset) & packed_data_mask;
- }
- h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint);
- }
- else if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
- signed char tempchar;
- HDmemcpy(&tempchar, cp_vp, sizeof(char));
- if(packed_bits_num) {
- if(packed_data_offset >= 8*sizeof(char))
- tempchar = 0;
- else
- tempchar = (tempchar >> packed_data_offset) & packed_data_mask;
- }
+ if (i == 0)
+ /*empty string*/
+ h5tools_str_append(str, "\"\"");
+ } /* end else */
+ }
+ break;
+ case H5T_INTEGER:
+ if (H5Tequal(type, H5T_NATIVE_INT)) {
+ HDmemcpy(&tempint, vp, sizeof(int));
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(int))
+ tempint = 0;
+ else
+ tempint = (tempint >> packed_data_offset) & packed_data_mask;
+ }
+ h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint);
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UINT)) {
+ HDmemcpy(&tempuint, vp, sizeof(unsigned int));
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(unsigned int))
+ tempuint = 0;
+ else
+ tempuint = (tempuint >> packed_data_offset) & packed_data_mask;
+ }
+ h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint);
+ }
+ else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) || H5Tequal(type, H5T_NATIVE_UCHAR))) {
+ h5tools_print_char(str, info, (char) (*ucp_vp));
+ }
+ else if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
+ signed char tempchar;
+ HDmemcpy(&tempchar, cp_vp, sizeof(char));
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(char))
+ tempchar = 0;
+ else
+ tempchar = (tempchar >> packed_data_offset) & packed_data_mask;
+ }
#ifdef H5_VMS
- h5tools_str_append(str, OPT(info->fmt_schar, "%hd"), tempchar);
+ h5tools_str_append(str, OPT(info->fmt_schar, "%hd"), tempchar);
#else
- h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), tempchar);
+ h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), tempchar);
#endif
- }
- else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
- unsigned char tempuchar;
- HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char));
- if(packed_bits_num) {
- if(packed_data_offset >= 8*sizeof(unsigned char))
- tempuchar = 0;
- else
- tempuchar = (tempuchar >> packed_data_offset) & packed_data_mask;
- }
- h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), tempuchar);
- }
- else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
- short tempshort;
-
- HDmemcpy(&tempshort, vp, sizeof(short));
- if(packed_bits_num) {
- if(packed_data_offset >= 8*sizeof(short))
- tempshort = 0;
- else
- tempshort = (tempshort >> packed_data_offset) & packed_data_mask;
- }
- h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort);
- }
- else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
- unsigned short tempushort;
-
- HDmemcpy(&tempushort, vp, sizeof(unsigned short));
- if(packed_bits_num) {
- if(packed_data_offset >= 8*sizeof(unsigned short))
- tempushort = 0;
- else
- tempushort = (tempushort >> packed_data_offset) & packed_data_mask;
- }
- h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort);
- }
- else if (H5Tequal(type, H5T_NATIVE_LONG)) {
- HDmemcpy(&templong, vp, sizeof(long));
- if(packed_bits_num) {
- if(packed_data_offset >= 8*sizeof(long))
- templong = 0;
- else
- templong = (templong >> packed_data_offset) & packed_data_mask;
- }
- h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong);
- }
- else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
- HDmemcpy(&tempulong, vp, sizeof(unsigned long));
- if(packed_bits_num) {
- if(packed_data_offset >= 8*sizeof(unsigned long))
- tempulong = 0;
- else
- tempulong = (tempulong >> packed_data_offset) & packed_data_mask;
- }
- h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong);
- }
- else if (H5Tequal(type, H5T_NATIVE_LLONG)) {
- HDmemcpy(&templlong, vp, sizeof(long long));
- if(packed_bits_num) {
- if(packed_data_offset >= 8*sizeof(long long))
- templlong = 0;
- else
- templlong = (templlong >> packed_data_offset) & packed_data_mask;
- }
- h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong);
- }
- else if (H5Tequal(type, H5T_NATIVE_ULLONG)) {
- HDmemcpy(&tempullong, vp, sizeof(unsigned long long));
- if(packed_bits_num) {
- if(packed_data_offset >= 8*sizeof(unsigned long long))
- tempullong = 0;
- else
- tempullong = (tempullong >> packed_data_offset) & packed_data_mask;
- }
- h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong);
- }
- else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) {
- if (sizeof(hssize_t) == sizeof(int)) {
- HDmemcpy(&tempint, vp, sizeof(int));
- h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint);
- }
- else if (sizeof(hssize_t) == sizeof(long)) {
- HDmemcpy(&templong, vp, sizeof(long));
- h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong);
- }
- else {
- HDmemcpy(&templlong, vp, sizeof(long long));
- h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong);
- }
- }
- else if (H5Tequal(type, H5T_NATIVE_HSIZE)) {
- if (sizeof(hsize_t) == sizeof(int)) {
- HDmemcpy(&tempuint, vp, sizeof(unsigned int));
- h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint);
- }
- else if (sizeof(hsize_t) == sizeof(long)) {
- HDmemcpy(&tempulong, vp, sizeof(long));
- h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong);
- }
- else {
- HDmemcpy(&tempullong, vp, sizeof(unsigned long long));
- h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong);
- }
- }
- else if (H5Tget_class(type) == H5T_COMPOUND) {
- unsigned j;
-
- nmembs = H5Tget_nmembers(type);
- h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{"));
+ }
+ else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
+ unsigned char tempuchar;
+ HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char));
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(unsigned char))
+ tempuchar = 0;
+ else
+ tempuchar = (tempuchar >> packed_data_offset) & packed_data_mask;
+ }
+ h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), tempuchar);
+ }
+ else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
+ short tempshort;
+
+ HDmemcpy(&tempshort, vp, sizeof(short));
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(short))
+ tempshort = 0;
+ else
+ tempshort = (tempshort >> packed_data_offset) & packed_data_mask;
+ }
+ h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort);
+ }
+ else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
+ unsigned short tempushort;
+
+ HDmemcpy(&tempushort, vp, sizeof(unsigned short));
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(unsigned short))
+ tempushort = 0;
+ else
+ tempushort = (tempushort >> packed_data_offset) & packed_data_mask;
+ }
+ h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort);
+ }
+ else if (H5Tequal(type, H5T_NATIVE_LONG)) {
+ HDmemcpy(&templong, vp, sizeof(long));
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(long))
+ templong = 0;
+ else
+ templong = (templong >> packed_data_offset) & packed_data_mask;
+ }
+ h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong);
+ }
+ else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
+ HDmemcpy(&tempulong, vp, sizeof(unsigned long));
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(unsigned long))
+ tempulong = 0;
+ else
+ tempulong = (tempulong >> packed_data_offset) & packed_data_mask;
+ }
+ h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong);
+ }
+ else if (H5Tequal(type, H5T_NATIVE_LLONG)) {
+ HDmemcpy(&templlong, vp, sizeof(long long));
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(long long))
+ templlong = 0;
+ else
+ templlong = (templlong >> packed_data_offset) & packed_data_mask;
+ }
+ h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong);
+ }
+ else if (H5Tequal(type, H5T_NATIVE_ULLONG)) {
+ HDmemcpy(&tempullong, vp, sizeof(unsigned long long));
+ if (packed_bits_num) {
+ if (packed_data_offset >= 8 * sizeof(unsigned long long))
+ tempullong = 0;
+ else
+ tempullong = (tempullong >> packed_data_offset) & packed_data_mask;
+ }
+ h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong);
+ }
+ else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) {
+ if (sizeof(hssize_t) == sizeof(int)) {
+ HDmemcpy(&tempint, vp, sizeof(int));
+ h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint);
+ }
+ else if (sizeof(hssize_t) == sizeof(long)) {
+ HDmemcpy(&templong, vp, sizeof(long));
+ h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong);
+ }
+ else {
+ HDmemcpy(&templlong, vp, sizeof(long long));
+ h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong);
+ }
+ }
+ else if (H5Tequal(type, H5T_NATIVE_HSIZE)) {
+ if (sizeof(hsize_t) == sizeof(int)) {
+ HDmemcpy(&tempuint, vp, sizeof(unsigned int));
+ h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint);
+ }
+ else if (sizeof(hsize_t) == sizeof(long)) {
+ HDmemcpy(&tempulong, vp, sizeof(long));
+ h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong);
+ }
+ else {
+ HDmemcpy(&tempullong, vp, sizeof(unsigned long long));
+ h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong);
+ }
+ }
+ break;
+ case H5T_COMPOUND:
+ {
+ unsigned j;
- ctx->indent_level++;
+ nmembs = H5Tget_nmembers(type);
+ h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{"));
- for (j = 0; j < nmembs; j++) {
- if (j)
- h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK));
- else
- h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
+ ctx->indent_level++;
- if(info->arr_linebreak)
- h5tools_str_indent(str, info, ctx);
-
- /* The name */
- name = H5Tget_member_name(type, j);
- h5tools_str_append(str, OPT(info->cmpd_name, ""), name);
- HDfree(name);
+ for (j = 0; j < nmembs; j++) {
+ if (j)
+ h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK));
+ else
+ h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
- /* The value */
- offset = H5Tget_member_offset(type, j);
- memb = H5Tget_member_type(type, j);
+ if (info->arr_linebreak) h5tools_str_indent(str, info, ctx);
- h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx);
+ /* The name */
+ name = H5Tget_member_name(type, j);
+ h5tools_str_append(str, OPT(info->cmpd_name, ""), name);
+ HDfree(name);
- H5Tclose(memb);
- }
- ctx->indent_level--;
+ /* The value */
+ offset = H5Tget_member_offset(type, j);
+ memb = H5Tget_member_type(type, j);
+ h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx);
- if(info->arr_linebreak) {
- h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
- h5tools_str_indent(str, info, ctx);
- }
- h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}"));
+ H5Tclose(memb);
+ }
+ ctx->indent_level--;
- }
- else if (H5Tget_class(type) == H5T_ENUM) {
- char enum_name[1024];
+ if (info->arr_linebreak) {
+ h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
+ h5tools_str_indent(str, info, ctx);
+ }
+ h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}"));
- if (H5Tenum_nameof(type, vp, enum_name, sizeof enum_name) >= 0) {
- h5tools_str_append(str, h5tools_escape(enum_name, sizeof(enum_name)));
- }
- else {
- size_t i;
- n = H5Tget_size(type);
- if (1 == n) {
- h5tools_str_append(str, "0x%02x", ucp_vp[0]);
- }
- else {
- for (i = 0; i < n; i++)
- h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]);
- }
- }
- }
- else if (H5Tequal(type, H5T_STD_REF_DSETREG)) {
- if (h5tools_str_is_zero(vp, H5Tget_size(type))) {
- h5tools_str_append(str, "NULL");
- }
- else {
- h5tools_str_sprint_region(str, info, container, vp);
- }
- }
- else if (H5Tequal(type, H5T_STD_REF_OBJ)) {
- /*
- * Object references -- show the type and OID of the referenced
- * object.
- */
- if (h5tools_str_is_zero(vp, H5Tget_size(type))) {
- h5tools_str_append(str, "NULL");
- }
- else {
- H5O_info_t oi;
- const char *path;
-
- obj = H5Rdereference(container, H5R_OBJECT, vp);
- H5Oget_info(obj, &oi);
-
- /* Print object type and close object */
- switch (oi.type) {
- case H5O_TYPE_GROUP:
- h5tools_str_append(str, H5_TOOLS_GROUP);
- break;
-
- case H5O_TYPE_DATASET:
- h5tools_str_append(str, H5_TOOLS_DATASET);
+ }
break;
-
- case H5O_TYPE_NAMED_DATATYPE:
- h5tools_str_append(str, H5_TOOLS_DATATYPE);
+ case H5T_ENUM:
+ {
+ char enum_name[1024];
+
+ if (H5Tenum_nameof(type, vp, enum_name, sizeof enum_name) >= 0) {
+ h5tools_str_append(str, h5tools_escape(enum_name, sizeof(enum_name)));
+ }
+ else {
+ size_t i;
+ n = H5Tget_size(type);
+ if (1 == n) {
+ h5tools_str_append(str, "0x%02x", ucp_vp[0]);
+ }
+ else {
+ for (i = 0; i < n; i++)
+ h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]);
+ }
+ }
+ }
break;
-
- default:
- h5tools_str_append(str, "%u-", (unsigned) oi.type);
+ case H5T_REFERENCE:
+ if (H5Tequal(type, H5T_STD_REF_DSETREG)) {
+ if (h5tools_str_is_zero(vp, H5Tget_size(type))) {
+ h5tools_str_append(str, "NULL");
+ }
+ else {
+ h5tools_str_sprint_region(str, info, container, vp);
+ }
+ }
+ else if (H5Tequal(type, H5T_STD_REF_OBJ)) {
+ /*
+ * Object references -- show the type and OID of the referenced
+ * object.
+ */
+ if (h5tools_str_is_zero(vp, H5Tget_size(type))) {
+ h5tools_str_append(str, "NULL");
+ }
+ else {
+ H5O_info_t oi;
+ const char *path;
+
+ obj = H5Rdereference(container, H5R_OBJECT, vp);
+ H5Oget_info(obj, &oi);
+
+ /* Print object type and close object */
+ switch (oi.type) {
+ case H5O_TYPE_GROUP:
+ h5tools_str_append(str, H5_TOOLS_GROUP);
+ break;
+
+ case H5O_TYPE_DATASET:
+ h5tools_str_append(str, H5_TOOLS_DATASET);
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ h5tools_str_append(str, H5_TOOLS_DATATYPE);
+ break;
+
+ default:
+ h5tools_str_append(str, "%u-", (unsigned) oi.type);
+ break;
+ } /* end switch */
+ H5Oclose(obj);
+
+ /* Print OID */
+ if (info->obj_hidefileno)
+ h5tools_str_append(str, info->obj_format, oi.addr);
+ else
+ h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr);
+
+ /* Print name */
+ path = lookup_ref_path(*(haddr_t *) vp);
+ if (path) {
+ h5tools_str_append(str, " ");
+ h5tools_str_append(str, path);
+ h5tools_str_append(str, " ");
+ } /* end if */
+ } /* end else */
+ }
break;
- } /* end switch */
- H5Oclose(obj);
-
- /* Print OID */
- if (info->obj_hidefileno)
- h5tools_str_append(str, info->obj_format, oi.addr);
- else
- h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr);
-
- /* Print name */
- path = lookup_ref_path(*(haddr_t *) vp);
- if (path) {
- h5tools_str_append(str, " ");
- h5tools_str_append(str, path);
- h5tools_str_append(str, " ");
- } /* end if */
- } /* end else */
- }
- else if (H5Tget_class(type) == H5T_ARRAY) {
- int k, ndims;
- hsize_t i, dims[H5S_MAX_RANK], temp_nelmts;
- static int is_next_arry_elmt = 0;
-
- /* Get the array's base datatype for each element */
- memb = H5Tget_super(type);
- size = H5Tget_size(memb);
- ndims = H5Tget_array_ndims(type);
- H5Tget_array_dims2(type, dims);
- HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK);
-
- /* Calculate the number of array elements */
- for (k = 0, nelmts = 1; k < ndims; k++) {
- temp_nelmts = nelmts;
- temp_nelmts *= dims[k];
- HDassert(temp_nelmts == (hsize_t) ((size_t) temp_nelmts));
- nelmts = (size_t) temp_nelmts;
- }
- /* Print the opening bracket */
- h5tools_str_append(str, "%s", OPT(info->arr_pre, "["));
-
- ctx->indent_level++;
-
- for (i = 0; i < nelmts; i++) {
- if (i)
- h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK));
-
- if (info->arr_linebreak && i && i % dims[ndims - 1] == 0) {
- h5tools_str_append(str, "%s", "\n");
- h5tools_str_indent(str, info, ctx);
-
- } /* end if */
- else if (i && info->arr_sep) {
- /* if next element begin, add next line with indent */
- if (is_next_arry_elmt) {
- is_next_arry_elmt = 0;
-
- h5tools_str_append(str, "%s", "\n ");
- h5tools_str_indent(str, info, ctx);
-
+ case H5T_ARRAY:
+ {
+ int k, ndims;
+ hsize_t i, dims[H5S_MAX_RANK], temp_nelmts;
+ static int is_next_arry_elmt = 0;
+
+ /* Get the array's base datatype for each element */
+ memb = H5Tget_super(type);
+ size = H5Tget_size(memb);
+ ndims = H5Tget_array_ndims(type);
+ H5Tget_array_dims2(type, dims);
+ HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK);
+
+ /* Calculate the number of array elements */
+ for (k = 0, nelmts = 1; k < ndims; k++) {
+ temp_nelmts = nelmts;
+ temp_nelmts *= dims[k];
+ HDassert(temp_nelmts == (hsize_t) ((size_t) temp_nelmts));
+ nelmts = (size_t) temp_nelmts;
+ }
+ /* Print the opening bracket */
+ h5tools_str_append(str, "%s", OPT(info->arr_pre, "["));
+
+ ctx->indent_level++;
+
+ for (i = 0; i < nelmts; i++) {
+ if (i) h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK));
+
+ if (info->arr_linebreak && i && i % dims[ndims - 1] == 0) {
+ h5tools_str_append(str, "%s", "\n");
+ h5tools_str_indent(str, info, ctx);
+
+ } /* end if */
+ else if (i && info->arr_sep) {
+ /* if next element begin, add next line with indent */
+ if (is_next_arry_elmt) {
+ is_next_arry_elmt = 0;
+
+ h5tools_str_append(str, "%s", "\n ");
+ h5tools_str_indent(str, info, ctx);
+
+ }
+ /* otherwise just add space */
+ else
+ h5tools_str_append(str, " ");
+
+ } /* end else if */
+
+ /* Dump values in an array element */
+ is_next_arry_elmt = 0; /* dump all values in the array element, so turn it off */
+ h5tools_str_sprint(str, info, container, memb, cp_vp + i * size, ctx);
+ } /* end for */
+
+ ctx->indent_level--;
+
+ /* Print the closing bracket */
+ h5tools_str_append(str, "%s", OPT(info->arr_suf, "]"));
+ is_next_arry_elmt = 1; /* set for begining of next array element */
+ H5Tclose(memb);
}
- /* otherwise just add space */
- else
- h5tools_str_append(str, " ");
-
- } /* end else if */
-
- /* Dump values in an array element */
- is_next_arry_elmt = 0; /* dump all values in the array element, so turn it off */
- h5tools_str_sprint(str, info, container, memb, cp_vp + i * size, ctx);
- } /* end for */
-
- ctx->indent_level--;
-
- /* Print the closing bracket */
- h5tools_str_append(str, "%s", OPT(info->arr_suf, "]"));
- is_next_arry_elmt = 1; /* set for begining of next array element */
- H5Tclose(memb);
- }
- else if (H5Tget_class(type) == H5T_VLEN) {
- unsigned int i;
+ break;
+ case H5T_VLEN:
+ {
+ unsigned int i;
- /* Get the VL sequences's base datatype for each element */
- memb = H5Tget_super(type);
- size = H5Tget_size(memb);
+ /* Get the VL sequences's base datatype for each element */
+ memb = H5Tget_super(type);
+ size = H5Tget_size(memb);
- /* Print the opening bracket */
- h5tools_str_append(str, "%s", OPT(info->vlen_pre, "("));
+ /* Print the opening bracket */
+ h5tools_str_append(str, "%s", OPT(info->vlen_pre, "("));
- /* Get the number of sequence elements */
- nelmts = ((hvl_t *) cp_vp)->len;
+ /* Get the number of sequence elements */
+ nelmts = ((hvl_t *) cp_vp)->len;
- for (i = 0; i < nelmts; i++) {
- if (i)
- h5tools_str_append(str, "%s", OPT(info->vlen_sep, "," OPTIONAL_LINE_BREAK));
+ for (i = 0; i < nelmts; i++) {
+ if (i) h5tools_str_append(str, "%s", OPT(info->vlen_sep, "," OPTIONAL_LINE_BREAK));
#ifdef LATER
- /* Need to fix so VL data breaks at correct location on end of line -QAK */
- if (info->arr_linebreak && h5tools_str_len(str)>=info->line_ncols) {
- int x;
+ /* Need to fix so VL data breaks at correct location on end of line -QAK */
+ if (info->arr_linebreak && h5tools_str_len(str)>=info->line_ncols) {
+ int x;
- h5tools_str_append(str, "%s", "\n");
+ h5tools_str_append(str, "%s", "\n");
- /* need to indent some more here */
- if (ctx->indent_level >= 0)
- h5tools_str_append(str, "%s", OPT(info->line_pre, ""));
+ /* need to indent some more here */
+ if (ctx->indent_level >= 0)
+ h5tools_str_append(str, "%s", OPT(info->line_pre, ""));
- for (x = 0; x < ctx->indent_level + 1; x++)
- h5tools_str_append(str,"%s",OPT(info->line_indent,""));
- } /* end if */
+ for (x = 0; x < ctx->indent_level + 1; x++)
+ h5tools_str_append(str,"%s",OPT(info->line_indent,""));
+ } /* end if */
#endif /* LATER */
- ctx->indent_level++;
+ ctx->indent_level++;
- /* Dump the array element */
- h5tools_str_sprint(str, info, container, memb,
- ((char *) (((hvl_t *) cp_vp)->p)) + i * size, ctx);
+ /* Dump the array element */
+ h5tools_str_sprint(str, info, container, memb, ((char *) (((hvl_t *) cp_vp)->p)) + i * size, ctx);
- ctx->indent_level--;
- } /* end for */
+ ctx->indent_level--;
+ } /* end for */
- h5tools_str_append(str, "%s", OPT(info->vlen_suf, ")"));
- H5Tclose(memb);
- }
- else {
- /* All other types get printed as hexadecimal */
- size_t i;
- n = H5Tget_size(type);
- if (1 == n) {
- h5tools_str_append(str, "0x%02x", ucp_vp[0]);
- }
- else {
- for (i = 0; i < n; i++)
- h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]);
- }
- }
+ h5tools_str_append(str, "%s", OPT(info->vlen_suf, ")"));
+ H5Tclose(memb);
+ }
+ break;
+ default:
+ {
+ /* All other types get printed as hexadecimal */
+ size_t i;
+ n = H5Tget_size(type);
+ if (1 == n) {
+ h5tools_str_append(str, "0x%02x", ucp_vp[0]);
+ }
+ else {
+ for (i = 0; i < n; i++)
+ h5tools_str_append(str, "%s%02x", i ? ":" : "", ucp_vp[i]);
+ }
+ }
+ break;
+ } /* end switch */
+ }
return h5tools_str_fmt(str, start, OPT(info->elmt_fmt, "%s"));
}
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 11ab5f3..79322bc 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -852,6 +852,8 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_
/* set target obj type to return */
link_info->trg_type = trg_oinfo.type;
+ link_info->objno = trg_oinfo.addr;
+ link_info->fileno = trg_oinfo.fileno;
} /* end if */
else
link_info->trg_type = H5O_TYPE_UNKNOWN;
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h
index f30974a..10c643d 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -161,6 +161,8 @@ typedef struct {
H5O_type_t trg_type; /* OUT: target type */
const char *trg_path; /* OUT: target obj path. This must be freed
* when used with H5tools_get_symlink_info() */
+ haddr_t objno; /* OUT: target object address */
+ unsigned long fileno; /* OUT: File number that target object is located in */
H5L_info_t linfo; /* OUT: link info */
h5tool_opt_t opt; /* IN: options */
} h5tool_link_info_t;
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 0215c46..8455360 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -354,6 +354,31 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type)
info->paths[idx].objno = HADDR_UNDEF;
} /* end trav_info_add() */
+
+/*-------------------------------------------------------------------------
+ * Function: trav_fileinfo_add
+ *
+ * Purpose: Add a file addr & fileno to info struct
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+trav_fileinfo_add(trav_info_t *info, hid_t loc_id)
+{
+ H5O_info_t oinfo;
+ size_t idx = info->nused - 1;
+
+ if ( info->paths[idx].path && HDstrcmp(info->paths[idx].path, "."))
+ H5Oget_info_by_name(loc_id, info->paths[idx].path, &oinfo, H5P_DEFAULT);
+ else
+ H5Oget_info(loc_id, &oinfo);
+
+ info->paths[idx].objno = oinfo.addr;
+ info->paths[idx].fileno = oinfo.fileno;
+} /* end trav_fileinfo_add() */
+
/*-------------------------------------------------------------------------
* Function: trav_info_visit_obj
diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h
index c416cf8..3548c6b 100644
--- a/tools/lib/h5trav.h
+++ b/tools/lib/h5trav.h
@@ -177,6 +177,8 @@ H5TOOLS_DLL void trav_info_free(trav_info_t *info);
H5TOOLS_DLL void trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type);
+H5TOOLS_DLL void trav_fileinfo_add(trav_info_t *info, hid_t loc_id);
+
/*-------------------------------------------------------------------------
* table private functions
*-------------------------------------------------------------------------
diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt
index 43808e7..5e0a8f1 100644
--- a/tools/testfiles/h5dump-help.txt
+++ b/tools/testfiles/h5dump-help.txt
@@ -62,10 +62,20 @@ usage: h5dump [OPTIONS] files
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.
+ 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.
+ These are the letters that are appended to the file name(without .h5) when opening
+ names for the split(m,r) and multi(s,b,r,g,l,o) drivers. They are:
+ m: All meta data when using the split driver.
+ s: The userblock, superblock, and driver info block
+ b: B-tree nodes
+ r: Dataset raw data
+ g: Global heap
+ l: local heap (object names)
+ o: object headers
+
F - is a filename.
P - is the full path from the root group to the object.
N - is an integer greater than 1.
@@ -102,7 +112,11 @@ usage: h5dump [OPTIONS] files
h5dump -d /dset -M 0,1,4,3 quux.h5
- 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5
+ 5) Dataset foo in files file1.h5 file2.h5 file3.h5
+
+ h5dump -d /foo file1.h5 file2.h5 file3.h5
+
+ 6) Dataset foo in split files splitfile-m.h5 splitfile-r.h5
- h5dump -d /foo multi1.h5 multi2.h5 multi3.h5
+ h5dump -d /foo -f split splitfile
diff --git a/tools/testfiles/tnofilename-with-packed-bits.ddl b/tools/testfiles/tnofilename-with-packed-bits.ddl
index f74483f..a82c94e 100644
--- a/tools/testfiles/tnofilename-with-packed-bits.ddl
+++ b/tools/testfiles/tnofilename-with-packed-bits.ddl
@@ -62,10 +62,20 @@ usage: h5dump [OPTIONS] files
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.
+ 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.
+ These are the letters that are appended to the file name(without .h5) when opening
+ names for the split(m,r) and multi(s,b,r,g,l,o) drivers. They are:
+ m: All meta data when using the split driver.
+ s: The userblock, superblock, and driver info block
+ b: B-tree nodes
+ r: Dataset raw data
+ g: Global heap
+ l: local heap (object names)
+ o: object headers
+
F - is a filename.
P - is the full path from the root group to the object.
N - is an integer greater than 1.
@@ -102,8 +112,12 @@ usage: h5dump [OPTIONS] files
h5dump -d /dset -M 0,1,4,3 quux.h5
- 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5
+ 5) Dataset foo in files file1.h5 file2.h5 file3.h5
+
+ h5dump -d /foo file1.h5 file2.h5 file3.h5
+
+ 6) Dataset foo in split files splitfile-m.h5 splitfile-r.h5
- h5dump -d /foo multi1.h5 multi2.h5 multi3.h5
+ h5dump -d /foo -f split splitfile
h5dump error: missing file name
diff --git a/tools/testfiles/tpbitsIncomplete.ddl b/tools/testfiles/tpbitsIncomplete.ddl
index 31a386d..72d54fc 100644
--- a/tools/testfiles/tpbitsIncomplete.ddl
+++ b/tools/testfiles/tpbitsIncomplete.ddl
@@ -62,10 +62,20 @@ usage: h5dump [OPTIONS] files
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.
+ 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.
+ These are the letters that are appended to the file name(without .h5) when opening
+ names for the split(m,r) and multi(s,b,r,g,l,o) drivers. They are:
+ m: All meta data when using the split driver.
+ s: The userblock, superblock, and driver info block
+ b: B-tree nodes
+ r: Dataset raw data
+ g: Global heap
+ l: local heap (object names)
+ o: object headers
+
F - is a filename.
P - is the full path from the root group to the object.
N - is an integer greater than 1.
@@ -102,8 +112,12 @@ usage: h5dump [OPTIONS] files
h5dump -d /dset -M 0,1,4,3 quux.h5
- 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5
+ 5) Dataset foo in files file1.h5 file2.h5 file3.h5
+
+ h5dump -d /foo file1.h5 file2.h5 file3.h5
+
+ 6) Dataset foo in split files splitfile-m.h5 splitfile-r.h5
- h5dump -d /foo multi1.h5 multi2.h5 multi3.h5
+ h5dump -d /foo -f split splitfile
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 b2ab900..d8b627c 100644
--- a/tools/testfiles/tpbitsLengthExceeded.ddl
+++ b/tools/testfiles/tpbitsLengthExceeded.ddl
@@ -62,10 +62,20 @@ usage: h5dump [OPTIONS] files
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.
+ 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.
+ These are the letters that are appended to the file name(without .h5) when opening
+ names for the split(m,r) and multi(s,b,r,g,l,o) drivers. They are:
+ m: All meta data when using the split driver.
+ s: The userblock, superblock, and driver info block
+ b: B-tree nodes
+ r: Dataset raw data
+ g: Global heap
+ l: local heap (object names)
+ o: object headers
+
F - is a filename.
P - is the full path from the root group to the object.
N - is an integer greater than 1.
@@ -102,8 +112,12 @@ usage: h5dump [OPTIONS] files
h5dump -d /dset -M 0,1,4,3 quux.h5
- 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5
+ 5) Dataset foo in files file1.h5 file2.h5 file3.h5
+
+ h5dump -d /foo file1.h5 file2.h5 file3.h5
+
+ 6) Dataset foo in split files splitfile-m.h5 splitfile-r.h5
- h5dump -d /foo multi1.h5 multi2.h5 multi3.h5
+ h5dump -d /foo -f split splitfile
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 2140ab7..39cef23 100644
--- a/tools/testfiles/tpbitsLengthPositive.ddl
+++ b/tools/testfiles/tpbitsLengthPositive.ddl
@@ -62,10 +62,20 @@ usage: h5dump [OPTIONS] files
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.
+ 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.
+ These are the letters that are appended to the file name(without .h5) when opening
+ names for the split(m,r) and multi(s,b,r,g,l,o) drivers. They are:
+ m: All meta data when using the split driver.
+ s: The userblock, superblock, and driver info block
+ b: B-tree nodes
+ r: Dataset raw data
+ g: Global heap
+ l: local heap (object names)
+ o: object headers
+
F - is a filename.
P - is the full path from the root group to the object.
N - is an integer greater than 1.
@@ -102,8 +112,12 @@ usage: h5dump [OPTIONS] files
h5dump -d /dset -M 0,1,4,3 quux.h5
- 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5
+ 5) Dataset foo in files file1.h5 file2.h5 file3.h5
+
+ h5dump -d /foo file1.h5 file2.h5 file3.h5
+
+ 6) Dataset foo in split files splitfile-m.h5 splitfile-r.h5
- h5dump -d /foo multi1.h5 multi2.h5 multi3.h5
+ h5dump -d /foo -f split splitfile
h5dump error: Packed Bit length value(0) must be positive.
diff --git a/tools/testfiles/tpbitsMaxExceeded.ddl b/tools/testfiles/tpbitsMaxExceeded.ddl
index 598b2cd..5f35825 100644
--- a/tools/testfiles/tpbitsMaxExceeded.ddl
+++ b/tools/testfiles/tpbitsMaxExceeded.ddl
@@ -62,10 +62,20 @@ usage: h5dump [OPTIONS] files
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.
+ 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.
+ These are the letters that are appended to the file name(without .h5) when opening
+ names for the split(m,r) and multi(s,b,r,g,l,o) drivers. They are:
+ m: All meta data when using the split driver.
+ s: The userblock, superblock, and driver info block
+ b: B-tree nodes
+ r: Dataset raw data
+ g: Global heap
+ l: local heap (object names)
+ o: object headers
+
F - is a filename.
P - is the full path from the root group to the object.
N - is an integer greater than 1.
@@ -102,8 +112,12 @@ usage: h5dump [OPTIONS] files
h5dump -d /dset -M 0,1,4,3 quux.h5
- 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5
+ 5) Dataset foo in files file1.h5 file2.h5 file3.h5
+
+ h5dump -d /foo file1.h5 file2.h5 file3.h5
+
+ 6) Dataset foo in split files splitfile-m.h5 splitfile-r.h5
- h5dump -d /foo multi1.h5 multi2.h5 multi3.h5
+ h5dump -d /foo -f split splitfile
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 a8192e9..92cc816 100644
--- a/tools/testfiles/tpbitsOffsetExceeded.ddl
+++ b/tools/testfiles/tpbitsOffsetExceeded.ddl
@@ -62,10 +62,20 @@ usage: h5dump [OPTIONS] files
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.
+ 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.
+ These are the letters that are appended to the file name(without .h5) when opening
+ names for the split(m,r) and multi(s,b,r,g,l,o) drivers. They are:
+ m: All meta data when using the split driver.
+ s: The userblock, superblock, and driver info block
+ b: B-tree nodes
+ r: Dataset raw data
+ g: Global heap
+ l: local heap (object names)
+ o: object headers
+
F - is a filename.
P - is the full path from the root group to the object.
N - is an integer greater than 1.
@@ -102,8 +112,12 @@ usage: h5dump [OPTIONS] files
h5dump -d /dset -M 0,1,4,3 quux.h5
- 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5
+ 5) Dataset foo in files file1.h5 file2.h5 file3.h5
+
+ h5dump -d /foo file1.h5 file2.h5 file3.h5
+
+ 6) Dataset foo in split files splitfile-m.h5 splitfile-r.h5
- h5dump -d /foo multi1.h5 multi2.h5 multi3.h5
+ h5dump -d /foo -f split splitfile
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 60e31ec..c318834 100644
--- a/tools/testfiles/tpbitsOffsetNegative.ddl
+++ b/tools/testfiles/tpbitsOffsetNegative.ddl
@@ -62,10 +62,20 @@ usage: h5dump [OPTIONS] files
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.
+ 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.
+ These are the letters that are appended to the file name(without .h5) when opening
+ names for the split(m,r) and multi(s,b,r,g,l,o) drivers. They are:
+ m: All meta data when using the split driver.
+ s: The userblock, superblock, and driver info block
+ b: B-tree nodes
+ r: Dataset raw data
+ g: Global heap
+ l: local heap (object names)
+ o: object headers
+
F - is a filename.
P - is the full path from the root group to the object.
N - is an integer greater than 1.
@@ -102,8 +112,12 @@ usage: h5dump [OPTIONS] files
h5dump -d /dset -M 0,1,4,3 quux.h5
- 5) Dataset foo in files multi1.h5 multi2.h5 multi3.h5
+ 5) Dataset foo in files file1.h5 file2.h5 file3.h5
+
+ h5dump -d /foo file1.h5 file2.h5 file3.h5
+
+ 6) Dataset foo in split files splitfile-m.h5 splitfile-r.h5
- h5dump -d /foo multi1.h5 multi2.h5 multi3.h5
+ h5dump -d /foo -f split splitfile
h5dump error: Bad mask list(-1,1)